View previous topic :: View next topic |
Author |
Message |
AdmiraL Voice

Joined: 21 Feb 2021 Posts: 15 Location: Germany
|
Posted: Sat Apr 09, 2022 10:42 am Post subject: Disconnect User - Check IP |
|
|
Hello all..
I need a little help.
I use at the moment Unreal3.2 and i need this script to make correct..
i now what is problem, but i can't solved.
when a user make exit(disconnect) show me on the status this:
* 16:37 -hub.*- *** Notice -- Client exiting at mibbit.*.net: lina!Mibbit@185.179.31.20 (U largua nga *.net)
I have make with bold what is the problem!
Code: | package require http
package require json
set ExpiChan "#services"
bind raw - NOTICE Clienti
proc Clienti {from key arg} {
if {[string match *!*@* $from] || ![string match -nocase "*Client exiting*" $arg]} { return }
[b] if {[scan $arg %\[^\:\]\:%\[^(\](%\[^@\]@%\[^\)\] _ nick ident host] == "4"} {
[/b] set token [http::geturl http://ip-api.com/json/$host?fields=status,message,country,countryCode,region,continent,continentCode,regionName,city,zip,lat,lon,timezone,district,isp,org,as,asname,reverse,mobile,proxy,hosting,query]
set data [json::json2dict [http::data $token]]
::http::cleanup $token
#if {[dict get $data status] eq "success"} {
puthelp "PRIVMSG $::ExpChan 5[regsub -all {([^:]+:)} $nick ""]- 4EXIT: 3IP14: [dict get $data query] - 3Shteti14: [dict get $data country] - 3Qyteti14: [dict get $data city] - 3Mobile4: [dict get $data mobile] - 3Proxy4: [dict get $data proxy]"
} else {
putcmdlog "Error! it fails to get data for this $host"
}
}
return 0
}
|
|
|
Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 831 Location: Tennessee, USA
|
Posted: Sat Apr 09, 2022 2:36 pm Post subject: |
|
|
I have never used [scan] before, but will follow your lead from above.
And assuming that the string in $arg is as you stated above... Quote: | * 16:37 -hub.*- *** Notice -- Client exiting at mibbit.*.net: lina!Mibbit@185.179.31.20 (U largua nga *.net) |
I might use something like this. Code: |
if {[scan $arg {%[^:]:%[^:]: %[^!]!%[^@]@%[^ ]} 1 2 nick ident host] == "5"} { |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
Back to top |
|
 |
AdmiraL Voice

Joined: 21 Feb 2021 Posts: 15 Location: Germany
|
Posted: Sun Apr 10, 2022 6:10 am Post subject: |
|
|
SpiKe^^ wrote: | I have never used [scan] before, but will follow your lead from above.
And assuming that the string in $arg is as you stated above... Quote: | * 16:37 -hub.*- *** Notice -- Client exiting at mibbit.*.net: lina!Mibbit@185.179.31.20 (U largua nga *.net) |
I might use something like this. Code: |
if {[scan $arg {%[^:]:%[^:]: %[^!]!%[^@]@%[^ ]} 1 2 nick ident host] == "5"} { |
|
Hello Spike.
No its not correct..
i have two code, one its for connect and one its for disconnect.
When i was on Unrealircd5 its was correct and now am on Unreal3.2 and connect its correct and its okay.. disconnect make me problem..
I Will paste connect and disconnect and u see what i mean..
------------
When a user connected
* 12:01 -hub.*- *** Notice -- Client connecting at mibbit.*: Emri8 (Mibbit@37.201.194.29)
show me on the channel #services
Emri8 - IP: 37.201.194.29 - Shteti: Germany - Qyteti: Langen - Mobile: false - Proxy: false
Code: | package require http
package require json
set ExpChan "#services"
bind raw - NOTICE Client
proc Client {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,message,country,countryCode,region,continent,continentCode,regionName,city,zip,lat,lon,timezone,district,isp,org,as,asname,reverse,mobile,proxy,hosting,query]
set data [json::json2dict [http::data $token]]
::http::cleanup $token
#if {[dict get $data status] eq "success"} { return }
puthelp "PRIVMSG $::ExpChan 5[regsub -all {([^:]+:)} $nick ""]- 3IP14: [dict get $data query] - 3Shteti14: [dict get $data country] - 3Qyteti14: [dict get $data city] - 3Mobile4: [dict get $data mobile] - 3Proxy4: [dict get $data proxy]"
} else {
putcmdlog "Error! it fails to get data for this $host"
}
}
return 0
} |
And when a user make disconnect(exit) Server notices show me
* 12:03 -hub.*- *** Notice -- Client exiting at mibbit.*: Njanich!Mibbit@194.230.144.53 (Client exited)
Code: | #######################
package require http
package require json
set ExpiChan "#services"
bind raw - NOTICE Clienti
proc Clienti {from key arg} {
if {[string match *@* $from] || ![string match -nocase "*Client exiting*" $arg]} { return }
if {[scan $arg {%[^:]:%[^:]: %[^!]!%[^@]@%[^ ]} 1 2 nick ident host] == "5"} {
set token [http::geturl http://ip-api.com/json/$host?fields=status,message,country,countryCode,region,continent,continentCode,regionName,city,zip,lat,lon,timezone,district,isp,org,as,asname,reverse,mobile,proxy,hosting,query]
set data [json::json2dict [http::data $token]]
::http::cleanup $token
#if {[dict get $data status] eq "success"} {
puthelp "PRIVMSG $::ExpChan 5[regsub -all {([^:]+:)} $nick ""]- 3DUL IP14: [dict get $data query] - 3Shteti14: [dict get $data country] - 3Qyteti14: [dict get $data city] - 3Mobile4: [dict get $data mobile] - 3Proxy4: [dict get $data proxy]"
} else {
putcmdlog "Error! it fails to get data for this $host"
}
}
return 0
} |
The reason why i will have this tcl code because to me are active 300+ users online and i i have make module DNS and ConnectServ (unload) delete because i want to have all what we are on server PRIVACY on our life..
* 12:04 * Joins: Kushtrimi (Mibbit@8D5FB041.BFFCBA9F.6072C6B2.IP)
* 12:04 * Joins: Ela_ (Mibbit@4C9BFBB1.65F8D88D.24FA5EED.IP)
* 12:04 * Joins: Tonita (Mibbit@9C39A8B3.37AB3C75.89F8A913.IP)
* 12:04 * Joins: Rrezjaa (Mibbit@32710816.C7DCAFFC.4ADB31B1.IP) |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Sun Apr 10, 2022 9:19 am Post subject: |
|
|
it seems you are using an old no longer supported version of UnrealIRCD
in the new version i believe they have a module printing that out with server notice the geoip info and such
im not running UnrealIRCD myselve but am running InspIRCd else i could have tested it but if u let me know we could test it out on your network if you like |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Sun Apr 10, 2022 9:51 am Post subject: |
|
|
un tested yet but you could try this:
Code: |
proc Clienti {from key arg} {
package require http
package require json
set ExpiChan "#services"
bind raw - NOTICE Clienti
proc Clienti {from keyword text} {
if {[string match -nocase "*client exiting*" $text]} {
set nick [lindex [split $text] 6]
set hostt [lindex [split $text] 7]
set host [join [lrange [split $hostt @] 1 end]]
set token [http::geturl http://ip-api.com/json/$host?fields=status,message,country,countryCode,region,continent,continentCode,regionName,city,zip,lat,lon,timezone,district,isp,org,as,asname,reverse,mobile,proxy,hosting,query]
set data [json::json2dict [http::data $token]]
::http::cleanup $token
if {[dict get $data status] eq "success"} {
puthelp "PRIVMSG $::ExpChan 5[regsub -all {([^:]+:)} $nick ""]- 4EXIT: 3IP14: [dict get $data query] - 3Shteti14: [dict get $data country] - 3Qyteti14: [dict get $data city] - 3Mobile4: [dict get $data mobile] - 3Proxy4: [dict get $data proxy]"
} else {
putcmdlog "Error! it fails to get data for this $host"
}
}
}
|
i took the examples at : http://forum.egghelp.org/viewtopic.php?p=102856 |
|
Back to top |
|
 |
AdmiraL Voice

Joined: 21 Feb 2021 Posts: 15 Location: Germany
|
Posted: Sun Apr 10, 2022 11:18 am Post subject: |
|
|
simo wrote: | it seems you are using an old no longer supported version of UnrealIRCD
in the new version i believe they have a module printing that out with server notice the geoip info and such
im not running UnrealIRCD myselve but am running InspIRCd else i could have tested it but if u let me know we could test it out on your network if you like |
I have tested and its the same.. i dont know why!
the problem its here:
Client exiting at mibbit.*: Njanich!Mibbit@194.230.144.53
when the client connected show this message:
Client connecting at mibbit.*: Gimi (Mibbit@87.238.213.218)
With connect its okay with exiting make problem!
yes we can tested together when you have time.. |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Sun Apr 10, 2022 12:32 pm Post subject: |
|
|
Ive sent you a pm for test credentials |
|
Back to top |
|
 |
simo Revered One
Joined: 22 Mar 2015 Posts: 1051
|
Posted: Mon Apr 11, 2022 1:56 pm Post subject: |
|
|
in conclusion after testing on server of AdmiraL we found this to work well incase others need it
keep in mind this is for unrealircd 3.2 its not recommended to use old EOL ircd versions tho
Code: |
package require http
package require json
set ExpiChan "#services"
bind raw - NOTICE Clienti
proc Clienti {from keyword text} {
if {[string match -nocase "*client exiting*" $text]} {
if {[scan $text {%[^:]:%[^:]: %[^!]!%[^@]@%[^ ]} 1 2 nick ident host] == "5"} {
set token [http::geturl http://ip-api.com/json/$host?fields=status,message,country,countryCode,region,continent,continentCode,regionName,city,zip,lat,lon,timezone,district,isp,org,as,asname,reverse,mobile,proxy,hosting,query]
set data [json::json2dict [http::data $token]]
::http::cleanup $token
if {[dict get $data status] eq "success"} {
puthelp "PRIVMSG $::ExpChan 5$nick 4EXIT: 3IP14: [dict get $data query] - 3Shteti14: [dict get $data country] - 3Qyteti14: [dict get $data city] - 3Mobile4: [dict get $data mobile] - 3Proxy4: [dict get $data proxy]"
} else {
putcmdlog "Error! it fails to get data for this $host"
}
}
}
}
|
|
|
Back to top |
|
 |
|
|
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
|
|