Skip to content

Instantly share code, notes, and snippets.

View John-Lin's full-sized avatar
👋
hi

Che-Wei Lin John-Lin

👋
hi
View GitHub Profile
@John-Lin
John-Lin / pyew_note
Last active August 29, 2015 14:17
A Python tool for static malware analysis
pynew download: https://code.google.com/p/pyew/downloads/list
TypicalProblems problem:
https://code.google.com/p/pyew/wiki/TypicalProblems
1. PEFILE: global name 'Decode32Bits' is not defined
Slove: https://github.com/kbandla/distorm64
X86組合語言/基本指令集
@John-Lin
John-Lin / fat_tree.py
Last active August 29, 2015 14:18
SDN LAB1
# sudo mn --custom ./fat_tree.py --topo mytopo --switch ovs,protocols=OpenFlow13 --controller=remote,ip=192.168.56.1
from mininet.topo import Topo
from mininet.cli import CLI
from mininet.net import Mininet
from mininet.link import TCLink
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel
from mininet.node import RemoteController
# hosts connections
@John-Lin
John-Lin / HTTP-sys.py
Last active August 29, 2015 14:19
MS15-034 Checker
# original PoC: http://pastebin.com/raw.php?i=ypURDPc4
'''
___. .___ __ __
\_ |__ ____ ___.__. ____ ____ __| _// |________ __ __ _______/ |_
| __ \_/ __ < | |/ _ \ / \ / __ |\ __\_ __ \ | \/ ___/\ __\
| \_\ \ ___/\___ ( <_> ) | \/ /_/ | | | | | \/ | /\___ \ | |
|___ /\___ > ____|\____/|___| /\____ | |__| |__| |____//____ > |__|
\/ \/\/ \/ \/ \/
MS15-034 Checker
@John-Lin
John-Lin / dhcp.js
Created April 26, 2015 04:25
Decode DHCP
var EthernetAddr = require("./ethernet_addr");
var IPv4Addr = require("./ipv4_addr");
// DHCP packet parser
// RFC 2131
// DHCP packet format
// 0 1 2 3
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
// +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
// | op (1) | htype (1) | hlen (1) | hops (1) |
@John-Lin
John-Lin / delete_all_flows.py
Created July 21, 2015 09:54
Delete all flows
from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER
from ryu.controller.handler import set_ev_cls
class DeleteAll(app_manager.RyuApp):
def __init__(self, *args, **kwargs):
super(DeleteAll, self).__init__(*args, **kwargs)
var request = require('request');
var config = require('./config');
module.exports = {
startPkt: function() {
dpid = config.dpid;
urlApi = 'http://127.0.0.1:8080/packetgen/start/' + dpid;
request(urlApi, function(error, response, body) {
if (!error && response.statusCode == 200) {
@John-Lin
John-Lin / fizzbuzz.rb
Created September 28, 2015 15:10
For SOA fizzbuzz homework
def fizzbuzz(num, &strategy)
arr = []
1.upto(num) do |i|
if i % 5 == 0 and i % 3 == 0
arr.push("FizzBuzz")
if strategy
yield 'FizzBuzz'
end
elsif i % 3 == 0
arr.push("Fizz")
@John-Lin
John-Lin / yml_to_tsv.rb
Created September 28, 2015 15:14
For SOA Serialization homework
if ARGV[1].nil?
print 'Insert the name of your output file (tsv file) '
outname = $stdin.gets.chomp
else
outname = ARGV[1]
end
# Deserialize
require 'yaml'
survey = YAML.load(File.read(ARGV[0]))
# Create the TSV file
@John-Lin
John-Lin / tsv_to_yml.rb
Created September 28, 2015 15:15
For SOA Serialization homework
# Check the output file
if ARGV[1].nil?
print 'Insert the name of your output file (yml file) '
outname = $stdin.gets.chomp
else
outname = ARGV[1]
end
# Build the array of Hashes
require 'yaml'
survey = []
@John-Lin
John-Lin / packer_spec.rb
Last active March 3, 2016 15:17
Assignment: Data Packer
require 'minitest/autorun'
require './short_string_packer'
def random_string
[*'a'..'z'].sample(rand(1..12)).join
end
test_cases = %w(a z asdf abcdefghijkl aaaaaazzzzzz)
describe 'Test whether packing methods are valid' do