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 

VPN Hunter

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


Joined: 04 Sep 2022
Posts: 10
Location: London

PostPosted: Mon Sep 05, 2022 12:02 am    Post subject: VPN Hunter Reply with quote

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
View user's profile Send private message Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1057
Location: France

PostPosted: Mon Sep 05, 2022 4:54 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 969

PostPosted: Mon Sep 05, 2022 5:21 am    Post subject: Reply with quote

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
View user's profile Send private message
Valentin
Voice


Joined: 04 Sep 2022
Posts: 10
Location: London

PostPosted: Mon Sep 05, 2022 10:53 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
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