Hello..
I have this script and this was good and now i dont know example my country (Kosovo) take als Proxy because all IP from my country (Kosovo) are with score over 50..
can we make maybe with another web? example with proxycheck.io or https://ipinfo.io/ is the best..
maybe can anyone help me...
Thanks.
I have this script and this was good and now i dont know example my country (Kosovo) take als Proxy because all IP from my country (Kosovo) are with score over 50..
can we make maybe with another web? example with proxycheck.io or https://ipinfo.io/ is the best..
maybe can anyone help me...
Thanks.
tcl
#########################################################
# Zline IP
# Komandat
# .!pro on/off
# .!addip <ip>
# .!delip <ip>
# .!addasn <asn>
# .!delasn <asn>
# army Production 2020 @
#########################################################
#set report chan
set zip(report_chan) "#stafi"
#what flags can use commands ?
set zip(flags) "-|-"
#set first char of the commands
set zip(first_char) ","
#set api key
set zip(api_key) {
"FlJvjmhqrbIFXLEM9AejZ70653Lb6LQT"
"WLHrQ9epRuqzzkkivMQM8Mml8du73GJM"
"AEysBj3rnsUEKpFljWPv6UBs81zS8hsD"
}
#set after how many ours the variable containing the users
#who are not proxy to be reseted
set zip(reset_hours) "48"
#######################################################
bind join - * zip:join_scan
bind pubm $zip(flags) * zip:cmd
setudef flag zip
package require http
#package require tls
set zip(asn_file) "asn.txt"
set zip(exempt_file) "exempts.txt"
if {![info exists zip(reset_start)]} {
timer [expr $zip(reset_hours) * 60] zip:var_reset
set zip(reset_start) 1
}
if {![file exists $zip(asn_file)]} {
set file [open $zip(asn_file) w]
close $file
}
if {![file exists $zip(exempt_file)]} {
set file [open $zip(exempt_file) w]
close $file
}
if {![info exists zip(current_key)]} {
set zip(current_key) 0
}
proc zip:cmd {nick host hand chan arg} {
global zip
set cmd [lindex [split $arg] 0]
set first_char [string index $cmd 0]
set type [string tolower [lindex [split $arg] 1]]
if {[lsearch $zip(first_char) $first_char] > -1} {
set cmd [string range $cmd 1 end]
switch [string tolower $cmd] {
pro {
if {[string equal -nocase $type "on"]} {
channel set $chan +zip
putserv "PRIVMSG $chan :\00314Mbrotja Eshte \00303ON."
} elseif {[string equal -nocase $type "off"]} {
channel set $chan -zip
putserv "PRIVMSG $chan :\00314Mbrotja Eshte\00304 OFF."
} else {
putserv "PRIVMSG $chan :perdor ${first_char}pro <on>/<off>"
}
return
}
addip {
if {$type == ""} {
putserv "PRIVMSG $chan :Perdor ${first_char}addip <ip> (mund te perdoresh dhe * ? wildcards)"
return
}
set exists [zip:exempt_check $type]
if {$exists == 1} {
putserv "PRIVMSG $chan :\00314Exempt\00304 $type \00314ekziston ne List."
} else {
set file [open $zip(exempt_file) a]
puts $file $type
close $file
putserv "PRIVMSG $chan :\00314Exempt\00304 $type \00314U Shtua."
}
}
delip {
set exists [zip:exempt_check $type]
if {$exists == 0} {
putserv "PRIVMSG $chan :\00314Exempt\00304 $type \00314Nuk Ekzsiton."
return
}
zip:ip_del $type
putserv "PRIVMSG $chan :\00314Exempt\00304 $type \00314U Fshi."
}
addasn {
if {[regexp -nocase {^(AS)(.*)} $type]} {
set type [string map {"as" ""} $type]
}
if {![regexp {^[0-9]+$} $type]} {
putserv "PRIVMSG $chan :I\00314nvalid \00304ASN \00314e gabuar."
return
}
set exists [zip:asn_check $type]
if {$exists == 1} {
putserv "PRIVMSG $chan :\00314ASN\00304 $type \00314Ekzsiton ne List."
} else {
set file [open $zip(asn_file) a]
puts $file $type
close $file
putserv "PRIVMSG $chan :\00314ASN\00304 $type U\00314 Shtua."
}
}
delasn {
if {[regexp -nocase {^(AS)(.*)} $type]} {
set type [string map {"as" ""} $type]
}
if {![regexp {^[0-9]+$} $type]} {
putserv "PRIVMSG $chan :\00314Invalid\00304 ASN \00314e gabuar."
return
}
set exists [zip:asn_check $type]
if {$exists == 0} {
putserv "PRIVMSG $chan :\00314ASN\00304 $type \00314Nuk Ekziston."
return
}
zip:asn_del $type
putserv "PRIVMSG $chan :\00314ASN\00304 $type \00314U Fshi."
}
ip {
if {$type == ""} {
putserv "PRIVMSG $chan :\00314Perdor\00303 ${first_char}ip \00304<\00314ip\00304>\00314/\00304<\00314host\00304>\00314/\00304<\00314nick\00304> \00304(\00314Mund perdoresh dhe \00304* ? \00314wildcards\00304)"
return
}
if {![regexp {[.]} $type]} {
putserv "USERHOST :$type"
set ::zipchan $chan
set ::zipnick $type
bind RAW - 302 zip:nick_raw
return
} else {
zip:ip_cmd $nick $chan $type
return
}
}
default {
return 0
}
}
}
}
###
proc zip:getdns {ip} {
global zip
set ipv4 ""
set ipv6 ""
set gethost [catch {exec host $ip 2>/dev/null} results]
set res [lrange [split $results] 0 end]
set inc 0
set llength [llength $res]
for {set i 0} { $i <= $llength} { incr i } {
set word [lindex $res $i]
if {[string match -nocase "IPv6" $word]} {
lappend ipv6 [join [lindex $res [expr $i + 2]]]
}
if {[string match -nocase "*address*" $word] && ![string match -nocase "IPv6" [lindex $res [expr $i - 1]]]} {
lappend ipv4 [join [lindex $res [expr $i + 1]]]
}
}
if {$ipv4 == "" && $ipv6 == ""} {
return 0
}
return [list $ipv4 $ipv6]
}
###
proc zip:nick_raw { from keyword arguments } {
global zip
set chan $::zipchan
set zip_nick $::zipnick
set hosts [lindex [split $arguments] 1]
set hostname [lindex [split $hosts "="] 1]
regsub {^[-+]} $hostname "" mask
set nickname [lindex [split $hosts "="] 0]
regsub {^:} $nickname "" nick
set mask [lindex [split $mask @] 1]
if {$nick == ""} {
putserv "PRIVMSG $chan :\00304$zip_nick \00314Nuk Eshte Online."
unbind RAW - 302 zip:nick_raw
unset ::zipchan
unset ::zipnick
return 0
}
zip:ip_cmd $nick $chan $mask
unset ::zipchan
unset ::zipnick
unbind RAW - 302 zip:nick_raw
}
proc zip:ip_cmd {nick chan ip} {
global zip
set check_ipv4 [regexp {^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $ip]
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} $ip]
if {$check_ipv4 == 0 && $check_ipv6 == 0} {
set dns_hostname [zip:getdns $ip]
if {$dns_hostname == 0} {
putserv "PRIVMSG $chan :\00314Invalid host ose ip specifikuar."
return
}
set ipv4 [lindex $dns_hostname 0]
set ipv6 [lindex $dns_hostname 1]
if {$ipv4 != ""} {
set ip [lindex $ipv4 0]
} elseif {$ipv6 != ""} {
set ip [lindex $ipv6 0]
}
}
set key [lindex $zip(api_key) $zip(current_key)]
if {$key == ""} {
set zip(current_key) 0
set key [lindex $zip(api_key) $zip(current_key)]
}
set data [zip:data $ip $key]
if {[string match -nocase "*Invalid IPv4 address, IPv6 address or hostname*" $data]} {
putserv "PRIVMSG $chan :\00314Invalid host ose ip specifikuar."
return
}
set asn ""
set success ""
regexp -nocase {"success":(.+)} $data -> success
regsub -all {,(.*)} $success "" success
if {$success == false} {
putserv "PRIVMSG $chan :\00314Ky API KEY ka probleme, kalojm tek tjetru, dhe provo serish me komanden."
incr zip(current_key)
return
}
regexp -nocase {"ASN":(.+)} $data -> asn
regsub -all {,(.*)} $asn "" asn
set get_data [zip:data:get $data]
set country_code [lindex $get_data 0]
set region [lindex $get_data 1]
set vpn_status [lindex $get_data 2]
set tor_status [lindex $get_data 3]
set proxy_status [lindex $get_data 4]
set city [lindex $get_data 5]
set organization [lindex $get_data 6]
set recent_abuse [lindex $get_data 7]
set mobile [lindex $get_data 8]
set fraud_score [lindex $get_data 9]
set isp [lindex $get_data 10]
set is_crawler [lindex $get_data 11]
set timezone [lindex $get_data 12]
set tor [lindex $get_data 13]
set bot_status [lindex $get_data 14]
set host [lindex $get_data 15]
set vpn [lindex $get_data 16]
putserv "PRIVMSG $chan :\00304INFO \002\00303[format %c 9755]\002 \00304IP\00306:\00314 $ip \00306[format %c 9679] \00304Region\00306:\00314 $region \00306[format %c 9679] \00304Code\00306:\00314 $country_code \00306[format %c 9679] \00304ISP\00306:\00314 $isp \00306[format %c 9679] \00304ASN\00306:\00314 $asn \00306[format %c 9679] \00304ORG\00306:\00314 $organization \00306[format %c 9679] \00304Is_Crawler\00306:\00314 $is_crawler \00306[format %c 9679] \00304Host\00306:\00314 $host \00306[format %c 9679] \00304Score\00306:\00314 $fraud_score"
putserv "PRIVMSG $chan :\00304INFO \002\00303[format %c 9755]\002 \00304IP\00306:\00314 $ip \00306[format %c 9679] \00304TimeZone\00306:\00314 $timezone \00306[format %c 9679] \00304TEL.\00306:\00314 $mobile \00306[format %c 9679] \00304Proxy\00306:\00314 $proxy_status \00306[format %c 9679] \00304VPN\00306:\00314 $vpn \00306[format %c 9679] \00304TOR\00306:\00314 $tor \00306[format %c 9679] \00304Active_vpn\00306:\00314 $vpn_status \00306[format %c 9679] \00304Active_TOR\00306:\00314 $tor_status \00306[format %c 9679] \00304Recent_Abuse\00306:\00314 $recent_abuse \00306[format %c 9679] \00304Bot_Status\00306:\00314 $bot_status "
}
proc zip:var_reset {} {
global zip
if {[info exists zip(already_checked)]} {
unset zip(already_checked)
}
}
proc zip:data {ip key} {
global zip
set link "https://ipqualityscore.com/api/json/ip/$key/${ip}?strictness=2&fast=1"
http::register https 443 [list ::tls::socket -autoservername true]
set ipq [http::config -useragent "lynx"]
set ipq [::http::geturl "$link" -timeout 10000]
set data [http::data $ipq]
::http::cleanup $ipq
return $data
}
proc zip:join_scan {nick host hand chan} {
global zip
if {[channel get $chan zip]} {
if {[isbotnick $nick]} {return}
if {[validuser $hand]} {return}
if {$nick == "X"} {return}
putserv "USERHOST :$nick"
bind RAW - 302 zip:join_raw
}
}
###
proc zip:join_raw { from keyword arguments } {
global zip
set hosts [lindex [split $arguments] 1]
set hostname [lindex [split $hosts "="] 1]
regsub {^[-+]} $hostname "" mask
set nickname [lindex [split $hosts "="] 0]
regsub {^:} $nickname "" nick
set mask [lindex [split $mask @] 1]
if {$nick == ""} {
unbind RAW - 302 zip:join_raw
return 0
}
set check_ipv4 [regexp {^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$} $mask]
set check_ipv6 [regexp {^([0-9A-Fa-f]{0,4}:){2,7}([0-9A-Fa-f]{1,4}$|((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4})$} $mask]
if {$check_ipv4 == 0 && $check_ipv6 == 0} {
set dns_hostname [zip:getdns $mask]
if {$dns_hostname == 0} {
return
}
set ipv4 [lindex $dns_hostname 0]
set ipv6 [lindex $dns_hostname 1]
if {$ipv4 != ""} {
set mask [lindex $ipv4 0]
} elseif {$ipv6 != ""} {
set mask [lindex $ipv6 0]
}
}
zip:data:abuse $mask $nick
}
proc zip:data:abuse {ip nick} {
global zip
if {[info exists zip(no_key_available)]} {
return "-1"
}
set check_checked [zip:checked $ip]
if {$check_checked == 1} {
zip:already_checked $ip
return
}
set check_exempt [zip:exempt_check $ip]
if {$check_exempt == 1} {
zip:already_checked $ip
return
}
if {![info exists zip(key_tries)]} {
set zip(key_tries) 0
}
set key [lindex $zip(api_key) $zip(current_key)]
if {$key == ""} {
set zip(current_key) 0
set key [lindex $zip(api_key) $zip(current_key)]
}
set data [zip:data $ip $key]
set vpn_status "false"
set tor_status "false"
set proxy_status "false"
set asn ""
set country_code ""
set region ""
set success ""
regexp -nocase {"success":(.+)} $data -> success
regsub -all {,(.*)} $success "" success
if {$success == false && ![string match -nocase "*Invalid IPv4 address, IPv6 address or hostname*" $data]} {
putlog "Zline TCL -- $key has issues"
incr zip(current_key)
incr zip(key_tries)
if {$zip(key_tries) > [llength $zip(api_key)]} {
putlog "Zline TCL -- Api Key te gjitha kane problem, Ndaluan Se Punuari."
set zip(no_key_available) 1
}
}
regexp -nocase {"ASN":(.+)} $data -> asn
regsub -all {,(.*)} $asn "" asn
set asn_check [zip:asn_check $asn]
set get_data [zip:data:get $data]
set country_code [lindex $get_data 0]
set region [lindex $get_data 1]
set vpn_status [lindex $get_data 2]
set tor_status [lindex $get_data 3]
set proxy_status [lindex $get_data 4]
set city [lindex $get_data 5]
set organization [lindex $get_data 6]
set recent_abuse [lindex $get_data 7]
set mobile [lindex $get_data 8]
set fraud_score [lindex $get_data 9]
if {$asn_check == 1} {
putnow "GZLINE *@$ip +1h \00304Proxy\00314/\00304VPN \00314nga\00304 $region $country_code"
putserv "PRIVMSG $zip(report_chan) :\002\00304 \00314VPN \00304[format %c 9755]\002 \00314$nick \00306[format %c 9679] \00304Ip: $ip \00306[format %c 9679] \00304Region: $region \00306[format %c 9679] \00304City\00306:\00314 $city \00306[format %c 9679] \00304Code\00306:\00314 $country_code \00306[format %c 9679] \00304ASN\00306:\00314 $asn \00306[format %c 9679] \00304ORG\00306:\00314 $organization \00306[format %c 9679] \00304Proxy\00306:\00314 $proxy_status \00306[format %c 9679] \00304TEL.\00306\00306:\00314 $mobile \00306[format %c 9679] \00304Recent Abuse\00306:\00314 $recent_abuse \00306[format %c 9679] \00304Score\00306:\00314 $fraud_score"
zip:already_checked $ip
return
}
if {$vpn_status == "false" && $tor_status == "false" && $proxy_status == "false"} {
zip:already_checked $ip
return 0
} else {
zip:already_checked $ip
if {$proxy_status == true} {
putserv "PRIVMSG $zip(report_chan) : \002\00304 \00314Proxy \00304[format %c 9755]\002 \00314$nick \00306[format %c 9679] \00304Ip\00306:\00314 $ip \00306[format %c 9679] \00304Region\00306:\00314 $region \00306[format %c 9679] \00304City\00306:\00314 $city \00306[format %c 9679] \00304Code\00306: \00314$country_code \00306[format %c 9679] \00304ASN\00306:\00314 $asn \00306[format %c 9679] \00304ORG\00306:\00314 $organization \00306[format %c 9679] \00304Proxy\00306:\00314 $proxy_status \00306[format %c 9679] \00304TEL.\00306\00306:\00314 $mobile \00306[format %c 9679] \00304Recent Abuse\00306:\00314 $recent_abuse \00306[format %c 9679] \00304Score\00306:\00314 $fraud_score"
##putnow "GZLINE *@$ip +1h \00304Proxy \00314nga\00304 $region $country_code"
} elseif {$vpn_status == true} {
putserv "PRIVMSG $zip(report_chan) : \002\00304 \00314Proxy\00304/\00314VPN \00304[format %c 9755]\002 \00314$nick \00306[format %c 9679] \00304Ip\00306:\00314 $ip \00306[format %c 9679] \00304Region\00306:\00314 $region \00306[format %c 9679] \00304City\00306:\00314 $city \00306[format %c 9679] \00304Code\00306:\00314 $country_code \00306[format %c 9679] \00304ASN\00306:\00314 $asn \00306[format %c 9679] \00304ORG\00306:\00314 $organization \00306[format %c 9679] \00304VPN\00306:\00314 $vpn_status \00306[format %c 9679] \00304TEL.\00306\00306:\00314 $mobile \00306[format %c 9679] \00304Recent Abuse\00306:\00314 $recent_abuse \00306[format %c 9679] \00304Score\00306:\00314 $fraud_score"
##putnow "GZLINE *@$ip +1h \00304VPN nga\00304 $region $country_code"
} else {
#putserv "PRIVMSG $zip(report_chan) : \002\00304 \00314Proxy\00304/\00314TOR \00304[format %c 9755]\002 \00314$nick \00306[format %c 9679] \00304Ip\00306:\00314 $ip \00306[format %c 9679] \00304Region\00306:\00314 $region \00306[format %c 9679] \00304City\00306:\00314 $city \00306[format %c 9679] \00304Code\00306:\00314 $country_code \00306[format %c 9679] \00304ASN\00306: $asn \00306[format %c 9679] \00304ORG\00306:\00314 $organization \00306[format %c 9679] \00304TOR\00306:\00314 $tor_status \00306[format %c 9679] \00304TEL.\00306\00306:\00314 $mobile \00306[format %c 9679] \00304Recent Abuse\00306:\00314 $recent_abuse \00306[format %c 9679] \00304Score\00306:\00314 $fraud_score"
#putnow "GZLINE *@$ip +1h \00304TOR \00314nga\00304 $region $country_code"
}
}
return 0
}
proc zip:data:get {data} {
global zip
set country_code ""
set region ""
set vpn_status ""
set tor_status ""
set proxy_status ""
set city ""
set organization ""
set recent_abuse ""
set mobile ""
set fraud_score ""
set isp ""
set is_crawler ""
set timezone ""
set tor ""
set bot_status ""
set host ""
set vpn ""
regexp {"country_code":(.+)} $data -> country_code
regsub -all {,(.*)} $country_code "" country_code
regexp {"region":(.*)} $data -> region
regsub -all {,(.*)} $region "" region
regexp {"active_vpn":(.+)} $data -> vpn_status
regsub -all {,(.*)} $vpn_status "" vpn_status
regexp {"active_tor":(.+)} $data -> tor_status
regsub -all {,(.*)} $tor_status "" tor_status
regexp {"proxy":(.+)} $data -> proxy_status
regsub -all {,(.*)} $proxy_status "" proxy_status
regexp {"city":(.+)} $data -> city
regsub -all {,(.*)} $city "" city
regexp {"organization":(.+)} $data -> organization
regsub -all {,(.*)} $organization "" organization
regexp {"recent_abuse":(.+)} $data -> recent_abuse
regsub -all {,(.*)} $recent_abuse "" recent_abuse
regexp {"mobile":(.+)} $data -> mobile
regsub -all {,(.*)} $mobile "" mobile
regexp {"fraud_score":(.+)} $data -> fraud_score
regsub -all {,(.*)} $fraud_score "" fraud_score
regexp {"ISP":(.+)} $data -> isp
regsub -all {,(.*)} $isp "" isp
regexp {"is_crawler":(.+)} $data -> is_crawler
regsub -all {,(.*)} $is_crawler "" is_crawler
regexp {"timezone":(.+)} $data -> timezone
regsub -all {,(.*)} $timezone "" timezone
regexp {"tor":(.+)} $data -> tor
regsub -all {,(.*)} $tor "" tor
regexp {"bot_status":(.+)} $data -> bot_status
regsub -all {,(.*)} $bot_status "" bot_status
regexp {"host":(.+)} $data -> host
regsub -all {,(.*)} $host "" host
regexp {"vpn":(.+)} $data -> vpn
regsub -all {,(.*)} $vpn "" vpn
return [list $country_code $region $vpn_status $tor_status $proxy_status $city $organization $recent_abuse $mobile $fraud_score $isp $is_crawler $timezone $tor $bot_status $host $vpn]
}
proc zip:asn_check {asn} {
global zip
set file [open $zip(asn_file) r]
set read [read -nonewline $file]
close $file
set split_read [split $read "\n"]
if {[lsearch -nocase $split_read $asn] > -1} {
return 1
}
return 0
}
proc zip:asn_del {asn} {
global zip
set file [open $zip(asn_file) r]
set read [read -nonewline $file]
close $file
set split_read [split $read "\n"]
set timestamp [clock format [clock seconds] -format {%Y%m%d%H%M%S}]
set temp "${zip(asn_file)}.$timestamp"
set tempwrite [open $temp w]
foreach line $split_read {
if {[string equal -nocase $asn $line]} {
continue
} else {
puts $tempwrite $line
}
}
close $tempwrite
file rename -force $temp $zip(asn_file)
}
proc zip:ip_del {ip} {
global zip
set file [open $zip(exempt_file) r]
set read [read -nonewline $file]
close $file
set split_read [split $read "\n"]
set timestamp [clock format [clock seconds] -format {%Y%m%d%H%M%S}]
set temp "${zip(exempt_file)}.$timestamp"
set tempwrite [open $temp w]
foreach line $split_read {
if {[string equal -nocase $ip $line]} {
continue
} else {
puts $tempwrite $line
}
}
close $tempwrite
file rename -force $temp $zip(exempt_file)
}
proc zip:exempt_check {ip} {
global zip
set file [open $zip(exempt_file) r]
set read [read -nonewline $file]
close $file
set found_it 0
set split_read [split $read "\n"]
foreach line $split_read {
if {[string match -nocase $line $ip]} {
set found_it 1
break
}
}
return $found_it
}
###
proc zip:checked {ip} {
global zip
if {![info exists zip(already_checked)]} {
return 0
} else {
if {[lsearch -nocase $zip(already_checked) $ip] > -1} {
return 1
} else {
return 0
}
}
}
###
proc zip:already_checked {ip} {
global zip
if {![info exists zip(already_checked)]} {
lappend zip(already_checked) $ip
return 0
} else {
if {[lsearch -nocase $zip(already_checked) $ip] > -1} {
return 1
} else {
lappend zip(already_checked) $ip
return 0
}
}
}
putlog "\002\00304GZline IP On Join -\00303 Loaded\002"