| View previous topic :: View next topic |
| Author |
Message |
krouser Voice
Joined: 08 May 2013 Posts: 4
|
Posted: Wed May 08, 2013 6:54 am Post subject: Catching IPs from text file |
|
|
Hi guys, can someone show me if it is possible to catch/match IPs that were previously saved on a .txt file and trigger a ban on that IP for a certain amount of time?
Thanks in advance!  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Wed May 08, 2013 9:08 am Post subject: |
|
|
| Code: |
bind join * * ip:check
proc ip:check {nick uhost hand chan} {
if {[isbotnick $nick] || [validuser $hand]} return
set ip [lindex [split $uhost "@"] 1]
set fh [open "ips.txt"]
while {[gets $fh line] >= 0} {
if {[string equal -nocase $line $ip]} {
incr match
break
}
}
close $fh
if {[info exists match]} {
pushmode $chan +b $ip
}
}
|
this would work for all channels the bot is on, but if you wish to make it work just on a single channel and you won't change your mind any time soon then change:
| Code: |
bind join * * ip:check
|
to:
| Code: |
bind join "#mychan *" * ip:check
|
Edit: typo. _________________ Once the game is over, the king and the pawn go back in the same box.
Last edited by caesar on Wed May 08, 2013 9:20 am; edited 1 time in total |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
|
| Back to top |
|
 |
krouser Voice
Joined: 08 May 2013 Posts: 4
|
Posted: Wed May 08, 2013 12:47 pm Post subject: |
|
|
thanks a lot caesar! im lookin forward to try it out.. and you are right willyw it would but I need to check exactly how this whole .txt string matching thing works.. still learning here  |
|
| Back to top |
|
 |
|