alias findport scanport kaddhelp findport "Scans a channel or user(list) for a certain port." "/findport ,,etc\]> " "Port Finder" proc scanport {} { complete set arg [lindex [args] 0] set port [FALC_port [lindex [args] 1]] if {$port == 0} {echo "[kano] invalid port [lindex [args] 1]";return} if {[ison [my_nick] $arg]} {set arg [chanlist $arg]} {set arg [split $arg ,]} if {$arg == ""} {echo "[kano] empty nicklist formed from [lindex [args] 0]";return} set ips [list] port echo "[kano] formatting ip addresses" foreach i $arg { set host [uhost $i] if {$host != ""} {regexp {.*@(.*)} $host junk i} if {![FALC_isip $i]} {port echo "7(-) looking up $i";set j $i;set i [dnslookup $i];port echo "8(+) resolved $j to $i"} lappend ips $i } set ips [killdupe $ips] port echo "[kano] done formatting ip addresses ([expr {[llength $arg] - [llength $ips]}] clones); searching ports" foreach ip $ips {port check $ip $port} } proc port {cmd args} { switch -- $cmd { echo { if {![window exists query .scanport.]} {/query .scanport.;port refresh} echo [lindex $args 0] query .scanport. } check { foreach {ip port} $args {} if [catch {socket -async $ip $port} er] { port echo "5(x) couldn't connect to $ip:$port - $er" } { fconfigure $er -blocking 0 -buffering full -translation binary fileevent $er writable [list port open $er $ip $port] } } open { foreach {sock ip port} $args {} fileevent $sock writable {} if {[catch {read $sock}]} {port echo "5(x) couldn't connect to $ip:$port"} {port echo "9(o) $ip:$port is open/$sock"} close $sock } } }