This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Disconnect User - Check IP

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
AdmiraL
Voice
Posts: 15
Joined: Sun Feb 21, 2021 4:55 pm
Location: Germany
Contact:

Disconnect User - Check IP

Post by AdmiraL »

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: Select all

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
}
User avatar
SpiKe^^
Owner
Posts: 831
Joined: Fri May 12, 2006 10:20 pm
Location: Tennessee, USA
Contact:

Post by SpiKe^^ »

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...
* 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: Select all

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
.
User avatar
AdmiraL
Voice
Posts: 15
Joined: Sun Feb 21, 2021 4:55 pm
Location: Germany
Contact:

Post by AdmiraL »

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...
* 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: Select all

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: Select all

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: Select all

#######################
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)
s
simo
Revered One
Posts: 1090
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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
s
simo
Revered One
Posts: 1090
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

un tested yet but you could try this:

Code: Select all


 

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
User avatar
AdmiraL
Voice
Posts: 15
Joined: Sun Feb 21, 2021 4:55 pm
Location: Germany
Contact:

Post by AdmiraL »

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..
s
simo
Revered One
Posts: 1090
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

Ive sent you a pm for test credentials
s
simo
Revered One
Posts: 1090
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

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: Select all

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"
      }
   }
 }
}
Post Reply