Skip to content

Instantly share code, notes, and snippets.

View pichuang's full-sized avatar

Phil Huang pichuang

View GitHub Profile
@pichuang
pichuang / Pingall_flood.py
Created March 13, 2014 18:08
Pingall_flood
#!/usr/bin/env python
import httplib
import json
class StaticFlowPusher(object):
def __init__(self, server):
self.server = server
def get(self, data):
@pichuang
pichuang / Fat_Tree_Topology.py
Created March 30, 2014 16:35
Create Fat Tree Topology
#!/usr/bin/env python
from mininet.net import Mininet
from mininet.node import Controller, RemoteController
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import Link, Intf, TCLink
from mininet.topo import Topo
from mininet.util import dumpNodeConnections
import logging
@pichuang
pichuang / network
Last active January 1, 2024 14:58
OpenWrt /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config interface 'lan1'
option ifname 'eth0.1'
option proto 'static'
@pichuang
pichuang / firewall
Created March 30, 2014 17:38
OpenWrt /etc/config/firewall
config rule
option src wan
option src_ip ''
option proto tcp
option dest_port 22
option target ACCEPT
@pichuang
pichuang / Mininet_connect_to_internet.py
Last active August 26, 2021 16:42
Let mininet nodes can connect to the internet
#!/usr/bin/env python
import os
from mininet.net import Mininet
from mininet.node import Controller, RemoteController
from mininet.cli import CLI
from mininet.link import Intf
from mininet.log import setLogLevel, info
def myNetwork():
@pichuang
pichuang / set_netflow
Last active August 29, 2015 14:00
set netflow config
#!/bin/bash
BRIDGE_NAME=
COLLECTOR_IP=
COLLECTOR_PORT=
TIMEOUT=10
ovs-vsctl -- set Bridge ${BRIDGE_NAME} netflow=@nf \
-- --id=@nf create NetFlow target=\"${COLLECTOR_IP}:${COLLECTOR_PORT}\" active-timeout=${TIMEOUT}
@pichuang
pichuang / set_sflow
Created April 26, 2014 21:52
set ovs-sflow config
#/bin/bash
COLLECTOR_IP=
COLLECTOR_PORT=
AGENT=
HEADER=128
SAMPLING=512
POLLING=10
BRIDGE_NAME=
sudo ovs-vsctl -- --id=@sflow create sflow agent=${AGENT} \
@pichuang
pichuang / sources.list
Last active October 8, 2024 23:52
Kali Linux source.list /etc/apt/sources.list
deb http://http.kali.org/kali kali-rolling main contrib non-free
deb-src http://http.kali.org/kali kali-rolling main contrib non-free
#deb http://kali.cs.nctu.edu.tw/kali kali-rolling main non-free contrib
@pichuang
pichuang / netsec2014_project2.py
Last active August 29, 2015 14:01
netsec2014 Project 2
#!/usr/bin/python
"""
Follow http://danmcinerney.org/http-post-analyzer-in-python/
Enviroment: python2.x and scapy
Goal: Use scapy to sniffer tcp 80 port
"""
import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *
@pichuang
pichuang / CustomTopo.py
Created June 9, 2014 01:43
Programming Assignment 2: Using Mininet and Mininet Python API
#!/usr/bin/env python
'''
Coursera:
- Software Defined Networking (SDN) course
-- Programming Assignment 2
Professor: Nick Feamster
Teaching Assistant: Arpit Gupta, Muhammad Shahbaz
'''