| View previous topic :: View next topic |
| Author |
Message |
albozz Voice
Joined: 12 Jul 2016 Posts: 8 Location: Albania
|
Posted: Sun Aug 30, 2020 1:31 pm Post subject: raw on connect |
|
|
hello anyone help me, i want this exp:
Nick:User-nick - IP: 172.58.206.164 - Country: United States - City:Philadelphia - ISP: T-Mobile USA |
|
| Back to top |
|
 |
simo Owner
Joined: 22 Mar 2015 Posts: 941
|
Posted: Sun Aug 30, 2020 2:11 pm Post subject: |
|
|
| first you need to determine where you can get that information from and then have eggdrop retreive it and send it |
|
| Back to top |
|
 |
albozz Voice
Joined: 12 Jul 2016 Posts: 8 Location: Albania
|
Posted: Sun Aug 30, 2020 4:03 pm Post subject: |
|
|
send raw connect on user's on unrealircd on exp #opers chan who connect , nick Ip country state
example
*** Client connecting: astrit (Flash@178.132.216.199) [178.132.216.199] {0} [secure] |
|
| Back to top |
|
 |
heartbroken Op

Joined: 23 Jun 2011 Posts: 106 Location: somewhere out there
|
Posted: Sun Aug 30, 2020 4:50 pm Post subject: |
|
|
| Code: | package require http
package require json
set ExpChan "#opers"
bind raw - NOTICE Client_Connect
proc Client_Connect {from key arg} {
if {[string match *!*@* $from] || ![string match -nocase "*client connecting*" $arg]} { return }
if {[scan $arg %\[^\:\]\:%\[^(\](%\[^@\]@%\[^\)\] _ nick ident host] == "4"} {
set token [http::geturl http://ip-api.com/json/$host?fields=status,city,isp,country,query,regionName,countryCode]
set data [json::json2dict [http::data $token]]
::http::cleanup $token
if {[dict get $data status] eq "success"} {
puthelp "PRIVMSG $::ExpChan :\002Nick\002: $nick - \002IP\002: [dict get $data query] - \002Country\002: [dict get $data country] -\
\002City\002: [dict get $data city] - \002ISP\002: [dict get $data isp] [dict get $data countryCode]"
} else {
putcmdlog "Error! it fails to get data for this $host"
}
}
return 0
} |
_________________ Life iS Just a dReaM oN tHE wAy to DeaTh |
|
| Back to top |
|
 |
albozz Voice
Joined: 12 Jul 2016 Posts: 8 Location: Albania
|
Posted: Mon Aug 31, 2020 2:21 am Post subject: |
|
|
Thx for help but how to remove this:
| Quote: |
[08:17] <Rocky> Nick: *** Client connecting: tunix10 - IP: 85.25.10.40 - Country: France - City: Strasbourg - ISP: Host Europe GmbH
|
|
|
| Back to top |
|
 |
heartbroken Op

Joined: 23 Jun 2011 Posts: 106 Location: somewhere out there
|
Posted: Mon Aug 31, 2020 4:32 am Post subject: |
|
|
You could change :
| Code: | | \002Nick\002: $nick |
to
| Code: | | \002Nick\002: [regsub -all {([^:]+:)} $nick ""] |
_________________ Life iS Just a dReaM oN tHE wAy to DeaTh |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Mon Aug 31, 2020 11:59 am Post subject: |
|
|
I've exactly the same thing than heartbroken:
| Code: | % set arg {*** Client connecting: astrit (Flash@178.132.216.199) [178.132.216.199] {0} [secure]}
*** Client connecting: astrit (Flash@178.132.216.199) [178.132.216.199] {0} [secure]
% scan $arg %\[^\:\]\:%\[^(\](%\[^@\]@%\[^\)\] _ nick ident host
4
% puts "nick: $nick - ident: $ident - host: $host"
nick: astrit - ident: Flash - host: 178.132.216.199
% info patchlevel
8.6.9 |
@albozz: which version of tcl are you using ? _________________ 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: Thu Sep 17, 2020 6:33 pm Post subject: |
|
|
This script stopped working all of a sudden, json/http is loaded, and so is the script, and it just stopped working all of a sudden, anyone got a idea why?  _________________ ComputerTech |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Thu Sep 17, 2020 7:14 pm Post subject: |
|
|
Add putlog after sensible lines to see where it stops.
And first thing to check: is your eggdrop alway logged as ircop with the good snomask, does it see the connect notices ? _________________ 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: Thu Sep 17, 2020 7:57 pm Post subject: |
|
|
via partyline yeah, when a user connects, i see the ip, and general
and yes bot is currently ircop, and has the correct snomasks
Thing is, it worked perfect a few days ago, and i have Not touched the script.
Does it work for you CrazyCat? _________________ ComputerTech |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Fri Sep 18, 2020 12:55 am Post subject: |
|
|
Their API isn't working properly for some reason as i get this JSON answer:
So, you got two options:
1. contact them and ask why the free plan isn't working any more and give them the error above
2. get a PRO plan OR switch to another site
Out of curiosity, how many requests did you do on their website per minute? Give me an appreciation, don't need the exact number. I'm asking cos their TOS says you can do 45 per minute else will get yourself banned for an hour or something. _________________ 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 Sep 18, 2020 8:47 am Post subject: |
|
|
Oh, well my network is 300+ users, but i dont believe their would have been 45 connections in 60sec, i mean it's possible, like a netsplit or something,
but i highly doubt it.
I'll go for option one caesar, and contact them, hopefully they can fix it, i will also post here when/if i get it fixed, or if/they contact me back with info.
Cheers lads  _________________ ComputerTech |
|
| Back to top |
|
 |
ComputerTech Master

Joined: 22 Feb 2020 Posts: 393
|
Posted: Fri Sep 18, 2020 11:55 am Post subject: |
|
|
Ok, so they responded with this via email.
Hello,
As the error message states, you're trying to access the API via https, which has never been supported. Please switch to http.
Kind regards,
vlad
--
ip-api.com
what do we edit on the code then?
does the bot have to access the server via non ssl or something? _________________ ComputerTech |
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Fri Sep 18, 2020 1:22 pm Post subject: |
|
|
If you use the code given by heartbroken, it doesn't use https, so it must work.
And no matter if your eggdrop connects through ssl or not to your server, the http request is independant and will do what you ask it to do (so, connect to http://ip-api.com).
If you didn't change the code and it stopped working, the trouble could be somewhere else. So... putlog ! _________________ 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: Fri Sep 18, 2020 2:50 pm Post subject: |
|
|
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 _________________ ComputerTech |
|
| Back to top |
|
 |
|