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 

scan ip from a proxy scanner site
Goto page Previous  1, 2, 3, 4
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1108
Location: France

PostPosted: Sun Dec 25, 2022 8:47 am    Post subject: Reply with quote

Check https://tools.eggdrop.fr/privatebin/?400cf8cc0c7532e4#3iH1HymTobmUfcxrFr6wcBUa4sBsAhs9nt5DxPazBmet

I've added wlcountries variable, which is a list of countries code (I put NP for Nepal and FR for France, you can add more), modified the http query to add the countryCode in the answer and added a check to bypass the iplog proc if the IP come from one of the white-listed countries.
_________________
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
TimeRider
Voice


Joined: 07 Jul 2020
Posts: 27

PostPosted: Sun Dec 25, 2022 10:21 am    Post subject: Reply with quote

Thank you CrazyCat! The script is working as expected. Smile
_________________
Online chat
Nepal chat
Pakistan chat
Indian chat
Back to top
View user's profile Send private message Visit poster's website
TimeRider
Voice


Joined: 07 Jul 2020
Posts: 27

PostPosted: Fri Jan 13, 2023 9:08 pm    Post subject: Reply with quote

Hello CrazyCat,

I am bumping this thread because I want to make 2 Anti-VPN TCL script work as it will be helpful to ban the connection one VPN scanner can't detect and the limit of scanning will be increased from 2 Anti-VPN TCL scripts.

The one you already made works well, https://tools.eggdrop.fr/privatebin/?400cf8cc0c7532e4#3iH1HymTobmUfcxrFr6wcBUa4sBsAhs9nt5DxPazBmet

What I want now is a new same TCL script where I would use a different bind like !antiproxy or .antiproxy And it will scan the IPs from proxycheck.io with the API key But will also add exception scans or will not scan IPs of the country Nepal (NP).

Thank you!
_________________
Online chat
Nepal chat
Pakistan chat
Indian chat
Back to top
View user's profile Send private message Visit poster's website
TimeRider
Voice


Joined: 07 Jul 2020
Posts: 27

PostPosted: Sat Feb 18, 2023 9:28 pm    Post subject: Reply with quote

CrazyCat wrote:
Not tested (the write/read file come from another of my scripts):

Code:
package require http

namespace eval pchecker {

   # proxycheck.io api key
   variable pckey "xxxxxx-xxxxxx-xxxxxx-xxxxxxxx"

   # gzline message
   variable gmsg "Sorry, VPN are not allowed"

   # List of IP not checked
   variable whitelist {}

   # List of blacklisted IP
   variable blacklist {}
   
   variable pcheckerwl "scripts/pcheckerwl.txt"

   # To enable on a chan, think to do
   # .chanset #chan +scanip
   setudef flag scanip

   bind join - * ::pchecker::whois
   bind raw - 378 ::pchecker::ipcheck
   bind pub - !add ::pchecker::ipadd
   bind pub - !rem ::pchecker::iprem

   proc whois {nick uhost handle chan} {
      if {![channel get $chan scanip]} { return }
      if {[isbotnick $nick]} { return }
      putquick "WHOIS $nick"
   }

   proc ipadd {nick uhost handle chan text} {
      if {[lsearch $::pchecker::whitelist $text] == -1} {
         lappend ::pchecker::whitelist $text
      }
      ::pchecker::l2file $::pchecker::whitelist $::pchecker::pcheckerwl
   }
   
   proc iprem {nick uhost handle chan text} {
      set n [lsearch $::pchecker::whitelist $text]
      if {$n != -1} {
         set ::pchecker::whitelist [lreplace $::pchecker::whitelist $n $n]
         ::pchecker::l2file $::pchecker::whitelist $::pchecker::pcheckerwl
      }
   }
   
   proc ipcheck {frm key text} {
      set ip [lindex [split $text " "] end]
      foreach w $::pchecker::whitelist {
         if {[string match $w $text]} { return }
      }
      foreach b $::pchecker::blacklist {
         if {[string match $w $text]} {
            putquick "GLINE *@$ip +7d :$::pchecker::gmsg"
            return
         }
      }
      ::pchecker::isvpn $ip
   }

   proc json2dict {JSONtext} {
      string range [string trim [string trimleft [string map {\t {} \n {} \r {} , { } : { } \[ \{ \] \}} $JSONtext] {\uFEFF}]] 1 end-1
   }

   proc isvpn {ip} {
      ::http::config -useragent "lynx"
      set pcheck [::http::geturl http://api.isproxyip.com/v1/check.php?key=$::pchecker::pckey&ip=${ip}&format=json]
      set data [json2dict [::http::data $pcheck]]
      if {[dict get $data status] eq "success"} {
         set proxy [dict get $data proxy]
         if {$proxy == 1 } {
            lappend $::pchecker::blacklist $ip
            putquick "GLINE *@$ip +7d :$::pchecker::gmsg"
         }
      }
      ::http::cleanup $pcheck
   }

   proc l2file {olist dfile} {
      set fo [open $dfile w]
      puts $fo [join $olist "\n"]
      close $fo
   }
   
   proc f2list {dfile} {
      set fi [open $dfile r]
      set olist [split [read -nonewline $fi] "\n"]
      close $fi
      return $olist
   }
   
   set ::pchecker::whitelist [::pchecker::f2list $::pchecker::pcheckerwl]
   
}


CrazyCat, this script is generating an error now: Tcl error [::pchecker::ipcheck]: Illegal characters in URL path

Could you please fix it?
_________________
Online chat
Nepal chat
Pakistan chat
Indian chat
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 -> Script Requests All times are GMT - 4 Hours
Goto page Previous  1, 2, 3, 4
Page 4 of 4

 
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