This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

help me with this script plz...

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
n
neoHUNTER
Voice
Posts: 3
Joined: Tue Oct 23, 2007 5:50 am

help me with this script plz...

Post by neoHUNTER »

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.
r
r0t3n
Owner
Posts: 507
Joined: Tue May 31, 2005 6:56 pm
Location: UK

Post by r0t3n »

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: Select all

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
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

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
n
neoHUNTER
Voice
Posts: 3
Joined: Tue Oct 23, 2007 5:50 am

nice.

Post by neoHUNTER »

Wow I just tried it and it seems to be working fine. Thanks man...Problem solved...
Post Reply