IP Tracker Script by Sky Walker A.K.A. Lucyfero
Checks users IP @ http://clientn.free-hideip.com/map/whatismyip.php
based on DNS query and POST method
The original IDEA was @ http://www.hawkee.com/snippet/9927/. THANKS Kaj
Use: I defined an alias i.e. --> alias F1 /dns $$1
select a nickname in the nicklist then press F1
You do not need to be OP to use the script
ScreenShot @ http://www.hawkee.com/profile/img/1212895/
; IP Tracker Script by Sky Walker A.K.A. Lucyfero
; Checks users IP @ http://clientn.free-hideip.com/map/whatismyip.php
; based on DNS query and POST method
; The original IDEA was @ http://www.hawkee.com/snippet/9927/. THANKS Kaj
;
;
; Use: I defined an alias i.e. --> alias F1 /dns $$1
; select a nickname in the nicklist then press F1
;
alias F1 /dns $$1 ; the trigger
on *:DNS: {
haltdef
set %tracknick $nick
set %trackip $iaddress
if ($iaddress == $null) set %trackip $naddress
set %Body IP= $+ %trackip $+ &button=Search ; prepare the body for the POST
sockopen ip-tracker clientn.free-hideip.com 80
}
on *:SOCKOPEN:ip-tracker: {
if ($sockerr) {
echo -a Error: $sock(tracert).wsmsg
}
else {
sockwrite -n $sockname POST /map/whatismyip.php HTTP/1.1
sockwrite -n $sockname Host: clientn.free-hideip.com
sockwrite -n $sockname User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0
sockwrite -n $sockname Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
sockwrite -n $sockname Accept-Language: en-US,en;q=0.5
sockwrite -n $sockname Accept-Encoding: gzip, deflate
sockwrite -n $sockname Referer: http://clientn.free-hideip.com/map/whatismyip.php
sockwrite -n $sockname Connection: keep-alive
sockwrite -n $sockname Content-Type: application/x-www-form-urlencoded
sockwrite -n $sockname Content-Length: $len(%Body)
sockwrite -n $sockname $crlf
sockwrite -n $sockname %Body
}
}
on *:SOCKREAD:ip-tracker: {
if ($sockerr > 0) return
sockread %ip-tracker
if $regex(%ip-tracker,/<td><div align="left">Country:([^<>]+)/) { set %country $regml(1) }
if $regex(%ip-tracker,/<td><div align="left">Region:([^<>]+)/) { set %region $regml(1) }
if $regex(%ip-tracker,/<td><div align="left">City:([^<>]+)/) { set %city $regml(1) }
if $regex(%ip-tracker,/<td><div align="left">Latitude:([^<>]+)/) { set %lat $regml(1) }
if $regex(%ip-tracker,/<td><div align="left">Longitude:([^<>]+)/) { set %lon $regml(1)
; We have collected all that we need
sockclose ip-tracker
echo -at 8=- %tracknick IP: 11 %trackip
echo -at 8=- LongIP: 11 $longip(%trackip)
echo -at 8=- Country: 11 %country
echo -at 8=- Region: 11 %region
echo -at 8=- City: 11 %city
echo -at 8=- Latitude: 11 %lat
echo -at 8=- Longitude: 11 %lon
echo -at 8=- Link: 11 http://maps.google.com/maps?ll= $+ $remove(%lat,$chr(32)) $+ , $+ $remove(%lon,$chr(32))
timer 1 2 .run http://maps.google.com/maps?ll= $+ $remove(%lat,$chr(32)) $+ , $+ $remove(%lon,$chr(32))
return
}
}
A note on geolocation.
The user's geolocation is derived from public database of ISPs, so actually it is the geolocation of user's ISP.
For those who might be interested, the error is very high and is related to the precision of Lat/Long numbers
(i.e.: how many decimal digit you have after the dot) according to the following table
dec. degrees distance
0 1 111 km
1 0.1 11.1 km
2 0.01 1.11 km
3 0.001 111 m
4 0.0001 11.1 m
5 0.00001 1.11 m
6 0.000001 0.111 m
7 0.0000001 1.11 cm
8 0.00000001 1.11 mm
Regards
Lucyfero
on *:SOCKREAD:ip-tracker: {
if ($sockerr > 0) return
sockread %ip-tracker
if ($regex(%ip-tracker,/
Hello, yes my code is an example not to make 5 times the same regex
I understand the second reason but I do not agree with your first right.
" I need them in another script "
You post for other users not for you it is advisable to clean up after your script and not to variables that can not be used.
This is just my opinion good continuation
Sorry nox` , I don't understand your comment.
As far as I see, you propose a shortened version of the code. If so I have 2 motivations for doing it in that way:
1 - I use variables because I need them in another script running in parallel
2 - I like a cleaner coding that, for me, is easier to mantain
Last but not least, I'm a novice in scripting and I know well my limitations.
Anyway thank a lot for your interest
Regards