racket 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (88) hide show
  1. data/README +76 -0
  2. data/examples/arp-send +24 -0
  3. data/examples/arp-send2 +30 -0
  4. data/examples/cdp +39 -0
  5. data/examples/cdp-spew +52 -0
  6. data/examples/dhcp +42 -0
  7. data/examples/dhcp-spew +48 -0
  8. data/examples/dns +38 -0
  9. data/examples/egp +30 -0
  10. data/examples/hsrp +43 -0
  11. data/examples/hsrp_takeover +69 -0
  12. data/examples/icmp-recv +34 -0
  13. data/examples/icmp-spew +50 -0
  14. data/examples/icmpv6 +84 -0
  15. data/examples/icmpv6-spew +50 -0
  16. data/examples/igmpv1 +27 -0
  17. data/examples/igmpv2 +27 -0
  18. data/examples/igrp-send +25 -0
  19. data/examples/ipv6 +35 -0
  20. data/examples/ntp +38 -0
  21. data/examples/ntp2 +42 -0
  22. data/examples/sctp +32 -0
  23. data/examples/stp-send +21 -0
  24. data/examples/synflood +147 -0
  25. data/examples/tcp +43 -0
  26. data/examples/tcp2udp +65 -0
  27. data/examples/udp +46 -0
  28. data/examples/vrrp +34 -0
  29. data/examples/vtp +28 -0
  30. data/lib/racket.rb +4 -0
  31. data/lib/racket/l2.rb +30 -0
  32. data/lib/racket/l2/eightotwodotthree.rb +48 -0
  33. data/lib/racket/l2/ethernet.rb +62 -0
  34. data/lib/racket/l2/llc.rb +50 -0
  35. data/lib/racket/l2/misc.rb +67 -0
  36. data/lib/racket/l2/snap.rb +40 -0
  37. data/lib/racket/l2/vlan.rb +61 -0
  38. data/lib/racket/l2/vtp.rb +124 -0
  39. data/lib/racket/l3.rb +30 -0
  40. data/lib/racket/l3/arp.rb +63 -0
  41. data/lib/racket/l3/cdp.rb +85 -0
  42. data/lib/racket/l3/egp.rb +53 -0
  43. data/lib/racket/l3/ipv4.rb +132 -0
  44. data/lib/racket/l3/ipv6.rb +66 -0
  45. data/lib/racket/l3/misc.rb +165 -0
  46. data/lib/racket/l3/stp.rb +81 -0
  47. data/lib/racket/l4.rb +30 -0
  48. data/lib/racket/l4/gre.rb +65 -0
  49. data/lib/racket/l4/icmp.rb +295 -0
  50. data/lib/racket/l4/icmpv6.rb +446 -0
  51. data/lib/racket/l4/igmpv1.rb +79 -0
  52. data/lib/racket/l4/igmpv2.rb +76 -0
  53. data/lib/racket/l4/igrp.rb +138 -0
  54. data/lib/racket/l4/misc.rb +35 -0
  55. data/lib/racket/l4/sctp.rb +163 -0
  56. data/lib/racket/l4/tcp.rb +152 -0
  57. data/lib/racket/l4/udp.rb +81 -0
  58. data/lib/racket/l4/vrrp.rb +95 -0
  59. data/lib/racket/l5.rb +30 -0
  60. data/lib/racket/l5/bootp.rb +106 -0
  61. data/lib/racket/l5/dns.rb +110 -0
  62. data/lib/racket/l5/hsrp.rb +73 -0
  63. data/lib/racket/l5/misc.rb +35 -0
  64. data/lib/racket/l5/ntp.rb +59 -0
  65. data/lib/racket/misc.rb +30 -0
  66. data/lib/racket/misc/lv.rb +108 -0
  67. data/lib/racket/misc/misc.rb +61 -0
  68. data/lib/racket/misc/orderedhash.rb +63 -0
  69. data/lib/racket/misc/raw.rb +35 -0
  70. data/lib/racket/misc/tlv.rb +103 -0
  71. data/lib/racket/misc/vt.rb +114 -0
  72. data/lib/racket/racket.rb +164 -0
  73. data/lib/racket/racketpart.rb +66 -0
  74. data/test/l2/ts_ethernet.rb +22 -0
  75. data/test/l2/ts_misc.rb +23 -0
  76. data/test/l2/ts_vlan.rb +15 -0
  77. data/test/l3/ts_ipv4.rb +44 -0
  78. data/test/l3/ts_ipv6.rb +26 -0
  79. data/test/l3/ts_misc.rb +31 -0
  80. data/test/l4/ts_icmp.rb +38 -0
  81. data/test/l4/ts_tcp.rb +55 -0
  82. data/test/l4/ts_udp.rb +40 -0
  83. data/test/misc/ts_lv.rb +59 -0
  84. data/test/misc/ts_orderedhash.rb +33 -0
  85. data/test/misc/ts_tlv.rb +47 -0
  86. data/test/misc/ts_vt.rb +56 -0
  87. data/test/ts_all.rb +14 -0
  88. metadata +182 -0
@@ -0,0 +1,26 @@
1
+ # $Id: ts_ipv6.rb 129 2009-11-29 01:37:06Z jhart $
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
+
5
+ require 'test/unit'
6
+ require 'racket'
7
+
8
+ class TestIPV6 < Test::Unit::TestCase
9
+ def test_init
10
+ assert_nothing_raised() { Racket::L3::IPv6.new }
11
+ assert_nothing_raised() { Racket::L3::IPv6.new(Racket::Misc.randstring(30)) }
12
+ end
13
+
14
+ def test_convert
15
+ long = rand(0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
16
+ ipv6 = Racket::L3::Misc.long2ipv6(long)
17
+
18
+ assert_equal(long, Racket::L3::Misc.ipv62long(ipv6))
19
+ assert_equal(ipv6, Racket::L3::Misc.long2ipv6(long))
20
+ assert_nothing_raised { Racket::L3::IPv6.new("a:b:c::1") }
21
+ assert_nothing_raised { Racket::L3::Misc.soll_mcast_addr6(ipv6) }
22
+ mac = Racket::L2::Misc.randommac
23
+ assert_nothing_raised { Racket::L3::Misc.soll_mcast_mac(mac) }
24
+ end
25
+ end
26
+ # vim: set ts=2 et sw=2:
@@ -0,0 +1,31 @@
1
+ # $Id: ts_misc.rb 135 2009-12-06 20:39:40Z jhart $
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
+
5
+ require 'test/unit'
6
+ require 'racket'
7
+
8
+ class TestL3Misc < Test::Unit::TestCase
9
+ def test_misc
10
+ assert_nothing_raised {
11
+ Racket::L3::Misc.checksum(Racket::Misc.randstring(rand(2048)))
12
+ }
13
+
14
+ mac = "6e:f1:eb:b7:c8:72"
15
+ ll = "fe80::6cf1:ebff:feb7:c872"
16
+ assert_equal(ll, Racket::L3::Misc.linklocaladdr(mac))
17
+
18
+ ipv4 = Racket::L3::Misc.randomipv4
19
+ lipv4 = Racket::L3::Misc.ipv42long(ipv4)
20
+ ipv6 = Racket::L3::Misc.randomipv6
21
+ lipv6 = Racket::L3::Misc.ipv62long(ipv6)
22
+
23
+ assert_equal(ipv4, Racket::L3::Misc.long2ipv4(lipv4))
24
+ assert_equal(ipv6, Racket::L3::Misc.long2ipv6(lipv6))
25
+
26
+ ipv6 = "a:0:0:0f:0:1"
27
+ zipv6 = "a::f:0:1"
28
+ assert_equal(zipv6, Racket::L3::Misc.compressipv6(ipv6))
29
+ end
30
+ end
31
+ # vim: set ts=2 et sw=2:
@@ -0,0 +1,38 @@
1
+ # $Id: ts_icmp.rb 129 2009-11-29 01:37:06Z jhart $
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
+
5
+ require 'test/unit'
6
+ require 'racket'
7
+
8
+ class TestICMP < Test::Unit::TestCase
9
+ def test_init
10
+ assert_nothing_raised() { Racket::L4::ICMP.new }
11
+ assert_nothing_raised() { Racket::L4::ICMP.new(Racket::Misc.randstring(20)) }
12
+ end
13
+
14
+ def test_raw
15
+ binary="\x9e\x96\x00\x35\x00\x0c\x69\x4f\x66\x6f\x6f\x0a"
16
+ binary="\x08\x00\x05\x7e\xab\x58\x00\x01\x78\xf1\x09\x4b\x00\x00\x00\x00\xce\xe6\x05\x00\x00\x00\x00\x00\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b"
17
+ assert_nothing_raised() { i = Racket::L4::ICMP.new(binary) }
18
+ i = Racket::L4::ICMP.new(binary)
19
+ assert_equal(i.type, 8)
20
+ assert_equal(i.code, 0)
21
+ assert_equal(i.checksum, 0x057e)
22
+ assert_equal(i.payload,
23
+ "\xab\x58\x00\x01\x78\xf1\x09\x4b\x00\x00\x00\x00\xce\xe6\x05\x00\x00\x00\x00\x00\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b\x0c\x0d\x0e\x0f\x0a\x0b")
24
+ end
25
+
26
+ def test_build
27
+ i = Racket::L4::ICMP.new
28
+ assert_nothing_raised() {
29
+ i.type = 8
30
+ i.code = 0
31
+ i.payload = "thisisatest"
32
+ i.fix!
33
+ }
34
+ assert_equal(i.checksum, 30152)
35
+ end
36
+
37
+ end
38
+ # vim: set ts=2 et sw=2:
data/test/l4/ts_tcp.rb ADDED
@@ -0,0 +1,55 @@
1
+ # $Id: ts_tcp.rb 129 2009-11-29 01:37:06Z jhart $
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
+
5
+ require 'test/unit'
6
+ require 'racket'
7
+
8
+ class TestTCP < Test::Unit::TestCase
9
+ def test_init
10
+ assert_nothing_raised() { Racket::L4::TCP.new }
11
+ assert_nothing_raised() { Racket::L4::TCP.new(Racket::Misc.randstring(20)) }
12
+ end
13
+
14
+ def test_attrs
15
+ binary="\x90\xef\x08\xae\x47\x87\xa0\x34\x00\x00\x00\x00\xa0\x02\x16\xd0\xc2\x17\x00\x00\x02\x04\x05\xb4\x04\x02\x08\x0a\x03\x0f\xc8\x6e\x00\x00\x00\x00\x01\x03\x03\x07"
16
+
17
+ assert_nothing_raised() { i = Racket::L4::TCP.new(binary) }
18
+ i = Racket::L4::TCP.new(binary)
19
+ assert_equal(i.dst_port, 2222)
20
+ assert_equal(i.src_port, 37103)
21
+ assert_equal(i.flag_syn, 1)
22
+ assert_equal(i.flag_ack, 0)
23
+ assert_equal(i.seq, 0x4787a034)
24
+ assert_equal(i.ack, 0)
25
+ assert_equal(i.window, 5840)
26
+ assert_equal(i.checksum, 0xc217)
27
+ assert_equal(i.payload,
28
+ "\x02\x04\x05\xb4\x04\x02\x08\x0a\x03\x0f\xc8\x6e\x00\x00\x00\x00\x01\x03\x03\x07")
29
+
30
+ end
31
+
32
+ def test_build_no_options
33
+ i = Racket::L4::TCP.new
34
+ assert_nothing_raised() {
35
+ i.src_port = 44781
36
+ i.dst_port = 5190
37
+ i.seq = 0x4e3e537a
38
+ i.ack = 0xbdca7ef8
39
+ i.flag_ack = 1
40
+ i.flag_psh = 1
41
+ i.offset = 5
42
+ i.window = 61200
43
+ i.payload = "\x2a\x05\x0b\xca\x00\x00"
44
+ }
45
+
46
+ i.checksum!("192.168.1.10", "64.12.26.128")
47
+ assert_equal(i.checksum, 0xccf8)
48
+ end
49
+
50
+ def test_build_with_options
51
+ i = Racket::L4::TCP.new
52
+ i.add_option(1, "blah")
53
+ end
54
+ end
55
+ # vim: set ts=2 et sw=2:
data/test/l4/ts_udp.rb ADDED
@@ -0,0 +1,40 @@
1
+ # $Id: ts_udp.rb 129 2009-11-29 01:37:06Z jhart $
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
+
5
+ require 'test/unit'
6
+ require 'racket'
7
+
8
+ class TestUDP < Test::Unit::TestCase
9
+ def test_init
10
+ assert_nothing_raised() { Racket::L4::UDP.new }
11
+ assert_nothing_raised() { Racket::L4::UDP.new(Racket::Misc.randstring(20)) }
12
+ end
13
+
14
+ def test_raw
15
+ binary="\x9e\x96\x00\x35\x00\x0c\x69\x4f\x66\x6f\x6f\x0a"
16
+ assert_nothing_raised() { i = Racket::L4::UDP.new(binary) }
17
+ i = Racket::L4::UDP.new(binary)
18
+ assert_equal(i.dst_port, 53)
19
+ assert_equal(i.src_port, 40598)
20
+ assert_equal(i.checksum, 0x694f)
21
+ assert_equal(i.len, 12)
22
+ assert_equal(i.payload, "foo\n")
23
+ end
24
+
25
+ def test_build
26
+ i = Racket::L4::UDP.new
27
+ assert_nothing_raised() {
28
+ i.src_port = 50243
29
+ i.dst_port = 53
30
+ i.payload = "hhahahahahah"
31
+ i.fix!("192.168.1.10", "1.2.3.4")
32
+ }
33
+
34
+ assert_equal(i.checksum, 0x2623)
35
+ assert_equal(i.len, 20)
36
+
37
+ end
38
+
39
+ end
40
+ # vim: set ts=2 et sw=2:
@@ -0,0 +1,59 @@
1
+ # $Id: ts_lv.rb 129 2009-11-29 01:37:06Z jhart $
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
+
5
+ require 'test/unit'
6
+ require 'racket'
7
+
8
+ class TestLV < Test::Unit::TestCase
9
+ def test_init
10
+ assert_nothing_raised() { Racket::Misc::LV.new(2) }
11
+ assert_nothing_raised() { Racket::Misc::LV.new(2,4,1,1,6) }
12
+ end
13
+
14
+ def test_decode
15
+ t1 = Racket::Misc::LV.new(2)
16
+ s1 = "\x00\x0b\x73\x70\x6f\x6f\x66\x65\x64\x2e\x6f\x72\x67"
17
+ t1.decode!(s1)
18
+ assert_equal(t1.lengths[0], 11)
19
+ assert_equal(t1.values[0], "spoofed.org")
20
+
21
+ t2 = Racket::Misc::LV.new(1,2,2,4)
22
+ s2 = "\x02\xab\xcd\x00\x01\xff\x00\x04\xde\xad\xba\xbe\x00\x00\x00\x0a\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffwtf?"
23
+ t2.decode!(s2)
24
+ assert_equal(t2.lengths[0], 2)
25
+ assert_equal(t2.values[0], "\xab\xcd")
26
+ assert_equal(t2.lengths[1], 1)
27
+ assert_equal(t2.values[1], "\xff")
28
+ assert_equal(t2.lengths[2], 4)
29
+ assert_equal(t2.values[2], "\xde\xad\xba\xbe")
30
+ assert_equal(t2.lengths[3], 10)
31
+ assert_equal(t2.values[3], "\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff")
32
+ assert_equal(t2.rest, "wtf?")
33
+ end
34
+
35
+ def test_encode
36
+ t1 = Racket::Misc::LV.new(2)
37
+ s1 = "\x00\x0bspoofed.org"
38
+ t1.decode!(s1)
39
+ assert_equal(t1.encode, s1)
40
+ assert_equal("#{t1}", s1)
41
+
42
+ t2 = Racket::Misc::LV.new(1,2,2)
43
+ s2 = "\x01\xff\x00\x02\xff\xff\x00\x0bspoofed.org\xff\xff\xffwtf?"
44
+ t2.decode!(s2)
45
+ assert_equal(t2.encode, s2.slice(0, s2.size - 7))
46
+ assert_equal("#{t2}", s2.slice(0, s2.size - 7))
47
+
48
+ t3 = Racket::Misc::LV.new(1,1,1)
49
+ t3.lengths = [2,2,2]
50
+ t3.values = ["ww", "tt", "ff"]
51
+ assert_equal(t3.encode, "\x02ww\x02tt\x02ff")
52
+
53
+ t3 = Racket::Misc::LV.new(1,1,1)
54
+ t3.lengths = [2,2,4]
55
+ t3.values = ["ww", "tt", "ff"]
56
+ assert_equal(t3.encode, "\x02ww\x02tt\x04ff\00\00")
57
+ end
58
+ end
59
+ # vim: set ts=2 et sw=2:
@@ -0,0 +1,33 @@
1
+ # $Id: ts_orderedhash.rb 129 2009-11-29 01:37:06Z jhart $
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
+
5
+ require 'test/unit'
6
+ require 'racket'
7
+
8
+ class TestBitField < Test::Unit::TestCase
9
+ def test_init
10
+ assert_nothing_raised() { Racket::Misc::OrderedHash.new }
11
+ end
12
+ def test_order
13
+ oh = Racket::Misc::OrderedHash.new
14
+ ("a".."z").each { |c|
15
+ oh[c] = c.unpack("c")[0]
16
+ }
17
+
18
+ 97.upto(122) { |v|
19
+ assert_equal(oh[sprintf("%c", v)], v)
20
+ }
21
+
22
+ assert_nil(oh['kajf'])
23
+
24
+ copy = []
25
+ oh.each_key { |k| copy << k }
26
+ 0.upto(25) { |v|
27
+ assert_equal(copy[v], sprintf("%c", 97 + v))
28
+ }
29
+
30
+ assert_nil(copy[205])
31
+ end
32
+ end
33
+ # vim: set ts=2 et sw=2:
@@ -0,0 +1,47 @@
1
+ # $Id: ts_tlv.rb 147 2009-12-13 02:45:09Z jhart $
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
+
5
+ require 'test/unit'
6
+ require 'racket'
7
+
8
+ class TestTLV < Test::Unit::TestCase
9
+ def test_init
10
+ assert_nothing_raised() { Racket::Misc::TLV.new(2,4) }
11
+ end
12
+
13
+ def test_decode
14
+ t = Racket::Misc::TLV.new(4,2)
15
+ s = "\x08\x05\x0c\x23\x00\x0b\x73\x70\x6f\x6f\x66\x65\x64\x2e\x6f\x72\x67\xff\x00\xba"
16
+ t.decode!(s)
17
+
18
+ assert_equal(t.type, 0x08050c23)
19
+ assert_equal(t.length, 11)
20
+ assert_equal(t.value, "spoofed.org")
21
+ assert_equal(t.rest, "\xff\x00\xba")
22
+
23
+ t2 = Racket::Misc::TLV.new(1,1,8)
24
+ s2 = "\x02\x01\xaa\xbb\xcc\xdd\xee\xff"
25
+ t2.decode!(s2)
26
+ assert_equal(t2.type, 2)
27
+ assert_equal(t2.length, 1)
28
+ assert_equal(t2.value, "\xaa\xbb\xcc\xdd\xee\xff")
29
+
30
+ t3 = Racket::Misc::TLV.new(1,1,8,false)
31
+ s3 = "\x02\x01\xaa\xbb\xcc\xdd\xee\xff\x11\x22"
32
+ t3.decode!(s3)
33
+ assert_equal(t3.type, 2)
34
+ assert_equal(t3.length, 1)
35
+ assert_equal(t3.value, "\xaa\xbb\xcc\xdd\xee\xff\x11\x22")
36
+
37
+ end
38
+
39
+ def test_encode
40
+ t = Racket::Misc::TLV.new(4,2)
41
+ s = "\x08\x05\x0c\x23\x00\x0b\x73\x70\x6f\x6f\x66\x65\x64\x2e\x6f\x72\x67\xff\xff"
42
+ t.decode!(s)
43
+ assert_equal(t.encode, s.slice(0, s.length - 2))
44
+ assert_equal("#{t}", s.slice(0, s.length - 2))
45
+ end
46
+ end
47
+ # vim: set ts=2 et sw=2:
@@ -0,0 +1,56 @@
1
+ # $Id: ts_vt.rb 129 2009-11-29 01:37:06Z jhart $
2
+
3
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
4
+
5
+ require 'test/unit'
6
+ require 'racket'
7
+
8
+ class TestVT < Test::Unit::TestCase
9
+ def test_init
10
+ assert_nothing_raised() { Racket::Misc::VT.new(2) }
11
+ assert_nothing_raised() { Racket::Misc::VT.new(2,4,4,4,4,4,12,3) }
12
+ end
13
+
14
+ def test_decode
15
+ s1 = "\x73\x70\x6f\x6f\x66\x65\x64\x2e\x6f\x72\x67\x00\x01\x02\x03\x04\xab\xcd\xef"
16
+ t1 = Racket::Misc::VT.new
17
+ t1.decode!(s1)
18
+ assert_equal(t1.value, "spoofed.org")
19
+ assert_equal(t1.types.size, 0)
20
+ assert_equal(t1.rest, "\x01\x02\x03\x04\xab\xcd\xef")
21
+
22
+ t2 = Racket::Misc::VT.new(4)
23
+ s2 = "\x73\x70\x6f\x6f\x66\x65\x64\x2e\x6f\x72\x67\x00\x01\x02\x03\x04"
24
+ t2.decode!(s2)
25
+
26
+ assert_equal(t2.types[0], 0x01020304)
27
+ assert_equal(t2.value, "spoofed.org")
28
+ assert_equal(t2.rest, "")
29
+
30
+ t3 = Racket::Misc::VT.new(1,2,2,4)
31
+ s3 = "\x73\x70\x6f\x6f\x66\x65\x64\x2e\x6f\x72\x67\x00\x01\x02\x03\x04\x05\xde\xad\xba\xbe\x11\xff"
32
+ t3.decode!(s3)
33
+
34
+ assert_equal(t3.types[0], 0x01)
35
+ assert_equal(t3.types[1], 0x0203)
36
+ assert_equal(t3.types[2], 0x0405)
37
+ assert_equal(t3.types[3], 0xdeadbabe)
38
+ assert_equal(t3.value, "spoofed.org")
39
+ assert_equal(t3.rest, "\x11\xff")
40
+ end
41
+
42
+ def test_encode
43
+ t1 = Racket::Misc::VT.new(4)
44
+ s1 = "\x73\x70\x6f\x6f\x66\x65\x64\x2e\x6f\x72\x67\x00\x01\x02\x03\x04"
45
+ t1.decode!(s1)
46
+ assert_equal(t1.encode, s1)
47
+ assert_equal("#{t1}", s1)
48
+
49
+ t2 = Racket::Misc::VT.new(1,2,2,4)
50
+ s2 = "\x73\x70\x6f\x6f\x66\x65\x64\x2e\x6f\x72\x67\x00\x01\x02\x03\x04\x05\xde\xad\xba\xbe\xff\xff"
51
+ t2.decode!(s2)
52
+ assert_equal(t2.encode, s2.slice(0, s2.size - 2))
53
+ assert_equal("#{t2}", s2.slice(0, s2.size - 2))
54
+ end
55
+ end
56
+ # vim: set ts=2 et sw=2:
data/test/ts_all.rb ADDED
@@ -0,0 +1,14 @@
1
+ # $Id: ts_all.rb 90 2009-11-27 08:22:20Z jhart $
2
+
3
+ #require 'rubygems'
4
+
5
+ (2..5).each do |l|
6
+ Dir.glob(File.join(File.dirname(__FILE__) + "/l#{l}", '*.rb')).each do |f|
7
+ require f
8
+ end
9
+ end
10
+
11
+ Dir.glob(File.join(File.dirname(__FILE__) + "/misc", '*.rb')).each do |f|
12
+ require f
13
+ end
14
+ # vim: set ts=2 et sw=2:
metadata ADDED
@@ -0,0 +1,182 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: racket
3
+ version: !ruby/object:Gem::Version
4
+ hash: 3
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 10
10
+ version: 1.0.10
11
+ platform: ruby
12
+ authors:
13
+ - Jon Hart
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2011-12-14 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: pcaprub
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ hash: 3
29
+ segments:
30
+ - 0
31
+ version: "0"
32
+ type: :runtime
33
+ version_requirements: *id001
34
+ - !ruby/object:Gem::Dependency
35
+ name: bit-struct
36
+ prerelease: false
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ hash: 3
43
+ segments:
44
+ - 0
45
+ version: "0"
46
+ type: :runtime
47
+ version_requirements: *id002
48
+ description: Ruby Gem for reading and writing raw packets
49
+ email: jhart@spoofed.org
50
+ executables: []
51
+
52
+ extensions: []
53
+
54
+ extra_rdoc_files:
55
+ - README
56
+ files:
57
+ - examples/dhcp-spew
58
+ - examples/ipv6
59
+ - examples/egp
60
+ - examples/hsrp
61
+ - examples/icmpv6-spew
62
+ - examples/sctp
63
+ - examples/tcp
64
+ - examples/stp-send
65
+ - examples/igmpv2
66
+ - examples/dhcp
67
+ - examples/udp
68
+ - examples/vtp
69
+ - examples/ntp2
70
+ - examples/igrp-send
71
+ - examples/icmp-recv
72
+ - examples/cdp-spew
73
+ - examples/arp-send
74
+ - examples/synflood
75
+ - examples/arp-send2
76
+ - examples/icmpv6
77
+ - examples/tcp2udp
78
+ - examples/vrrp
79
+ - examples/icmp-spew
80
+ - examples/igmpv1
81
+ - examples/ntp
82
+ - examples/hsrp_takeover
83
+ - examples/dns
84
+ - examples/cdp
85
+ - lib/racket.rb
86
+ - lib/racket/l2.rb
87
+ - lib/racket/l5/ntp.rb
88
+ - lib/racket/l5/dns.rb
89
+ - lib/racket/l5/hsrp.rb
90
+ - lib/racket/l5/bootp.rb
91
+ - lib/racket/l5/misc.rb
92
+ - lib/racket/l3.rb
93
+ - lib/racket/l2/snap.rb
94
+ - lib/racket/l2/llc.rb
95
+ - lib/racket/l2/ethernet.rb
96
+ - lib/racket/l2/misc.rb
97
+ - lib/racket/l2/eightotwodotthree.rb
98
+ - lib/racket/l2/vtp.rb
99
+ - lib/racket/l2/vlan.rb
100
+ - lib/racket/l3/egp.rb
101
+ - lib/racket/l3/ipv4.rb
102
+ - lib/racket/l3/arp.rb
103
+ - lib/racket/l3/cdp.rb
104
+ - lib/racket/l3/misc.rb
105
+ - lib/racket/l3/ipv6.rb
106
+ - lib/racket/l3/stp.rb
107
+ - lib/racket/l4.rb
108
+ - lib/racket/l4/igrp.rb
109
+ - lib/racket/l4/igmpv2.rb
110
+ - lib/racket/l4/igmpv1.rb
111
+ - lib/racket/l4/vrrp.rb
112
+ - lib/racket/l4/sctp.rb
113
+ - lib/racket/l4/icmp.rb
114
+ - lib/racket/l4/udp.rb
115
+ - lib/racket/l4/misc.rb
116
+ - lib/racket/l4/gre.rb
117
+ - lib/racket/l4/icmpv6.rb
118
+ - lib/racket/l4/tcp.rb
119
+ - lib/racket/racket.rb
120
+ - lib/racket/l5.rb
121
+ - lib/racket/misc.rb
122
+ - lib/racket/misc/raw.rb
123
+ - lib/racket/misc/tlv.rb
124
+ - lib/racket/misc/misc.rb
125
+ - lib/racket/misc/orderedhash.rb
126
+ - lib/racket/misc/lv.rb
127
+ - lib/racket/misc/vt.rb
128
+ - lib/racket/racketpart.rb
129
+ - test/l2/ts_vlan.rb
130
+ - test/l2/ts_misc.rb
131
+ - test/l2/ts_ethernet.rb
132
+ - test/ts_all.rb
133
+ - test/l3/ts_ipv6.rb
134
+ - test/l3/ts_misc.rb
135
+ - test/l3/ts_ipv4.rb
136
+ - test/l4/ts_tcp.rb
137
+ - test/l4/ts_udp.rb
138
+ - test/l4/ts_icmp.rb
139
+ - test/misc/ts_lv.rb
140
+ - test/misc/ts_orderedhash.rb
141
+ - test/misc/ts_vt.rb
142
+ - test/misc/ts_tlv.rb
143
+ - README
144
+ homepage: http://spoofed.org/files/racket/
145
+ licenses: []
146
+
147
+ post_install_message:
148
+ rdoc_options:
149
+ - -A rest,octets,hex_octets,unsigned,signed,text,rest
150
+ - -p
151
+ - -m
152
+ - README
153
+ - -W http://spoofed.org/files/racket/src/%s
154
+ require_paths:
155
+ - lib
156
+ required_ruby_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ">="
160
+ - !ruby/object:Gem::Version
161
+ hash: 3
162
+ segments:
163
+ - 0
164
+ version: "0"
165
+ required_rubygems_version: !ruby/object:Gem::Requirement
166
+ none: false
167
+ requirements:
168
+ - - ">="
169
+ - !ruby/object:Gem::Version
170
+ hash: 3
171
+ segments:
172
+ - 0
173
+ version: "0"
174
+ requirements: []
175
+
176
+ rubyforge_project:
177
+ rubygems_version: 1.8.12
178
+ signing_key:
179
+ specification_version: 3
180
+ summary: Packet foo
181
+ test_files:
182
+ - test/ts_all.rb