aboutsummaryrefslogtreecommitdiffstats
path: root/wirecroute/wirecroute.rb
diff options
context:
space:
mode:
authorLaurent Ghigonis <laurent@p1sec.com>2013-02-27 20:17:55 +0100
committerLaurent Ghigonis <laurent@p1sec.com>2013-02-27 20:17:55 +0100
commitf7cc64029eed829ff2df6cb631cacd41fe2ca539 (patch)
treed1581dcf0161fd5bb9a5cf9ab1ebe6be3f13973d /wirecroute/wirecroute.rb
parentadd skylog, tool to log skype users status changes to stdout in CSV format (diff)
downloadlaurent-tools-f7cc64029eed829ff2df6cb631cacd41fe2ca539.tar.xz
laurent-tools-f7cc64029eed829ff2df6cb631cacd41fe2ca539.zip
wirecroute rb script
Diffstat (limited to 'wirecroute/wirecroute.rb')
-rwxr-xr-xwirecroute/wirecroute.rb52
1 files changed, 52 insertions, 0 deletions
diff --git a/wirecroute/wirecroute.rb b/wirecroute/wirecroute.rb
new file mode 100755
index 0000000..658c083
--- /dev/null
+++ b/wirecroute/wirecroute.rb
@@ -0,0 +1,52 @@
+#!/usr/bin/env ruby
+
+require 'pcaprub'
+require 'rubygems'
+require 'racket'
+include Racket
+
+PAYLOAD_SCTP_1 = "\x0b\x58\x0b\x58\x00\x00\x44\x70\x08\xe7\x3a\xd9\x00\x03\x00\xf4\x1b\x40\x57\x3a\x00\x01\x56\x4c\x00\x00\x00\x02\x01\x00\x06\x01\x00\x00\x00\xe4\x00\x01\x00\x08\x00\x00\x00\x32\x03\x00\x00\xd3\x83\xa1\x70\x3c\xfc\x09\x80\x03\x07\x0b\x04\xc3\xa1\x30\x08\x04\xc3\xf1\x30\x08\xba\xe2\x81\xb7\xc7\x04\x00\x00\x00\x27\xe8\x81\xae\xe9\x81\xab\xcf\x01\x00\xd1\x02\x09\x24\x25\x00\xa1\x81\x07\x00\x64\x1e\x00\x00\x04\x00\x89\x04\x80\x21\xce\x7a\x9f\x83\x06\x67\xa0\x00\x00\x01\x89\xb7\x25\x86\x02\x09\x05\x87\x01\x01\x82\x02\x00\x42\x2f\x82\x64\x33\x12\x0c\xca\x00\x62\x00\x02\x01\x3a\x01\x03\x00\xc0\x06\x09\x07\x1c\x01\x00\x30\x84\x0a\x3f\x11\x08\x0a\x03\x02\x3f\x82\xf0\x00\x00\x0e\x10\x00\x00\x01\x00\x01\xf0\xf0\x01\x06\x01\x00\x03\x11\x04\x86\x30\x9f\x3e\x01\x09\x9f\x3f\x08\x62\x3f\x00\x00\x00\x00\x00\x00\x9f\x42\x01\x06\xbf\x81\x30\x06\x9f\x81\x2f\x02\x00\x03\x9f\x81\x31\x01\x3a\xbf\x81\x08\x11\xbf\x81\x76\x0d\x83\x02\x00\x22\x9f\x41\x01\x00\x9f\x3d\x02\x00\x00\x9f\x27\x01\x00\x9e\x01\x02\x88\x05\x16\x19\x32\x14\x60\x00"
+PAYLOAD_SCTP_2 = "\x0b\x58\x0b\x58\x1b\x3e\xbb\x2b\x30\x39\x2b\x2d\x03\x00\x00\x10\x1b\x40\x57\x3a\x00\x00\x3c\x00\x00\x00\x00\x00\x00\x03\x00\xbc\x00\x01\x77\x11\x00\x06\x55\x97\x00\x00\x00\x02\x01\x00\x06\x01\x00\x00\x00\xac\x00\x01\x00\x08\x00\x00\x00\x32\x03\x00\x00\x9c\x83\xf1\x70\x71\xcc\x09\x80\x03\x07\x0b\x04\xc3\xf1\x30\x08\x04\xc3\xa1\x30\x08\x83\xe5\x81\x80\xc7\x08\x00\x00\x00\x0e\x00\x00\x00\x27\xe8\x74\xea\x72\xcf\x01\x36\xf2\x6d\x9f\x82\x65\x3f\x09\x07\x11\x01\x00\x18\x84\x0a\x69\x10\x09\x8a\xa7\x20\x53\x00\x12\x06\x02\x1f\x17\x05\x00\xb8\x08\x19\x01\x0f\x08\x00\x84\x41\x0a\x10\x12\x01\x00\x0e\x10\x00\x00\x01\x00\x01\xf0\xf0\x01\x06\x01\x00\x03\x11\x04\x86\x30\x72\x06\x12\x80\x04\x00\x20\x01\x9f\x3f\x08\x0a\x69\x00\x00\x00\x00\x00\x00\xbf\x81\x04\x17\xbf\x81\x03\x13\x83\x02\x00\x22\x9f\x44\x01\x18\x9f\x81\x2d\x02\x00\x84\x9f\x81\xce\x01\x00\x9f\x45\x01\x08"
+PAYLOAD_MTP_1 = "\x01\x00\x06\x01\x00\x00\x00\xe4\x00\x01\x00\x08\x00\x00\x00\x32\x03\x00\x00\xd3\x83\xa1\x70\x3c\xfc\x09\x80\x03\x07\x0b\x04\xc3\xa1\x30\x08\x04\xc3\xf1\x30\x08\xba\xe2\x81\xb7\xc7\x04\x00\x00\x00\x27\xe8\x81\xae\xe9\x81\xab\xcf\x01\x00\xd1\x02\x09\x24\x25\x00\xa1\x81\x07\x00\x64\x1e\x00\x00\x04\x00\x89\x04\x80\x21\xce\x7a\x9f\x83\x06\x67\xa0\x00\x00\x01\x89\xb7\x25\x86\x02\x09\x05\x87\x01\x01\x82\x02\x00\x42\x2f\x82\x64\x33\x12\x0c\xca\x00\x62\x00\x02\x01\x3a\x01\x03\x00\xc0\x06\x09\x07\x1c\x01\x00\x30\x84\x0a\x3f\x11\x08\x0a\x03\x02\x3f\x82\xf0\x00\x00\x0e\x10\x00\x00\x01\x00\x01\xf0\xf0\x01\x06\x01\x00\x03\x11\x04\x86\x30\x9f\x3e\x01\x09\x9f\x3f\x08\x62\x3f\x00\x00\x00\x00\x00\x00\x9f\x42\x01\x06\xbf\x81\x30\x06\x9f\x81\x2f\x02\x00\x03\x9f\x81\x31\x01\x3a\xbf\x81\x08\x11\xbf\x81\x76\x0d\x83\x02\x00\x22\x9f\x41\x01\x00\x9f\x3d\x02\x00\x00\x9f\x27\x01\x00\x9e\x01\x02\x88\x05\x16\x19\x32\x14\x60\x00"
+
+mode_tcp = true
+
+p = Racket::Racket.new
+p.iface = "eth0"
+p.layers[3] = L3::IPv4.new
+p.layers[3].src_ip = ARGV[0]
+p.layers[3].dst_ip = ARGV[1]
+p.layers[3].version = 4
+p.layers[3].hlen = 0x5
+p.layers[3].ttl = 44
+
+if mode_tcp == true
+ p.layers[3].protocol = 0x06
+
+ p.layers[4] = L4::TCP.new
+ # p.layers[4].src_port = 1234
+ # p.layers[4].dst_port = 5678
+ p.l4.src_port = 53664
+ # p.l4.seq = 0xabcdef
+ # p.l4.ack = 0xfedcba
+ # p.l4.flag_ack = 1
+ # p.l4.flag_psh = 1
+ #p.l4.dst_port = 2905
+ p.l4.dst_port = 2904
+ # p.l4.window = 4445
+
+ # p.l4.add_option(2, "\xff\xee") # XXX ?
+ p.l4.fix!(p.l3.src_ip, p.l3.dst_ip, PAYLOAD_MTP_1)
+
+ p.layers[4].payload = PAYLOAD_MTP_1
+ p.sendpacket
+ p.layers[4].payload = PAYLOAD_MTP_1 # XXX 2
+ p.sendpacket
+else
+ p.layers[3].protocol = 0x84
+ p.layers[3].payload = PAYLOAD_SCTP_1
+ p.sendpacket
+ p.layers[3].payload = PAYLOAD_SCTP_2
+ p.sendpacket
+end
+