File: protocol-scan.nexp

package info (click to toggle)
netexpect 0.22-2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 8,672 kB
  • ctags: 3,840
  • sloc: ansic: 19,903; sh: 14,032; xml: 3,280; yacc: 1,179; lex: 469; makefile: 185
file content (23 lines) | stat: -rwxr-xr-x 472 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/local/bin/nexp
#

if {$argc != 2} {
    puts "Usage: $argv0 <hostname or IP address> <protocol>"
    exit 1
}

set ntries 3
set target [lindex $argv 0]
set protocol [lindex $argv 1]

set verbose 1

# Spawn a listener to get answers from our target
spawn_network -i [outif $target] src host $target

send_expect -tries $ntries ip(dst = $target, proto = $protocol)

foreach r $_(received) {
    packet decode r
    puts "$iperror(dst): protocol $iperror(protocol)"
}