| View previous topic :: View next topic |
| Author |
Message |
neoHUNTER Voice
Joined: 23 Oct 2007 Posts: 3
|
Posted: Tue Oct 23, 2007 5:58 am Post subject: help me with this script plz... |
|
|
Can anybody change this script, scan user upon join if their ports are open using the proxy and voicing only those whose ports are close. When the bot finds out that the port is open, it will notice the user. This is the original script:
#preference.
###################################
variable banport "1080,1081,3380,3381" ;# Enter most common port list
variable backchan "#enter backchannel"
### Having E handle will make the bot to ignore that person.
variable handle "E"
###################################
# Do not edit below
###################################
###################################
# Join bind
###################################
proc scan_join {nick host hand chan} {
variable banport; variable handle
if {[matchattr $hand $handle|$handle $chan]} {return}
set hostname [lindex [split $host \x40] end]
foreach {x} [split $banport \x2c] {
if {![catch {socket -async $hostname $x} s]} {
fileevent $s writable [list [namespace current]::check_sock $s $host $chan
$nick]
}
}
}
###################################
# fileevent callback
###################################
proc check_sock {s host chan nick} {
variable backchan
if {[string equal {} [fconfigure $s -error]]} {
putserv "NOTICE $backchan :$nick is using proxies.\($host\)"
close $s
} else {
pushmode $chan +v $nick
}
}
bind join - * [namespace current]::scan_join
###############################END##############
This is the effect of the script:
* Ergoth has joined #samplechan
-DoomsDay:#samplechan- Ergoth is using proxies.(~ergoth@221.209.18.1)
-DoomsDay:#samplechan- Ergoth is using proxies.(~ergoth@221.209.18.1)l
-DoomsDay:#samplechan- Ergoth is using proxies.(~ergoth@221.209.18.1)
-DoomsDay:#samplechan- Ergoth is using proxies.(~ergoth@221.209.18.1)
-DoomsDay:#samplechan- Ergoth is using proxies.(~ergoth@221.209.18.1)
It doesnt stop noticing the channel. Could anybody help me with this please...Thank you. |
|
| Back to top |
|
 |
r0t3n Owner
Joined: 31 May 2005 Posts: 507 Location: UK
|
Posted: Tue Oct 23, 2007 5:21 pm Post subject: |
|
|
It might be because the socket does not get closed quick enough before another packet gets sent to the handler...
Try something like this:
| Code: | proc scan_join {nick host hand chan} {
variable banport; variable handle
if {[matchattr $hand $handle|$handle $chan]} {return}
set hostname [lindex [split $host \x40] end]
foreach {x} [split $banport \x2c] {
if {![catch {socket -async $hostname $x} s]} {
set ::queue($nick:$s) "$x"
fileevent $s writable [list [namespace current]::check_sock $s $host $chan
$nick]
}
}
}
###################################
# fileevent callback
###################################
proc check_sock {s host chan nick} {
variable backchan
if {![info exists ::queue($nick:$s)]} { return }
if {[string equal {} [fconfigure $s -error]]} {
unset ::queue($nick:$s)
putserv "NOTICE $backchan :$nick is using proxies.\($host\)"
close $s
} else {
unset ::queue($nick:$s)
pushmode $chan +v $nick
}
} |
_________________ r0t3n @ #r0t3n @ Quakenet |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Tue Oct 23, 2007 8:17 pm Post subject: |
|
|
Unfortunately not, as it opens multiple sockets, one for each port checked.
Then, whenever any of those sockets becomes writable, it'll post the notice and do other actions aswell.
The added check should do the trick nevertheless. _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
neoHUNTER Voice
Joined: 23 Oct 2007 Posts: 3
|
Posted: Wed Oct 24, 2007 5:54 pm Post subject: nice. |
|
|
| Wow I just tried it and it seems to be working fine. Thanks man...Problem solved... |
|
| Back to top |
|
 |
|