can someone help to do it this proc who have time and desire
thx in advance
Code: Select all
##############################################################################################
## ## Proxycheck - dnsbl.tcl for eggdrop ## ##
##############################################################################################
##############################################################################################
## ____ __ ########################################### ##
## / __/___ _ ___ _ ___/ /____ ___ ___ ########################################### ##
## / _/ / _ `// _ `// _ // __// _ \ / _ \ ########################################### ##
## /___/ \_, / \_, / \_,_//_/ \___// .__/ ########################################### ##
## /___/ /___/ /_/ ########################################### ##
## ########################################### ##
##############################################################################################
## ## Start Setup. ## ##
##############################################################################################
##############################################################################################
##############################################################################################
## ProxyCheck On Connect #####################################################################
## ##
## This script use blacklist dns to check on connect the Ip ##################################
## ##
## The Checker IP comes from reply match and common proxy socks ports ########################
## ##
## The Script need to show report in channel only what is match as Proxy / VPN / SOCKS #######
## ##
## When the scripts is disabled need to show also the Ip matched from port or BL #############
## ##
##############################################################################################
set dnsbl(chrep) "#test"
bind pub -|- .check check:switch
bind pub -|- .ipadd exemps:cmd
bind pub -|- .ipdel "exemps:cmd
bind pub -|- .addport "exemps:cmd
bind pub -|- .delport "exemps:cmd
bind pub -|- .adddns "exemps:cmd
bind pub -|- .deldns "exemps:cmd
proc check:switch {nick uhost hand chan text} {
if {![onchan $nick $::dnsbl(chrep)]} { return }
if {$text eq "on"} {
setuser $::owner XTRA check on
putserv "PRIVMSG $::dnsbl(chrep) $nick : ANTIPROXY is ON"
} elseif {$text eq "off"} {
setuser $::owner XTRA check off
putserv "PRIVMSG $::dnsbl(chrep) $nick : ANTIPROXY is OFF"
} else {
putserv "PRIVMSG $::dnsbl(chrep) $nick : Syntax: The right command is: .check on/off."
}
}
#The first check is to check if the Ip exist on ExempList to allow and to show report this ip nick ip is exemp and matched from BL on port or reply
set exemps(file) "exemps.txt"
#The second check is to match the IP with Port of proxy $ socks 4/5 List and if is matched to zline the IP
#example: "Connected: Nick: $nick - IP: $ip - Reverse: $reverse --> 1 match from BL drone.dnsbl.org: on Port: $exemps(portfile)"
set exemps(portfile) "portscan.txt"
#This create the list of blacklist who each dnsbl to check and give report in channel report who from all blacklist matched the ip and to give zline to the ip
#example: "Connected: Nick: $nick - IP: $ip - Reverse: $reverse --> 1 match from BL drone.dnsbl.org Reply: 2"
set exemps(dnslist) "dnsbl-list.txt"
set dnsbl(type) "record"
#Every blacklist need to check with reply belowe and when the ip is matched from Bl to show and reply number who match the ip
set dnsbl(reply) "1; 2; 3; 4; 5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 32; 37; 38; 40; 100; 213; 255;"
#Action ban for gline/zline/gzline/akill/kline
set dnsbl(action) "zline"
#Ban Time Duration from gline/zline/gzline/akill/kline
set dnsbl(ban-time) "1d"
#Here we set the ban reason for gline/zline/gzline/akill/kline
set dnsbl(reason) "Decteted Proxy/Vpn"
bind raw * NOTICE connect:check
proc connect:check {from key text} {
# what regex code need in this body to scan check ip and variables ??? #
}
if {![file exists $exemps(file)]} {
set file [open $exemps(file) w]
close $file
}
if {![file exists $exemps(portfile)]} {
set file [open $exemps(portfile) w]
close $file
}
if {![file exists $exemps(dnslist)]} {
set file [open $exemps(dnsfile) w]
close $file
}
proc check_ip {ip} {
global exemps
set file [open $exemps(file) r]
set fdata [split [read $file] \n]
close $file
foreach entry $fdata {
if {[string match $entry $ip]} {
return 1
}
}
return 0
}
proc check_port {port} {
global exemps
set file [open $exemps(portfile) r]
set fdata [split [read $file] \n]
close $file
foreach entry $fdata {
if {[string match -nocase $entry $port]} {
return 1
}
}
return 0
}
proc check_dnsbl {dnsbl} {
global exemps
set file [open $exemps(dnsfile) r]
set fdata [split [read $file] \n]
close $file
foreach entry $fdata {
if {[string match -nocase $entry $dnsbl]} {
return 1
}
}
return 0
}
proc exemps:cmd {nick host hand chan arg} {
global exemps
if {![onchan $nick $::dnsbl(chrep)]} { return }
set arg1 [lindex [split $arg] 0]
set type [string trim $::lastbind "."]
switch $type {
ipadd {
if {$arg1 == ""} {
putserv "PRIVMSG $::dnsbl(chrep) Syntax: .addip / .delip 109.23.* or .addip / .delip 109.23.16.24 "
return
}
set file [open $exemps(file) "r"]
set data [read $file]
close $file
set lines [lrange [split $data "\n"] 0 end-1]
set current_place [lsearch -exact $lines $arg1]
if { $current_place != "-1" } {
putserv "PRIVMSG $::dnsbl(chrep) $nick: This Ip $arg1 exist on ExempList"
return
}
set file [open $exemps(file) a]
puts $file $arg1
close $file
putserv "PRIVMSG $::dnsbl(chrep) $nick: This Ip $arg1 ADDED succesfully in ExempList"
}
ipdel {
array set exempsdel [list]
set file [open $exemps(file) "r"]
set data [read $file]
close $file
set lines [lrange [split $data "\n"] 0 end-1]
set current_place [lsearch -exact $lines $arg1]
if {$current_place == "-1"} {
putserv "PRIVMSG $::dnsbl(chrep) $nick: This Ip $arg1 dont exist on ExempList"
return
}
set delete [lreplace $lines $current_place $current_place]
set files [open $exemps(file) "w"]
puts $files [join $delete "\n"]
flush $files
close $files
set file [open $exemps(file) "r"]
set data [read $file]
close $file
if {[string is space $data]} {
set files [open $exemps(file) "w"]
close $files
}
putserv "PRIVMSG $::dnsbl(chrep) $nick: This Ip $arg1 REMOVED succesfully from ExempList"
}
addport {
if {$arg1 == ""} {
putserv "PRIVMSG $::RepChan(report_chan) Syntax: .addport 8080 / .delport 8080"
return
}
set file [open $exemps(portfile) "r"]
set data [read $file]
close $file
set lines [lrange [split $data "\n"] 0 end-1]
set current_place [lsearch -exact $lines $arg1]
if { $current_place != "-1" } {
putserv "PRIVMSG $::dnsbl(chrep) $nick: This Port $arg1 exist on PORT-List"
return
}
set file [open $exemps(portfile) a]
puts $file $arg1
close $file
putserv "PRIVMSG $::dnsbl(chrep) $nick: This Port $arg1 ADDED succesfully in PORT-List"
}
delport {
array set exempsdel [list]
set file [open $exemps(portfile) "r"]
set data [read $file]
close $file
set lines [lrange [split $data "\n"] 0 end-1]
set current_place [lsearch -exact $lines $arg1]
if {$current_place == "-1"} {
putserv "PRIVMSG $::dnsbl(chrep) $nick: This Port $arg1 dont exist on PORT-List"
return
}
set delete [lreplace $lines $current_place $current_place]
set files [open $exemps(portfile) "w"]
puts $files [join $delete "\n"]
flush $files
close $files
set file [open $exemps(portfile) "r"]
set data [read $file]
close $file
if {[string is space $data]} {
set files [open $exemps(portfile) "w"]
close $files
}
putserv "PRIVMSG $::RepChandnsbl(chrep) $nick: This Port $arg1 REMOVED succesfully from PORT-List"
}
adddns {
if {$arg1 == ""} {
putserv "PRIVMSG $::RepChan(report_chan) Syntax: .adddns drone.dnsbl.org / .deldns drone.dnsbl.org "
return
}
set file [open $exemps(portfile) "r"]
set data [read $file]
close $file
set lines [lrange [split $data "\n"] 0 end-1]
set current_place [lsearch -exact $lines $arg1]
if { $current_place != "-1" } {
putserv "PRIVMSG $::dnsbl(chrep) $nick: This BL $arg1 exist on DNSBL-List"
return
}
set file [open $exemps(portfile) a]
puts $file $arg1
close $file
putserv "PRIVMSG $::dnsbl(chrep) $nick: This BL $arg1 ADDED succesfully in DNSBL-List"
}
deldns {
array set exempsdel [list]
set file [open $exemps(portfile) "r"]
set data [read $file]
close $file
set lines [lrange [split $data "\n"] 0 end-1]
set current_place [lsearch -exact $lines $arg1]
if {$current_place == "-1"} {
putserv "PRIVMSG $::dnsbl(chrep) $nick: This BL $arg1 dont exist on DNSBL-List"
return
}
set delete [lreplace $lines $current_place $current_place]
set files [open $exemps(portfile) "w"]
puts $files [join $delete "\n"]
flush $files
close $files
set file [open $exemps(portfile) "r"]
set data [read $file]
close $file
if {[string is space $data]} {
set files [open $exemps(portfile) "w"]
close $files
}
putserv "PRIVMSG $::RepChandnsbl(chrep) $nick: This BL $arg1 REMOVED succesfully from DNSBL-List"
}
}
}
putlog "ProxyCheck - Loaded"