proc portscan { server } { puts "scanning $server..." for {set x 1} {$x<65535} {incr x} { puts -nonewline "$x\x8\x8\x8\x8\x8" flush stdout if { [catch {set sck [socket $server $x]}] != 0 } continue fconfigure $sck -blocking 0 gets $sck a gets $sck a close $sck puts "port $x is open!" } puts "done." } portscan 160.114.55.227