This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# sh tshark_extract_fields.sh [-h] | [ -i /input_path/trace.pcap -o output_path/tshark_trace.log -k ] | |
usage="sh $(basename "$0") [-h] | [-i input.pcap -o output.log][-k] -- program to extract packet fields from pcap for KPI calculations using tshark | |
where: | |
-h show this help text | |
-i path to input pcap | |
-o path to output csv log file | |
-k output only specific KPI related fields" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# editcap -i 3600 dns_all_20170124_20170130.pcap split_20170124_20170130/split_hour.pcap | |
# tshark -r file.pcap -T fields -e frame.time_relative -e ip.src -e ip.dst -e dns.qry.name -Y "dns.flags.response eq 0" > file.csv | |
date=$1 #20170124_20170130 or 20170207_20170212 | |
for filename in split_$date/*.pcap; do | |
echo "extract $filename to tshark_$date" | |
tshark -r "$filename" -E separator="|" -T fields -e frame.time_epoch -e frame.time_relative -e ip.src -e ip.dst -e dns.qry.name -e dns.qry.type -Y "dns.flags.response eq 0" > "tshark_$date/$(basename "$filename" .pcap).csv" | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
from selenium.webdriver.chrome.options import Options | |
from BeautifulSoup import BeautifulSoup | |
import time | |
NAME = "Mom" | |
RELOAD_TIMEOUT = 1 | |
ERROR_TIMEOUT = 5 | |
NUM_CYCLES = 10 | |
FIREFOX_PATH = "/Users/sgrover/Library/Application Support/Firefox/Profiles/9w4h7jdq.default" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
df = pd.DataFrame({'ID':['1','2','3'], 'J1': [0,2,3], 'J2':[1,4,5]}) | |
print df | |
lst = ['a','b','c','d','e','f'] | |
df['J3'] = df.apply(lambda row:lst[row['J1']:row['J2']],axis=1) | |
print df |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# wlan0 is locked: unlock it | |
# http://askubuntu.com/questions/472794/hostapd-error-nl80211-could-not-configure-driver-mode | |
sudo nmcli nm wifi off | |
sudo rfkill unblock wlan | |
sudo ifconfig wlan0 10.0.0.1/24 up | |
sleep 1 | |
sudo service isc-dhcp-server restart | |
sudo service hostapd restart |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo tcpdump -i eth0 -xnvv -w - | tee $(date +"%s").pcap | tcpdump -rn - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from lwpb.codec import MessageCodec | |
codec = MessageCodec(pb2file='trace.pb2', typename='passive.Trace') | |
data = open('passive-sample_trace', 'r').read() | |
# Does something like this work? | |
trace = codec.decode(data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#insmod sch_tbf | |
#insmod sch_prio | |
#insmod cls_u32 | |
#insmod cls_fw | |
interface=$1 | |
down_rate=$2 # "mbits", Megabits per second | |
latency=$3 # "ms" | |
#HZ=$(grep 'CONFIG_HZ=' /boot/config-$(uname -r) | sed 's/CONFIG_HZ=//') | |
HZ=100 #not sure |
NewerOlder