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 with ban lookup script

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


Joined: 04 Apr 2010
Posts: 1

PostPosted: Sun Apr 04, 2010 4:13 pm    Post subject: help with ban lookup script Reply with quote

Hi and hello all, new member so please bear with me if i dont correctly express what i am trying to do, i searched through all i could find on the forum and could not find the answer to what i need, so please forgive me if my newness has disbled my search fu.

What i'm trying to do is when a host/ip joins a channel i want to cross check it with a file of ip address that i have on their seperate lines, like so
31.51.16.118
23.12.22.192
68.126.249.133
and if a match is found to the resolved Ip, ban it for 10minutes

I followed Jamesoff example in his proxycheck script, but when i get to trying to grep the file for a mtach i get stumped, wonder if anyone can explain what i need to do next, or show an example, many thanks

# Blacklist file(s) to look in
set black_bbls {
"/home/botnick/eggdrop/ip.db"
}
# time in minutes to ban for
set black_bantime 10

# add channel flag
setudef flag black

# bind events
bind join - *!*@* black_join

# cache
set black_lastip ""

# catch joins
proc black_join { nick host handle channel } {

#check if channel is active
if {![channel get $channel black]} { return; }

#get the actual host
regexp ".+@(.+)" $host matches newhost
if [regexp {[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $newhost] {

#it's a numeric host, skip the lookup
black_check2 $newhost $newhost 1 $nick $newhost $channel
} else {
dnslookup $newhost black_check2 $nick $newhost $channel
}
}

# Try to run Blacklist checks)
proc black_check2 { ip host status nick orighost channel } {
global black_bbls blacklookup_bbls
if {$status == 1} {
# And hopefully look it up in the blacklist file(s)
set newip "$ip"
foreach bbl $black_bbls {
dnslookup "$newip" black_check3 $nick $host $channel $bbl
}
} else {
putlog " black: Couldn't resolve $host. (No further action taken.)"
}
}

# I'm stumped as how to go from here
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