Date: Tue, 19 Jan 1999 16:49:12 +0200 (IST) From: izar@netect.com Reply-To: izar@mail.il.netect.com To: nmap-hackers@insecure.org Subject: First Zeta version of vnmap Here goes, for whatever it is worth. You'll need a kosher Tk/Tcl install to use this. No furry animals, microsoft software or Tk/Tcl libraries were used to make this, so expect it to be extremely plain. When I have the time I'll rethink it. As soon as I have some free time (yeah sure) I'll add some more features - in the TODO list are an user friendly output (the present one is just to see that things work, it sucks) and a way to run plugins. I will be most happy to get any comments, gripes and so on. Flames, as usual, go to /dev/null. To use, just set the bang line to point to your "wish" and the NMAP variable to point to your nmap. --izar -izar@netect.com--------------------Ring Zero Team,Netect Ltd.----------------- Izar Tarandach, Security Architect - All expressed opinions are mine. 32o 6' 50" North, 34o 39' 40" East, Scud Landing Control ------------------------------------------------------------------------------- ----------------------------------begin code---------------------------------------- #!/usr/local/bin/wish # comments, gripes and so on go to izar@netect.com # thanks to Fyodor for the support and for nmap. #USER-CONFIGURABLE OPTIONS global NMAP; set NMAP {/usr/local/bin/nmap} #END OF USER-CONFIGURABLE OPTIONS global nmapArgLine; set nmapArgLine "$NMAP " global scanType widget outputOpen #scan modes global tinyfrags noping tcpsynackping icmpping fastScan noDNS identd #scan info global targetIPvalue scanPortValue decoyHostsValue global output ; set output "" proc clearAll {} { global tinyfrags noping tcpsynackping icmpping fastScan noDNS NMAP global fingerprint identd nmapArgLine set identd 0 set fingerprint 0 set tinyfrags 0 set noping 0 set tcpsynackping 0 set icmpping 0 set tcpsynping 0 set fastScan 0 set noDNS 0 set nmapArgLine "$NMAP " } proc {Window} {args} { set cmd [lindex $args 0] set name [lindex $args 1] set newname [lindex $args 2] set rest [lrange $args 3 end] if {$name == "" || $cmd == ""} {return} if {$newname == ""} { set newname $name } set exists [winfo exists $newname] switch $cmd { show { if {$exists == "1" && $name != "."} {wm deiconify $name; return} if {[info procs win(pre)$name] != ""} { eval "win(pre)$name $newname $rest" } if {[info procs win$name] != ""} { eval "win$name $newname $rest" } if {[info procs win(post)$name] != ""} { eval "win(post)$name $newname $rest" } } hide { if $exists {wm withdraw $newname; return} } iconify { if $exists {wm iconify $newname; return} } destroy { if $exists {destroy $newname; return} } } } proc {ScanSel} {sType} { global scanType set scanType $sType Window show .scanDialog } proc win. {base} { if {$base == ""} { set base . } wm focusmodel $base passive wm geometry $base 1x1+0+0 wm maxsize $base 785 570 wm minsize $base 1 1 wm overrideredirect $base 0 wm resizable $base 1 1 wm withdraw $base wm title $base "VNmap" } proc win.scanDialog {base} { global scanType nmapArgLine global targetIPvalue scanPortValue decoyHostsValue identd global tinyfrags noping tcpsynackping icmpping fastScan noDNS if {$base == ""} { set base .scanDialog } if {[winfo exists $base]} { wm deiconify $base; return } toplevel $base -class Toplevel wm focusmodel $base passive wm geometry $base 350x289+11+150 wm maxsize $base 350 289 wm minsize $base 350 289 wm overrideredirect $base 0 wm resizable $base 1 1 wm deiconify $base checkbutton $base.tinyfrags -text {Use tiny fragments} -variable tinyfrags checkbutton $base.noping -text {Don't ping hosts} -variable noping radiobutton $base.tcpackping -text {Use TCP ACK ping on port: } -variable \ tcpsynackping -value "A" entry $base.tcpPingport entry $base.tcpPingport2 checkbutton $base.icmpPing -text {Use only ICMP ping} -variable icmpping radiobutton $base.tcpsynping -text {Use TCP SYN ping on port: } -variable \ tcpsynackping -value "S" checkbutton $base.fastScan -text {Fast scan} -variable fastScan checkbutton $base.noDNS -text {Don't resolve hostnames} -variable noDNS checkbutton $base.fingerprint -text {Do OS fingerprinting } -variable \ fingerprint checkbutton $base.ident -text {Use identd} -variable identd label $base.targetIP -borderwidth 1 -text {Scan Target(s): } entry $base.targetIPvalue -textvariable targetIPvalue label $base.scanPorts -borderwidth 1 -text {Scan Port(s): } entry $base.scanPortValue label $base.decoyHosts -borderwidth 1 -text {Decoy Host(s):} entry $base.decoyHostsValue button $base.goBtn -command { \ if {$targetIPvalue == ""} {\ toplevel .d -class Toplevel tk_dialog .d "Need more information" "Please enter at least one target for the scan" "" 0 "OK" \ } else { doScan} }\ -padx 9 -pady 3 -relief groove -text Scan button $base.cnclBtn -command {set scanType ""} \ -padx 9 -pady 3 -relief groove -text Cancel -command {\ destroy .scanDialog \ } ################### place $base.noping -x 5 -y 5 -anchor nw -bordermode ignore place $base.fastScan -x 5 -y 25 -anchor nw -bordermode ignore place $base.noDNS -x 5 -y 45 -anchor nw -bordermode ignore place $base.tinyfrags -x 5 -y 65 -anchor nw -bordermode ignore place $base.tcpackping -x 5 -y 85 -anchor nw -bordermode ignore place $base.tcpPingport -x 195 -y 85 -width 40 -height 24 -anchor nw -bordermode ignore place $base.tcpsynping -x 5 -y 110 -anchor nw -bordermode ignore place $base.tcpPingport2 -x 195 -y 110 -width 40 -height 24 -anchor nw -bordermode ignore place $base.icmpPing -x 5 -y 130 -anchor nw -bordermode ignore place $base.fingerprint -x 5 -y 150 -anchor nw -bordermode ignore place $base.ident -x 5 -y 170 -anchor nw -bordermode ignore place $base.targetIP -x 5 -y 190 -anchor nw -bordermode ignore place $base.targetIPvalue -x 120 -y 190 -anchor nw -bordermode ignore place $base.scanPorts -x 5 -y 210 -anchor nw -bordermode ignore place $base.scanPortValue -x 120 -y 210 -anchor nw -bordermode ignore place $base.decoyHosts -x 5 -y 230 -anchor nw -bordermode ignore place $base.decoyHostsValue -x 120 -y 230 -width 210 -height 24 -anchor nw -bordermode ignore place $base.goBtn -x 45 -y 260 -anchor nw -bordermode ignore place $base.cnclBtn -x 250 -y 260 -anchor nw -bordermode ignore wm title $base "Scan Options" switch $scanType { "T" { $base.tinyfrags configure -state disabled $base.decoyHosts configure -foreground gray append nmapArgLine " -sT " .top.status configure -fg DarkOliveGreen -justify left -text \ "Scan Options - TCP connect" } "S" { append nmapArgLine " -sS " $base.icmpPing configure -state disabled .top.status configure -fg DarkOliveGreen -justify left -text \ "Scan Options - TCP SYN" } "F" { append nmapArgLine " -sF " .top.status configure -fg DarkOliveGreen -justify left -text \ "Scan Options - FIN" } "X" { append nmapArgLine " -sX " .top.status configure -fg DarkOliveGreen -justify left -text \ "Scan Options - Xmas" } "N" { append nmapArgLine " -sN" .top.status configure -fg DarkOliveGreen -justify left -text \ "Scan Options - Null" } "P" { $base.icmpPing configure -state disabled $base.noping configure -state disabled $base.tinyfrags configure -state disabled $base.fastScan configure -state disabled .top.status configure -fg DarkOliveGreen -justify left -text \ "Scan Options - Ping" append nmapArgLine " -sP" } "U" { $base.tcpackping configure -state disabled $base.icmpPing configure -state disabled $base.tinyfrags configure -state disabled $base.tcpsynping configure -state disabled append nmapArgLine " -sU" .top.status configure -fg DarkOliveGreen -justify left -text \ "Scan Options - UDP" } "b" { $base.tinyfrags configure -state disabled $base.decoyHosts configure -text "Bounce Host: " append nmapArgLine " -b" .top.status configure -fg DarkOliveGreen -justify left -text \ "Scan Options - FTP bounce" } default { puts "bad scantype" } } } proc doScan {args} { global scanType NMAP nmapArgLine outputOpen global tinyfrags noping tcpsynackping icmpping fastScan noDNS identd global targetIPvalue scanPortValue decoyHostsValue output #build the command line if {$tcpsynackping == "A"} { append nmapArgLine "-PT" set port [.scanDialog.tcpPingport get] if {$port != ""} { append nmapArgLine $port } } if {$tinyfrags} { append nmapArgLine " -f" } if {$noping} { append nmapArgLine " -P0" } if {$icmpping} { append nmapArgLine " -PI" } if {$tcpsynackping == "S"} { append nmapArgLine " -PS" set port [.scanDialog.tcpPingport2 get] if {$port != ""} { append nmapArgLine $port } } if {$fastScan} { append nmapArgLine " -F" } if {$noDNS} { append nmapArgLine " -n" } if { $identd } { append nmapArgLine " -I" } append nmapArgLine " " $targetIPvalue .top.status configure -fg DarkOliveGreen -justify left -text \ $nmapArgLine set output [eval exec $nmapArgLine] if {$outputOpen} { .output.txt insert insert $output } else { Window show .output } clearAll destroy .scanDialog } proc win.output { base } { global targetIPvalue output outputOpen set outputOpen 1 if {$base == ""} { set base .output } if {[winfo exists $base]} { wm deiconify $base; return } toplevel $base -class Toplevel wm focusmodel $base passive wm geometry $base 694x400-70+150 wm maxsize $base 785 570 wm minsize $base 1 1 wm overrideredirect $base 0 wm resizable $base 1 1 wm deiconify $base wm title $base "Nmap output for $targetIPvalue" text $base.txt button $base.close -text "Close" -command { destroy .output } pack $base.txt $base.close $base.txt insert insert $output $base.txt insert insert "\n" } proc win.top {base} { if {$base == ""} { set base .top } if {[winfo exists $base]} { wm deiconify $base; return } toplevel $base -class Toplevel wm focusmodel $base passive wm geometry $base 635x68+10+50 wm maxsize $base 785 570 wm minsize $base 1 1 wm overrideredirect $base 0 wm resizable $base 1 1 wm deiconify $base wm title $base "NMAP - The Network Mapper - by Fyodor (fyodor@dhp.com, www.insecure.org/nmap/)" button $base.tcpcon \ -command {ScanSel "T"} -padx 9 -pady 3 -relief groove \ -text {TCP Connect()} button $base.tcpsyn -command {ScanSel "S"} \ -padx 9 -pady 3 -relief groove -text {TCP SYN (stealth)} button $base.fin -command {ScanSel "F"}\ -padx 9 -pady 3 -relief groove -text FIN button $base.xmas -command {ScanSel "X"}\ -padx 9 -pady 3 -relief groove -text Xmas button $base.null -command {ScanSel "N"} \ -padx 9 -pady 3 -relief groove -text Null button $base.ping -command {ScanSel "P"}\ -padx 9 -pady 3 -relief groove -text ping button $base.udp -command {ScanSel "U"}\ -padx 9 -pady 3 -relief groove -text UDP button $base.bnc -command {ScanSel "b"}\ -padx 9 -pady 3 -relief groove -text {FTP bounce} button $base.help -command {Help }\ -padx 9 -pady 3 -relief groove -text {Help} label $base.status \ -borderwidth 1 ################### place $base.tcpcon \ -x 0 -y 5 -width 104 -height 28 -anchor nw -bordermode ignore place $base.tcpsyn \ -x 105 -y 5 -width 127 -height 28 -anchor nw -bordermode ignore place $base.fin \ -x 233 -y 5 -width 44 -height 28 -anchor nw -bordermode ignore place $base.xmas \ -x 277 -y 5 -width 59 -height 28 -anchor nw -bordermode ignore place $base.null \ -x 335 -y 5 -anchor nw -bordermode ignore place $base.ping \ -x 383 -y 5 -width 50 -height 28 -anchor nw -bordermode ignore place $base.udp \ -x 433 -y 5 -width 52 -height 28 -anchor nw -bordermode ignore place $base.bnc \ -x 485 -y 5 -anchor nw -bordermode ignore place $base.help \ -x 580 -y 5 -anchor nw -bordermode ignore place $base.status \ -x 5 -y 40 -width 571 -height 18 -anchor nw -bordermode ignore } set outputOpen 0 Window show . Window show .top