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
 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
TimeRider
Voice


Joined: 07 Jul 2020
Posts: 11

PostPosted: Tue May 04, 2021 6:40 pm    Post subject: Reply with quote

Here is what I got from .set errorInfo
Quote:

Currently: invalid command name "::http::config"
Currently: while executing
Currently: "::http::config -useragent "lynx""
Currently: (procedure "::pchecker::isvpn" line 2)
Currently: invoked from within
Currently: "::pchecker::isvpn $ip"
Currently: (procedure "::pchecker::ipcheck" line 12)
Currently: invoked from within
Currently: "::pchecker::ipcheck $_raw1 $_raw2 $_raw3"

_________________
https://chatsansar.com - Nepal IRC Network
https://sabchat.com - India IRC Chat
Back to top
View user's profile Send private message Visit poster's website
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 859
Location: France

PostPosted: Wed May 05, 2021 2:03 am    Post subject: Reply with quote

LOL ! I forget to include the packages Smile

The source is now up2date Smile
_________________
https://www.eggdrop.fr
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: 11

PostPosted: Wed May 05, 2021 8:29 am    Post subject: Reply with quote

CrazyCat, I think you are still missing something; a variable I guess.

Quote:
Tcl error [::pchecker::ipcheck]: can't read "ip": no such variable

Currently: can't read "ip": no such variable
Currently: while executing
Currently: "lsearch -regexp $::pchecker::whitelist $ip"
Currently: (procedure "::pchecker::ipcheck" line 4)
Currently: invoked from within
Currently: "::pchecker::ipcheck $_raw1 $_raw2 $_raw3"


And, I think the script is good to go!
_________________
https://chatsansar.com - Nepal IRC Network
https://sabchat.com - India IRC Chat
Back to top
View user's profile Send private message Visit poster's website
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 859
Location: France

PostPosted: Wed May 05, 2021 9:13 am    Post subject: Reply with quote

This error occures because of the regexp, it seems to not find the IP in the connexion notice.
Can you edit the script and add:
Code:
putlog "STR:$text"

just under
Code:
if {[string match *!*@* $frm] || ![string match -nocase "*client connecting*" $text]} { return }

And send me by PM a few examples of the logs you'll have in party-line without changing anything.
I really need the original log to check the regexp.
_________________
https://www.eggdrop.fr
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
PeLL
Voice


Joined: 04 Mar 2011
Posts: 4
Location: spain

PostPosted: Sun Jul 18, 2021 7:39 am    Post subject: Reply with quote

Hello,
can you make it work for on join channel?
the bot is oper, that works by doing a whois or a userhost.
Thank you very much for your help .
Back to top
View user's profile Send private message Visit poster's website
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 859
Location: France

PostPosted: Sun Jul 18, 2021 9:38 am    Post subject: Reply with quote

PeLL wrote:
Hello,
can you make it work for on join channel?
the bot is oper, that works by doing a whois or a userhost.
Thank you very much for your help .


You want to check only users joining a particular channel ? And no more checking all network connections ?

When you say your bot is oper, do you mean @ on the channel or ircop ? Because the script can only work if eggdrop is ircop, as majority of networks cloaks the IP and only irco can have the real IP.
_________________
https://www.eggdrop.fr
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
PeLL
Voice


Joined: 04 Mar 2011
Posts: 4
Location: spain

PostPosted: Sun Jul 18, 2021 10:08 am    Post subject: Reply with quote

The eggdrop bot will be ircop with @.
To use in 2 or 3 channels.
when it does whois it gets the read IP, then when it is positive with your script it can gline or zline ..
The server is inspircd, you must see IP by whois.
Thank you for your answer .
Back to top
View user's profile Send private message Visit poster's website
CrazyCat
Owner


Joined: 13 Jan 2002
Posts: 859
Location: France

PostPosted: Sun Jul 18, 2021 10:37 am    Post subject: Reply with quote

Here is a version working on channel join. To enable it, do .chanset #channel +scanip in partyline.

Note that I don't check if user is on several watched channels, and I didn't test the script with InspIRCd, I guess the raw 378 is the same than on UnrealIRCd.

Code:
package require http
package require json

namespace eval pchecker {

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

   # min score to ban
   variable score 10

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

   # 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 {}

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

   bind join - * ::pchecker::whois
   bind raw - 378 ::pchecker::ipcheck

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

   proc ipcheck {frm key text} {
      set ip [lindex [split $text " "] end]
      if {[lsearch -regexp $::pchecker::whitelist $ip] ne -1} { return }
      if {[lsearch -regexp $::pchecker::blacklist $ip] ne -1} {
         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://proxycheck.io/v2/${ip}?key=$::pchecker::pckey&vpn=1&risk=1]
      set data [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
   }
}

_________________
https://www.eggdrop.fr
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
PeLL
Voice


Joined: 04 Mar 2011
Posts: 4
Location: spain

PostPosted: Sun Jul 18, 2021 11:06 am    Post subject: Reply with quote

I thank you again.
I'm testing and if it works by activating the channel without having to have @.
It is perfect for a badword, bad nick and VPN check.
Thanks for your time . Wink
Back to top
View user's profile Send private message Visit poster's website
sanyi
Voice


Joined: 29 Sep 2021
Posts: 1

PostPosted: Wed Sep 29, 2021 2:41 pm    Post subject: Reply with quote

hello,

i need a similar script that scan/checks channel join for unauthenticated users on Undernet .
If the user not logged check host/ip quality score on the link
https://ipqualityscore.com/api/json/ip/KYtN2QAGT00jxHVjNLQynDvRUBphiijZ/124.79.123.37
if found ip as proxy/vpn is true and fraud score is bigger than 85 kick/ban the user from channel.

thank you!
sanyi
Back to top
View user's profile Send private message
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
Page 2 of 2

 
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