View previous topic :: View next topic |
Author |
Message |
Valentin Voice
Joined: 04 Sep 2022 Posts: 14 Location: London
|
Posted: Mon Sep 05, 2022 12:02 am Post subject: VPN Hunter |
|
|
Hello, all.
I have this script, that make the bot to add gline to all vpns if is !on and show all vpns connection if is !off.
But something doesn`t work properly. The bot show me all connections in that channel, doesn`t matter are they vpn or not.
I need a help to fix it.
Code: |
package require http
package require json
namespace eval pchecker {
# proxycheck.io api key
variable pckey "xxxxx xxxxx xxxxx xxxxx"
# min score to ban
variable score 10
# gzline message
variable gmsg "VPN is not allowed at the moment!"
# List of IP not checked
# they are regexp style
variable whitelist {"192.168.0.1" "10.0.0.*"}
# List of blacklisted IP
# regexp too :)
variable blacklist {}
# Control channel
set cchan #vpn
# internal variable : status of VPN search
set onoff 0
bind raw - NOTICE ::pchecker::ipcheck
bind pub - "!on" ::pchecker::on
bind pub - "!off" ::pchecker::off
proc on {nick uhost handle chan text} {
if {$chan ne $::pchecker::cchan} { return }
if {$::pchecker::onoff == 1} {
putserv "PRIVMSG $::pchecker::cchan :\00303VPN HUNTER is tutn ON"
return
}
set ::pchecker::onoff 1
}
proc off {nick uhost handle chan text} {
if {$chan ne $::pchecker::cchan} { return }
if {$::pchecker::onoff == 0} {
putserv "PRIVMSG $::pchecker::cchan :\00304VPN HUNTER is turn OFF\003"
return
}
set ::pchecker::onoff 0
}
proc ipcheck {frm key text} {
if {[string match *!*@* $frm] || ![string match -nocase "*client connecting*" $text]} { return }
regexp {:\s.*?:\s(.*?)!(.*?)@(.*?)\s\((.*?)\)} $text - unick ident host ip
putserv "PRIVMSG $::pchecker::cchan :\00304VPN Detected\003 : \00303$unick\003 \00307is connecting with ip\003 $ip"
if {[lsearch -regexp $::pchecker::whitelist $ip] ne -1} { return }
if {[lsearch -regexp $::pchecker::blacklist $ip] ne -1} {
putquick "GLINE *@$ip 7d :$::pchecker::gmsg"
return
}
if {$::pchecker::onoff == 1 } { ::pchecker::isvpn $ip }
}
proc isvpn {ip} {
::http::config -useragent "lynx"
set pcheck [::http::geturl http://proxycheck.io/v2/${ip}?key=$::pchecker::pckey&vpn=1&risk=1]
set data [::json::json2dict [::http::data $pcheck]]
if {[dict get $data status] == "ok"} {
set proxy [dict get [dict get $data $ip] proxy]
set risk [dict get [dict get $data $ip] risk]
if {[expr $risk - $::pchecker::score] >= 0 } {
lappend $::pchecker::blacklist [string map {. \.} $ip]
putquick "GLINE *@$ip 7d :$::pchecker::gmsg"
}
}
::http::cleanup $pcheck
}
}
|
_________________ if there's a will, there's a way. |
|
Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1108 Location: France
|
Posted: Mon Sep 05, 2022 4:54 am Post subject: |
|
|
That is exactly what you asked me:
Quote: | 2022-08-29 16:03:04 Valentin so the bot is VPNSErv
2022-08-29 16:03:18 Valentin I want the same bot to show me any connection
2022-08-29 16:03:26 Valentin and if I set !on
2022-08-29 16:03:42 Valentin to add gline to every vpn connection
2022-08-29 16:04:00 Valentin but still show me who from where is connected
2022-08-29 16:04:33 CrazyCat So, if I summarize: all connections are alway showed and the gline is done only if the script is set to on ?
2022-08-29 16:05:00 CrazyCat if !off command has ben set, the connection is showed, nothing else |
_________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1027
|
Posted: Mon Sep 05, 2022 5:21 am Post subject: |
|
|
IMHO if u tackle the abuse rather than using all kinds of databases for vpn proxy and what not its rather more effiecient i assume u are running your own irc server since u opered your eggdrops IRCDs like unrealircd 6 and inspircd 3 have all kinds of modules and protections to handle almost any kind of abuse without having to set any ban or keep databases to gline vpn ranges , proxy or other.
I manage several irc networks as well and we had issues with vpn ranges too but we used a zillion modules and now abuse is of the past regardless of them using vpn ranges or proxy IP's. |
|
Back to top |
|
 |
Valentin Voice
Joined: 04 Sep 2022 Posts: 14 Location: London
|
Posted: Mon Sep 05, 2022 10:53 am Post subject: |
|
|
Hey CrazyCat, My idea been to show me ip and country from connection.
For example CrazyCat is connected with ip 1.1.1.1 from France.
May be I didn`t explaned you better. So that is what I want, and is more better if show me only vpn connections. _________________ if there's a will, there's a way. |
|
Back to top |
|
 |
|