scriptroute 0.4.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/sr-ally +21 -0
- data/bin/sr-liveness +11 -0
- data/bin/sr-ping-T +69 -0
- data/bin/sr-rockettrace +51 -0
- data/bin/sr-traceroute +35 -0
- data/bin/tulip +183 -0
- data/lib/scriptroute.rb +327 -0
- data/lib/scriptroute/ally.rb +449 -0
- data/lib/scriptroute/commando.rb +228 -0
- data/lib/scriptroute/fixclock +1260 -0
- data/lib/scriptroute/liveness.rb +129 -0
- data/lib/scriptroute/nameify.rb +127 -0
- data/lib/scriptroute/packets.rb +800 -0
- data/lib/scriptroute/rockettrace.rb +181 -0
- data/lib/scriptroute/tulip/helper.rb +730 -0
- data/lib/scriptroute/tulip/loss.rb +145 -0
- data/lib/scriptroute/tulip/queuing.rb +248 -0
- data/lib/scriptroute/tulip/reordering.rb +129 -0
- data/test/test_bins.rb +20 -0
- data/test/test_scriptroute.rb +155 -0
- metadata +71 -0
data/test/test_bins.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
|
4
|
+
Base = File.dirname(__FILE__)
|
5
|
+
class ScriptrouteBinsTest < Test::Unit::TestCase
|
6
|
+
def dont_test_slow_bins
|
7
|
+
Kernel.system("ruby -I#{Base}/../lib #{Base}/../bin/tulip reordering --verbose 2 scriptroute.cs.umd.edu")
|
8
|
+
puts "done tulip: #{$?}"
|
9
|
+
Kernel.system("ruby -I#{Base}/../lib #{Base}/../bin/sr-traceroute scriptroute.cs.umd.edu")
|
10
|
+
puts "done trace: #{$?}"
|
11
|
+
end
|
12
|
+
def test_live_tools
|
13
|
+
Kernel.system("ruby -I#{Base}/../lib #{Base}/../bin/sr-liveness scriptroute.cs.umd.edu kohoutek.cs.umd.edu swirl.umiacs.umd.edu")
|
14
|
+
puts "done live: #{$?}"
|
15
|
+
Kernel.system("ruby -I#{Base}/../lib #{Base}/../bin/sr-ping-T scriptroute.cs.umd.edu")
|
16
|
+
puts "done pingT: #{$?}"
|
17
|
+
Kernel.system("ruby -I#{Base}/../lib #{Base}/../bin/sr-rockettrace scriptroute.cs.umd.edu")
|
18
|
+
puts "done rocket: #{$?}"
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,155 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require 'scriptroute'
|
4
|
+
require 'scriptroute/nameify'
|
5
|
+
|
6
|
+
class ScriptrouteTest < Test::Unit::TestCase
|
7
|
+
def test_abba # be first
|
8
|
+
unless Scriptroute::is_daemon_running?
|
9
|
+
exit
|
10
|
+
end
|
11
|
+
|
12
|
+
Scriptroute::DaemonVersion()
|
13
|
+
|
14
|
+
p = Scriptroute::ICMPecho.new
|
15
|
+
p.ip_dst = '128.8.126.104'
|
16
|
+
responses = Scriptroute::send_train( [ [ 0, p.marshal ] ] )
|
17
|
+
p.ip_dst = Scriptroute::dns_lookup('kohoutek.cs.umd.edu')
|
18
|
+
responses = Scriptroute::send_train( [ [ 0, p.marshal ] ] )
|
19
|
+
# puts responses.inspect
|
20
|
+
puts responses[0].rtt
|
21
|
+
end
|
22
|
+
def test_abc_get_config
|
23
|
+
raise "no config returned" unless Scriptroute::DaemonConfig()
|
24
|
+
raise "config not a hash" unless Scriptroute::DaemonConfig.is_a?(Hash)
|
25
|
+
raise "config lacks an expected key" unless Scriptroute::DaemonConfig['Filter.listenfilter']
|
26
|
+
end
|
27
|
+
def test_ally
|
28
|
+
verdict = Scriptroute::Ally.new('128.8.126.92', '128.8.126.104')
|
29
|
+
puts verdict
|
30
|
+
end
|
31
|
+
def test_rockettrace
|
32
|
+
result = Scriptroute::Rockettrace.new('128.8.126.104', 1, false, 2, 64, 4)
|
33
|
+
puts result
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_forbidden
|
37
|
+
i = Scriptroute::ICMPecho.new(0)
|
38
|
+
# an address ending with .255 seems more likely to be broadcast.
|
39
|
+
i.ip_dst = 0x805f02ff
|
40
|
+
j = Scriptroute::ICMPecho.new(0)
|
41
|
+
# an address ending with .255 seems more likely to be broadcast.
|
42
|
+
j.ip_dst = '128.8.126.104'
|
43
|
+
timeout(60) do
|
44
|
+
p = Scriptroute::send_train([
|
45
|
+
Struct::DelayedPacket.new(0, Scriptroute::pkt_from_string(i.marshal) ),
|
46
|
+
Struct::DelayedPacket.new(0, Scriptroute::pkt_from_string(j.marshal) )
|
47
|
+
])
|
48
|
+
puts p[0].probe
|
49
|
+
puts p[0].response
|
50
|
+
end
|
51
|
+
rescue TimeoutError
|
52
|
+
puts "timed out trying to complete a send_train with a forbidden destination"
|
53
|
+
false
|
54
|
+
rescue Scriptroute::ScriptrouteError
|
55
|
+
true
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_packets_with_daemon
|
59
|
+
i = Scriptroute::ICMPecho.new(0)
|
60
|
+
i.ip_dst = 0x805f0218 # poplar
|
61
|
+
# i.ip_dst = 0x84ef3314 # www.cs.ucsd.edu often unresponsive
|
62
|
+
i.ip_dst = 0xc6ca4b65 # www.sdsc.edu
|
63
|
+
# i.ip_ttl=8
|
64
|
+
# rr = RecordRoute_option.new
|
65
|
+
rr = Scriptroute::Timestamp_option.new(1)
|
66
|
+
i.add_option(rr)
|
67
|
+
# i.uh_dport = 3000
|
68
|
+
m = i.marshal
|
69
|
+
has_bytes = m.methods.include?(:bytes)
|
70
|
+
puts m.length.to_s + " " + m.bytes.map { |b| "%x " % b }.join if has_bytes
|
71
|
+
# old ruby.
|
72
|
+
puts m.length.to_s + " " + m.gsub(/./) { |b| "%x " % b[0].to_i }
|
73
|
+
|
74
|
+
p = Scriptroute::send_train([ Struct::DelayedPacket.new(0,
|
75
|
+
Scriptroute::pkt_from_string(i.marshal) ) ])
|
76
|
+
puts p[0].probe
|
77
|
+
puts p[0].response
|
78
|
+
|
79
|
+
if(p[0].response && p[0].response.packet.icmp_type != Scriptroute::ICMP::ICMP_PARAMETERPROB) then
|
80
|
+
puts "****************** (%d)" % p[0].response.packet.icmp_type
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
def test_packets_without_daemon
|
85
|
+
m = Scriptroute::ICMPecho.new.marshal
|
86
|
+
has_bytes = m.methods.include?(:bytes)
|
87
|
+
puts m.length.to_s + " " + m.gsub(/./) { |b| "%x " % b[0].to_i }
|
88
|
+
puts m.length.to_s + " " + m.bytes.map { |b| "%x " % b }.join if has_bytes ## 1.9
|
89
|
+
# puts "decode: " + Scriptroute::stringpacket(m)
|
90
|
+
puts "encode: " + Scriptroute::pkt_from_string(m).to_s
|
91
|
+
|
92
|
+
m = Scriptroute::ICMPtstamp.new.marshal
|
93
|
+
puts m.length.to_s + " " + m.gsub(/./) { |b| "%x " % b[0].to_i }
|
94
|
+
puts m.length.to_s + " " + m.bytes.map { |b| "%x " % b }.join if has_bytes ## 1.9
|
95
|
+
# puts "decode: " + Scriptroute::stringpacket(m)
|
96
|
+
puts "encode: " + Scriptroute::pkt_from_string(m).to_s
|
97
|
+
|
98
|
+
m = Scriptroute::TCP.new.marshal
|
99
|
+
puts m.length.to_s + " " + m.gsub(/./) { |b| "%x " % b[0].to_i }
|
100
|
+
puts m.length.to_s + " " + m.bytes.map { |b| "%x " % b }.join if has_bytes ## 1.9
|
101
|
+
# puts "decode: " + Scriptroute::stringpacket(m)
|
102
|
+
puts "encode: " + Scriptroute::pkt_from_string(m).to_s
|
103
|
+
|
104
|
+
m = Scriptroute::UDP.new.marshal
|
105
|
+
puts m.length.to_s + " " + m.gsub(/./) { |b| "%x " % b[0].to_i }
|
106
|
+
puts m.length.to_s + " " + m.bytes.map { |b| "%x " % b }.join if has_bytes ## 1.9
|
107
|
+
# puts "decode: " + Scriptroute::stringpacket(m)
|
108
|
+
puts "encode: " + Scriptroute::pkt_from_string(m).to_s
|
109
|
+
|
110
|
+
m = Scriptroute::UDP.new(8).marshal
|
111
|
+
puts m.length.to_s + " " + m.gsub(/./) { |b| "%x " % b[0].to_i }
|
112
|
+
puts m.length.to_s + " " + m.bytes.map { |b| "%x " % b }.join if has_bytes ## 1.9
|
113
|
+
puts "decode: " + Scriptroute::IPv4.creator(m).to_s
|
114
|
+
puts "encode: " + Scriptroute::pkt_from_string(m).to_s
|
115
|
+
|
116
|
+
t = Scriptroute::TCP.new
|
117
|
+
opt = Scriptroute::Timestamp_option.new(1)
|
118
|
+
optr = Scriptroute::RecordRoute_option.new
|
119
|
+
t.add_option(optr)
|
120
|
+
t.ip_dst = 0x805f0218
|
121
|
+
t.ip_ttl = 3
|
122
|
+
t.th_seq = 0x01020304
|
123
|
+
t.th_ack = 0x09080706
|
124
|
+
m=t.marshal
|
125
|
+
puts m.length.to_s + " " + m.gsub(/./) { |b| "%x " % b[0].to_i }
|
126
|
+
puts m.length.to_s + " " + m.bytes.map { |b| "%x " % b }.join if has_bytes ## 1.9
|
127
|
+
# puts "decode: " + Scriptroute::stringpacket(m)
|
128
|
+
puts "encode: " + Scriptroute::pkt_from_string(m).to_s
|
129
|
+
|
130
|
+
#1.times { |i|
|
131
|
+
# m=t.marshal
|
132
|
+
# p = Scriptroute::send_train([ Struct::DelayedPacket.new(0, Scriptroute::pkt_from_string(m) ) ])
|
133
|
+
# puts p[0].probe
|
134
|
+
# puts p[0].response
|
135
|
+
# if(p[0].response && p[0].response.packet.icmp_type != ICMP_PARAMETERPROB) then
|
136
|
+
# puts "****************** (%d)" % p[0].response.packet.icmp_type
|
137
|
+
# end
|
138
|
+
# sleep(1)
|
139
|
+
#}
|
140
|
+
|
141
|
+
puts "--"
|
142
|
+
puts "No exceptions means the packets.rb self test probably worked okay. :)"
|
143
|
+
puts " Specifically, any bad checksum errors are because the interpreter doesn't"
|
144
|
+
puts " calculate them."
|
145
|
+
puts "--"
|
146
|
+
end
|
147
|
+
|
148
|
+
def test_nameify
|
149
|
+
puts Scriptroute.nameify("12.123.203.170")
|
150
|
+
end
|
151
|
+
end
|
152
|
+
|
153
|
+
# Local Variables:
|
154
|
+
# compile-command: "rake test"
|
155
|
+
# End:
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: scriptroute
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.14
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Neil Spring
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-05-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Scriptroute client and associated ruby components
|
14
|
+
email: nspring@cs.umd.edu
|
15
|
+
executables:
|
16
|
+
- sr-liveness
|
17
|
+
- sr-rockettrace
|
18
|
+
- sr-ally
|
19
|
+
- sr-traceroute
|
20
|
+
- sr-ping-T
|
21
|
+
- tulip
|
22
|
+
extensions: []
|
23
|
+
extra_rdoc_files: []
|
24
|
+
files:
|
25
|
+
- bin/sr-ally
|
26
|
+
- bin/sr-liveness
|
27
|
+
- bin/sr-ping-T
|
28
|
+
- bin/sr-rockettrace
|
29
|
+
- bin/sr-traceroute
|
30
|
+
- bin/tulip
|
31
|
+
- lib/scriptroute.rb
|
32
|
+
- lib/scriptroute/ally.rb
|
33
|
+
- lib/scriptroute/commando.rb
|
34
|
+
- lib/scriptroute/fixclock
|
35
|
+
- lib/scriptroute/liveness.rb
|
36
|
+
- lib/scriptroute/nameify.rb
|
37
|
+
- lib/scriptroute/packets.rb
|
38
|
+
- lib/scriptroute/rockettrace.rb
|
39
|
+
- lib/scriptroute/tulip/helper.rb
|
40
|
+
- lib/scriptroute/tulip/loss.rb
|
41
|
+
- lib/scriptroute/tulip/queuing.rb
|
42
|
+
- lib/scriptroute/tulip/reordering.rb
|
43
|
+
- test/test_bins.rb
|
44
|
+
- test/test_scriptroute.rb
|
45
|
+
homepage: http://www.scriptroute.org/
|
46
|
+
licenses:
|
47
|
+
- GPL
|
48
|
+
metadata: {}
|
49
|
+
post_install_message: Ensure that you have a scriptroute daemon running in order for
|
50
|
+
scripts to execute.
|
51
|
+
rdoc_options: []
|
52
|
+
require_paths:
|
53
|
+
- lib
|
54
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ">="
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project:
|
66
|
+
rubygems_version: 2.2.2
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: Scriptroute client in ruby
|
70
|
+
test_files: []
|
71
|
+
has_rdoc:
|