@@ -28,14 +28,26 @@ def initialize(shell)
28
28
# List of supported commands.
29
29
#
30
30
def commands
31
+ #all = {
31
32
{
32
33
"sniffer_interfaces" => "Enumerate all sniffable network interfaces" ,
33
34
"sniffer_start" => "Start packet capture on a specific interface" ,
34
35
"sniffer_stop" => "Stop packet capture on a specific interface" ,
35
36
"sniffer_stats" => "View statistics of an active capture" ,
36
37
"sniffer_dump" => "Retrieve captured packet data to PCAP file" ,
37
- "sniffer_release" => "Free captured packets on a specific interface instead of downloading them" ,
38
+ "sniffer_release" => "Free captured packets on a specific interface instead of downloading them"
38
39
}
40
+
41
+ #reqs = {
42
+ # "sniffer_interfaces" => ['sniffer_interfaces'],
43
+ # "sniffer_start" => ['sniffer_capture_start'],
44
+ # "sniffer_stop" => ['sniffer_capture_stop'],
45
+ # "sniffer_stats" => ['sniffer_capture_stats'],
46
+ # "sniffer_dump" => ['sniffer_capture_dump'],
47
+ # "sniffer_release" => ['sniffer_capture_release']
48
+ #}
49
+
50
+ #filter_commands(all, reqs)
39
51
end
40
52
41
53
@@ -46,10 +58,18 @@ def cmd_sniffer_interfaces(*args)
46
58
print_line ( )
47
59
48
60
ifaces . each do |i |
49
- print_line ( sprintf ( "%d - '%s' ( type:%d mtu:%d usable:%s dhcp:%s wifi:%s )" ,
50
- i [ 'idx' ] , i [ 'description' ] ,
51
- i [ 'type' ] , i [ 'mtu' ] , i [ 'usable' ] , i [ 'dhcp' ] , i [ 'wireless' ] )
52
- )
61
+ if i . length == 8
62
+ # Windows
63
+ print_line ( sprintf ( "%d - '%s' ( type:%d mtu:%d usable:%s dhcp:%s wifi:%s )" ,
64
+ i [ 'idx' ] , i [ 'description' ] ,
65
+ i [ 'type' ] , i [ 'mtu' ] , i [ 'usable' ] , i [ 'dhcp' ] , i [ 'wireless' ] )
66
+ )
67
+ else
68
+ # Mettle
69
+ print_line ( sprintf ( "%d - '%s' ( usable:%s )" ,
70
+ i [ 'idx' ] , i [ 'description' ] , i [ 'usable' ] )
71
+ )
72
+ end
53
73
end
54
74
55
75
print_line ( )
@@ -167,10 +187,10 @@ def cmd_sniffer_dump(*args)
167
187
# TODO: reorder packets based on the ID (only an issue if the buffer wraps)
168
188
while ( true )
169
189
buf = od . read ( 20 )
170
- break if not buf
190
+ break unless buf
171
191
172
192
idh , idl , thi , tlo , len = buf . unpack ( 'N5' )
173
- break if not len
193
+ break unless len
174
194
if ( len > 10000 )
175
195
print_error ( "Corrupted packet data (length:#{ len } )" )
176
196
break
0 commit comments