| View previous topic :: View next topic |
| Author |
Message |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Fri Sep 18, 2020 6:54 pm Post subject: |
|
|
| 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
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 |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sat Sep 19, 2020 10:10 am Post subject: |
|
|
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 |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sat Sep 19, 2020 11:08 am Post subject: |
|
|
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 |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Sun Sep 20, 2020 12:03 pm Post subject: |
|
|
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 |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Sun Sep 20, 2020 3:34 pm Post subject: |
|
|
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  _________________ 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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Mon Sep 21, 2020 7:27 am Post subject: |
|
|
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
So as i understand, it's the code thats not working correct? _________________ ComputerTech |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Mon Sep 21, 2020 7:52 am Post subject: |
|
|
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 |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Sun Nov 01, 2020 3:46 pm Post subject: Hello |
|
|
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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Mon Nov 02, 2020 3:12 pm Post subject: |
|
|
Thanks Gulio! will try that right away  _________________ ComputerTech |
|
| Back to top |
|
 |
sashafire Voice
Joined: 05 Nov 2020 Posts: 1
|
Posted: Thu Nov 05, 2020 8:46 am Post subject: |
|
|
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  _________________ ---
Experience is the name everyone gives to their mistakes. |
|
| Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Fri Nov 06, 2020 12:29 am Post subject: hi |
|
|
| 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 |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Nov 06, 2020 2:07 am Post subject: |
|
|
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 |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Fri Nov 06, 2020 5:05 pm Post subject: |
|
|
There is one, Unrealircd third party module *geo-base* uses, to show the user connecting country, i will find the link for you guys , as far as i see, it has no limit *shrug*
ps, Nice new avatar caesar  _________________ ComputerTech |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Sun Nov 08, 2020 11:18 am Post subject: |
|
|
Ah, you are correct CrazyCat, but cant the geolite used in the eggdrop dir? same as unreal  _________________ ComputerTech |
|
| Back to top |
|
 |
|