This file contains 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
#!/usr/bin/env bash | |
iface=$(ip -4 route list 0/0 | cut -d " " -f 5) | |
gateway=$(ip -4 route list 0/0 | cut -d " " -f 3) | |
ip=$(ip -4 route get $gateway | head -n 1 | cut -d " " -f 5) | |
# XXX check if gateway/ip in VPN range | |
set -v #echo on | |
ip address flush $iface | |
ip address add $ip/32 dev $iface | |
ip route add $gateway/32 dev $iface src $ip |
This file contains 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
def hex_dump(pdu): | |
""" Useful routine to dump pdu, "xxd" way | |
""" | |
import string | |
length = 0x10 | |
for i in range(0, len(pdu) // length + 1): | |
begin = i * length | |
end = (i + 1) * length | |
padding = " " * (length - len(pdu[begin:end])) * 3 | |
bytes_chunk = "".join("{:02x} ".format(ord(c)) for c in pdu[begin:end]) |
This file contains 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 scapy.all import * | |
from subprocess import Popen, PIPE | |
from tempfile import mkdtemp | |
packets = rdpcap("/tmp/toconvert.pcap") | |
temp_pcaps = mkdtemp() | |
paths_pcaps = [] | |
for i, pkt in enumerate(packets): | |
if pkt[3].load[2] == "\x0e": # type 14 | |
nas_payload = pkt[3].load[16:] |
This file contains 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
https://wiki.wireshark.org/HowToDissectAnything?highlight=%28USER_DLT%29 | |
echo -n "PAYLOAD GOES HERE" | xxd -p -r > /tmp/test.raw | |
OR | |
export raw bytes from wireshark | |
od -Ax -tx1 -v /tmp/test.raw | text2pcap -l 147 - test.pcap | |
Configure DLT-USER protocol as "nas-eps" (protocol field) |
This file contains 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 libmich.formats.L3Mobile import * | |
data = "NAS-EPS PAYLOAD GOES HERE" | |
show(parse_L3(data.decode("hex"))) |
This file contains 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 | |
# Allow piping to Sublime Text. Doesn't interfere with normal use. | |
# Is stdin a terminal? | |
if test -t 0; then | |
# Stdin is a terminal. | |
# Open sublime normally. | |
/opt/sublime_text/sublime_text "$@" | |
else |
This file contains 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
#!/usr/bin/env python3 | |
# | |
# woof -- an ad-hoc single file webserver | |
# Copyright (C) 2004-2009 Simon Budig <simon@budig.de> | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation; either version 2 of the License, or | |
# (at your option) any later version. | |
# |
This file contains 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/sh | |
# I put all my dev stuff in here | |
export DEV_PREFIX=$HOME/Dev/ | |
# Don't forget to adjust this to your NDK path | |
export ANDROID_NDK=${DEV_PREFIX}/android-ndk-r8d/ | |
export CROSS_COMPILE=arm-linux-androideabi |