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 

Catching IPs from text file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
krouser
Voice


Joined: 08 May 2013
Posts: 4

PostPosted: Wed May 08, 2013 6:54 am    Post subject: Catching IPs from text file Reply with quote

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! Smile
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Wed May 08, 2013 9:08 am    Post subject: Reply with quote

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


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed May 08, 2013 9:11 am    Post subject: Reply with quote

The ability to store bans is built in Eggdrop. Won't this do it?

http://www.egghelp.org/commands/channels.htm#+ban
Back to top
View user's profile Send private message
krouser
Voice


Joined: 08 May 2013
Posts: 4

PostPosted: Wed May 08, 2013 12:47 pm    Post subject: Reply with quote

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 Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help 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