Could someone tell me if possible, the bot detects whether text or number
example:
<user> !scan asdasdasdas
<bot> this is not an ip
also I have this problem with colors and antiflood
<user> !scan 123.123.123.123
<bot> Connecting to 123.123.123.123 requested by user
<bot> Connection to 123.123.123.123 has timed out
bot could scan the color?
<user> !scan 123.123.123.123
<bot> Connecting to 123.123.123.123
<bot> Connection to \ 123.123.123.123:2300 accepted. (Port is Open)
<bot> Connection to \ 123.123.123.123:47624 accepted. (Port is Open)
You can do something about the flood
<user> !scan 123.123.123.123
<user> !scan 123.123.123.123
<user> !scan 123.123.123.123
<bot> Ignore for 1 min
Would be very grateful if someone assists me
here the code done by:TCL_no_TK
Code: Select all
set scanports "2300 47624"
bind pub -|- !portscan pub:portscan
proc pub:portscan {nick uhost hand chan text} {
set address [lindex [split $text] 0]
putquick "PRIVMSG $chan :Connecting to \037$address\037 requested by \002$nick\002"
portscan "$address" "$chan"
}
proc portscan {address chan} {
global scanports
foreach f $scanports {
if {[catch {set sock [socket -async $address $f]} error]} {
puthelp "PRIVMSG $chan :Connection to \037$address\002:\002$f\037 was \002refused\002"
} else {
set id [utimer 15 [list portscan_timeout $chan $sock $address $f]]
fileevent $sock writable [list portscan_connected $chan $sock $address $f $id]
}
}
}
proc portscan_timeout {chan sock address port} {
close $sock
puthelp "PRIVMSG $chan :Connection to \037$address\002:\002$port\037 has \002timed out\002."
}
proc portscan_connected {chan sock address port id} {
killutimer $id
set eor [fconfigure $sock -error]
if {$eor != ""} {
close $sock
puthelp "PRIVMSG $chan :Connection to \037$address\002:\002$port\037 \002failed\002."
foreach e [split $eor "\n"] {
puts " * $e"
}
} else {
puthelp "PRIVMSG $chan :Connection to \037$address\002:\002$port\037 \002accepted\002. (Port is \002Open\002)"
close $sock
}
}
putlog "by:TCL_no_TK"