egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help me with this script plz...

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
neoHUNTER
Voice


Joined: 23 Oct 2007
Posts: 3

PostPosted: Tue Oct 23, 2007 5:58 am    Post subject: help me with this script plz... Reply with quote

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
View user's profile Send private message AIM Address
r0t3n
Owner


Joined: 31 May 2005
Posts: 507
Location: UK

PostPosted: Tue Oct 23, 2007 5:21 pm    Post subject: Reply with quote

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
View user's profile Send private message MSN Messenger
nml375
Revered One


Joined: 04 Aug 2006
Posts: 2857

PostPosted: Tue Oct 23, 2007 8:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
neoHUNTER
Voice


Joined: 23 Oct 2007
Posts: 3

PostPosted: Wed Oct 24, 2007 5:54 pm    Post subject: nice. Reply with quote

Wow I just tried it and it seems to be working fine. Thanks man...Problem solved...
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber