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