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 

raw on connect
Goto page Previous  1, 2, 3  Next
 
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: 1032
Location: France

PostPosted: Fri Sep 18, 2020 6:54 pm    Post subject: Reply with quote

ComputerTech wrote:
Ok, but didnt caesar use heartbroken's clde as well? and got a error

but i will do that and find out whats wrong, then post here Smile

Cheers CrazyCat


caesar uses what he wants, caesar didn't said he had a trouble with this script, caesar made a test (to help you?) and throw an error.
YOU have a trouble with your script, so we are looking for an answer to YOUR trouble.

I think caesar is able to say himself if he has a trouble with a script, and he's also able to well describe it, and to find the solution. caesar has rarely trouble, he has often solutions.
_________________
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
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sat Sep 19, 2020 10:10 am    Post subject: Reply with quote

I used the link in the code with a random IP, then went on the website and tried the examples they give in the documentation page and i got the error I mentioned above. I concluded at the time it's a error on their side since I wasn't the only one that was apparently getting that error. Anyway...
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Sat Sep 19, 2020 11:08 am    Post subject: Reply with quote

Tested simply:
Code:
crazycat@raspbian:~$ curl http://ip-api.com/json/178.132.216.199?fields=status,city,isp,country,query,regionName,countryCode
{"status":"success","country":"Kosovo","countryCode":"XK","regionName":"Pristina","city":"Pristina","isp":"Kujtesa Network","query":"178.132.216.199"}

It works fine

And the examples given in https://ip-api.com/docs/api:json are all working. And all are using http, not https.
_________________
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
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Sun Sep 20, 2020 12:03 pm    Post subject: Reply with quote

Opening the link you mentioned in Firefox on Windows gives me a {status: "fail"} reply, but if where to use the same curl in Linux it works just fine, meaning getting the same result.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Sun Sep 20, 2020 3:34 pm    Post subject: Reply with quote

It works for me:


Don't you use a plugin like https everywhere which forces https in firefox ?

BTW, I alway test with curl the url used by eggdrop, browsers can create errors Smile
_________________
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
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Mon Sep 21, 2020 7:27 am    Post subject: Reply with quote

Sorry for delayed reply, been busy with farming, fixing stuff, etc.

thing i dont understand is, i litteraly havent changed anything in the bot, nor script, just one day it stopped *shrug*. So not even sure where to start tbh Confused

So as i understand, it's the code thats not working correct?
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Mon Sep 21, 2020 7:52 am    Post subject: Reply with quote

If the code worked and you didn't change it, it's correct.
So, you have to add debug lines to know what is exactly doing the script and where it's blocking.
_________________
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
Gulio
Halfop


Joined: 01 Nov 2020
Posts: 73

PostPosted: Sun Nov 01, 2020 3:46 pm    Post subject: Hello Reply with quote

Try this, u can add same every info u want to get for output msg

Code:


Connect >> Nick: X - IP: 192.184.9.108 - COUNTRY: United States - CODE: US - CITY: Los Angeles - ORG: Level 3, LLC - ASN: AS32421 Level 3 Parent, LLC - ASNAME: BLCC - REVERSE: highgate.irccloud.com - MOBILE: false - PROXY: false



Code:


package require http
package require json

set ExpChan "#Connect"

bind raw - NOTICE Client_Connect

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

proc Client_Connect {from key arg} {
   if {[string match *!*@* $from] || ![string match -nocase "*client connecting*" $arg]} { return }
   if {[scan $arg %\[^\:\]\:%\[^(\](%\[^@\]@%\[^\)\] _ nick ident host] == "4"} {
      ::http::config -useragent "lynx"
      set ipq [http::geturl http://ip-api.com/json/$host?fields=status,message,country,countryCode,city,org,as,asname,reverse,mobile,proxy,query]
      set    data                  [json2dict [http::data $ipq]]
      set    Getquery              [dict get $data query]
      set    Getcountry            [dict get $data country]
      set    GetcountryCode        [dict get $data countryCode]
      set    Getcity               [dict get $data city]
      set    Getorg                [dict get $data org]
      set    Getas                 [dict get $data as]
      set    Getasname             [dict get $data asname]
      set    Getreverse            [dict get $data reverse]
      set    Getmobile             [dict get $data mobile]
      set    Getproxy              [dict get $data proxy]
      ::http::cleanup $ipq
      if {[dict get $data status] eq "success"} {


         puthelp "PRIVMSG $::ExpChan :\0033Connected \00314>> \00310Nick\0036:\00314 [regsub -all {([^:]+:)} $nick ""]\0036- \0033IP:\00314 $Getquery \0036- \0033COUNTRY:\00314 $Getcountry \0036- \0033CODE:\00314 $GetcountryCode \0036- \0033CITY:\00314 $Getcity \0036- \0033ORG:\00314 $Getorg \0036- \0033ASN:\00314 $Getas \0036- \0033ASNAME:\00314 $Getasname \0036- \0033REVERSE:\00314 $Getreverse \0036- \0033MOBILE:\00314 $Getmobile \0036- \0033PROXY:\00314 $Getproxy "
      } else {
         putcmdlog "Error! it fails to get data for this $host"
      }
   }
   return 0
}

Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Mon Nov 02, 2020 3:12 pm    Post subject: Reply with quote

Thanks Gulio! will try that right away Very Happy
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sashafire
Voice


Joined: 05 Nov 2020
Posts: 1

PostPosted: Thu Nov 05, 2020 8:46 am    Post subject: Reply with quote

I am so glad I found this as it fixed my issue... Thanks a lot to everyone who's keeping the forum alive and merci CrazyCat for helping this. This means a lot.

Quick question, how confident are we in the location data quality for ip-api? I'm thinking about using other services like geojs.io or abstractapi.com/ip-geolocation-api but their free plans are limited Sad
_________________
---
Experience is the name everyone gives to their mistakes.
Back to top
View user's profile Send private message
Gulio
Halfop


Joined: 01 Nov 2020
Posts: 73

PostPosted: Fri Nov 06, 2020 12:29 am    Post subject: hi Reply with quote

ip-api is better from those u write above have real db and show same as what is my ip address so dont worry u can use without problem.
Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Fri Nov 06, 2020 2:07 am    Post subject: Reply with quote

Keep in mind that ip-api has a max 45 HTTP requests per minute from an IP address and the FREE service they provide isn't for commercial use, you got paid plans for that. Should consult their website.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Fri Nov 06, 2020 5:05 pm    Post subject: Reply with quote

There is one, Unrealircd third party module *geo-base* uses, to show the user connecting country, i will find the link for you guys Very Happy, as far as i see, it has no limit *shrug*

ps, Nice new avatar caesar Razz
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail Visit poster's website
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Fri Nov 06, 2020 7:12 pm    Post subject: Reply with quote

I think the unreal module use the geolite database from maxmind (must be downloaded), not an http query.
_________________
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
ComputerTech
Master


Joined: 22 Feb 2020
Posts: 393

PostPosted: Sun Nov 08, 2020 11:18 am    Post subject: Reply with quote

Ah, you are correct CrazyCat, but cant the geolite used in the eggdrop dir? same as unreal Confused
_________________
ComputerTech
Back to top
View user's profile Send private message Send e-mail 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  Next
Page 2 of 3

 
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