Introduction
This script simply takes the address/host of a user. Checks it against a database of countries and abbreviations and will tell you where a user is from. it's as simple as that.
Controls
$location(X) - where X is a country abbreviation. For example $location(uk) will return United Kingdom
/l - Checks a user using $address(), doesn't always work for some reason with mIRC but you can get around this using the next command
/whois - In the WHOIS, if a country name is found it will list the countries a user could be from.
raw 311:*: {
if ($regex($4,/(\.[a-zA-Z]{2,3})/g)) {
var %x = 1, %h | while (%x <= $regml(0)) { var %h = %h $iif($location($remove($regml(%x),.)),$v1 $+([,$regml(%x),])) | inc %x }
if (%h) { set %loc Possible locations for $2 $+ : %h }
}
}
raw 319:*:if (%loc) echo -a %loc | unset %loc
alias l {
if ($address($1,1)) {
if ($regex($address($1,1),/(\.[a-zA-Z]{2,3})/g)) {
var %x = 1, %h
while (%x <= $regml(0)) { var %h = %h $iif($location($remove($regml(%x),.)),$v1 $+([,$regml(%x),])) | inc %x }
if (%h) { echo -a Possible locations for $1 $+ : %h }
else { goto end }
}
elseif ($longip($gettok($address($nick,1),$numtok($address($nick,1),64),64) isnum) { echo -a 2* /Locate: $+(,$1,) is using their IP as a hostmask. Go here to WHOIS them: http://www.ipaddresslocation.org }
else { :end | echo -a 2* /Locate: There were no country abbreviations found in $+(,$1,'s) name. They may be using a vHost: $+([,$address($1,1),]) }
}
else { echo -a 2* /Locate: Unable to retrieve host from $+(,$1,.) Make sure they are online }
}
alias location {
var %la = ad,ae,af,ag,ai,al,am,an,ao,aq,ar,arpa,as,at,au,aw,az,ba,bb,bd,be,bf,bg,bh,bi,bj,bm,bn,bo,br,bs,bt,bv,bw,by,bz,ca,cc,cf,cg,ch,ci,ck,cl,cm,cn,co,com,cr,cs,cu,cv,cx,cy,cz,de,dj,dk,dm,do,dz,ec,edu,ee,eg,eh,er,es,et,fi,fj,fk,fm,fo,fr,fx,ga,gb,gd,ge,gf,gh,gi,gl,gm,gn,gov,gp,gq,gr,gs,gt,gu,gw,gy,hk,hm,hn,hr,ht,hu,id,ie,il,in,int,io,iq,ir,is,it,jm,jo,jp,ke,kg,kh,ki,km,kn,kp,kr,kw,ky,kz,la,lb,lc,li,lk,lr,ls,lt,lu,lv,ly,ma,mc,md,mg,mh,mil,mk,ml,mm,mn,mo,mp,mq,mr,ms,mt,mu,mv,mw,mx,my,mz,na,nato,nc,ne,net,nf,ng,ni,nl,no,np,nr,nt,nu,nz,om,org,pa,pe,pf,pg,ph,pk,pl,pm,pn,pr,pt,pw,py,qa,re,ro,ru,rw,sa,sb,sc,sd,se,sg,sh,si,sj,sk,sl,sm,sn,so,sr,st,su,sv,sy,sz,tc,td,tf,tg,th,tj,tk,tm,tn,to,tp,tr,tt,tv,tw,tz,ua,ug,uk,um,us,uy,uz,va,vc,ve,vg,vi,vn,vu,wf,ws,ye,yt,yu,za,zm,zr,zw
var %lc = Andorra,United Arab Emirates,Afghanistan,Antigua and Barbuda,Anguilla,Albania,Armenia,Netherlands Antilles,Angola,Antarctica,Argentina,Old style Arpanet,American Samoa,Austria,Australia,Aruba,Azerbaidjan,Bosnia-Herzegovina,Barbados,Bangladesh,Belgium,Burkina Faso,Bulgaria,Bahrain,Burundi,Benin,Bermuda,Brunei Darussalam,Bolivia,Brazil,Bahamas,Bhutan,Bouvet Island,Botswana,Belarus,Belize,Canada,Cocos (Keeling) Islands,Central African Republic,Congo,Switzerland,Ivory Coast (Cote D'Ivoire),Cook Islands,Chile,Cameroon,China,Colombia,Commercial mainly USA,Costa Rica,Former Czechoslovakia,Cuba,Cape Verde,Christmas Island,Cyprus,Czech Republic,Germany,Djibouti,Denmark,Dominica,Dominican Republic,Algeria,Ecuador,USA Educational,Estonia,Egypt,Western Sahara,Eritrea,Spain,Ethiopia,Finland,Fiji,Falkland Islands,Micronesia,Faroe Islands,France,France (European Territory),Gabon,Great Britain,Grenada,Georgia,French Guyana,Ghana,Gibraltar,Greenland,Gambia,Guinea,USA Government,Guadeloupe (French),Equatorial Guinea,Greece,S. Georgia & S. Sandwich Isls.,Guatemala,Guam (USA),Guinea Bissau,Guyana,Hong Kong,Heard and McDonald Islands,Honduras,Croatia,Haiti,Hungary,Indonesia,Ireland,Israel,India,International,British Indian Ocean Territory,Iraq,Iran,Iceland,Italy,Jamaica,Jordan,Japan,Kenya,Kyrgyzstan,Cambodia,Kiribati,Comoros,Saint Kitts & Nevis Anguilla,North Korea,South Korea,Kuwait,Cayman Islands,Kazakhstan,Laos,Lebanon,Saint Lucia,Liechtenstein,Sri Lanka,Liberia,Lesotho,Lithuania,Luxembourg,Latvia,Libya,Morocco,Monaco,Moldavia,Madagascar,Marshall Islands,USA Military,Macedonia,Mali,Myanmar,Mongolia,Macau,Northern Mariana Islands,Martinique (French),Mauritania,Montserrat,Malta,Mauritius,Maldives,Malawi,Mexico,Malaysia,Mozambique,Namibia,NATO,New Caledonia (French),Niger,Network,Norfolk Island,Nigeria,Nicaragua,Netherlands,Norway,Nepal,Nauru,Neutral Zone,Niue,New Zealand,Oman,Non-Profit Making Organisations,Panama,Peru,Polynesia (French),Papua New Guinea,Philippines,Pakistan,Poland,Saint Pierre and Miquelon,Pitcairn Island,Puerto Rico,Portugal,Palau,Paraguay,Qatar,Reunion (French),Romania,Russian Federation,Rwanda,Saudi Arabia,Solomon Islands,Seychelles,Sudan,Sweden,Singapore,Saint Helena,Slovenia,Svalbard and Jan Mayen Islands,Slovak Republic,Sierra Leone,San Marino,Senegal,Somalia,Suriname,Saint Tome and Principe,Former USSR,El Salvador,Syria,Swaziland,Turks and Caicos Islands,Chad,French Southern Territories,Togo,Thailand,Tadjikistan,Tokelau,Turkmenistan,Tunisia,Tonga,East Timor,Turkey,Trinidad and Tobago,Tuvalu,Taiwan,Tanzania,Ukraine,Uganda,United Kingdom,USA Minor Outlying Islands,United States,Uruguay,Uzbekistan,Vatican City State,Saint Vincent & Grenadines,Venezuela,Virgin Islands (British),Virgin Islands (USA),Vietnam,Vanuatu,Wallis and Futuna Islands,Samoa,Yemen,Mayotte,Yugoslavia,South Africa,Zambia,Zaire,Zimbabwe
if ($findtok(%la,$1,44)) { $iif($isid,return,echo -a) $gettok(%lc,$findtok(%la,$1,44),44) }
elseif (!$isid) { echo -a *$!location: Error: $qt($1) was not found) }
}
It would be an epic update to use a webdatabase to search up the location of the IP addresses, such as http://geotool.flagfox.net/?ip=74.55.211.234 for Hawkee.com.
All it must do is strip letters, -'s, etc from the hostname, then socket to that website, then trim off where it says the country and city. It is genius! :D
Thankyou both, there is error checking for the ip, check the $longip statement, but sometimes $address, doesn't work.i suggest using this script in the whois. im not sure why address doesn't always work tbh, i think it's because the user has to join for mirc to register their address, but ive never looked into it.
i will update when im back on my normal computer im having to use a netbook atm with linux on it and i cba to install mirc on wine or a VirtualBox yet.
Cool jonesy44.
However, like you said, it doesn't necessarily work everytime.
For example, if I were to try to find the country for a non dns-resolved host (let's say a numbered ip), or if it's a valid vhost, there's going to be some problems.
-
KiRBY is jake@216.86.155.19 Something to prove; nothing to lose
KiRBY using .quakenet.org QuakeNet IRC Server
kirby End of /WHOIS list.
- /Locate: Unable to retrieve host from kirby. Make sure they are online
Shinu is shinu@packetstorm.in Domid Ilbnc
Possible locations for Shinu: India [.in]
Shinu on @#Taco #PerlBot @#YT +#geeking @#YTBots +#TwitterBots @#GameBots @#pwnt @#Bet
Shinu using .quakenet.org QuakeNet IRC Server
Shinu is authed as Shinu
Shinu End of /WHOIS list.
But that's just unavoidable without socket-use.
However, I suggest one thing:
* /Locate: Unable to retrieve host from <nick>. Make sure they are online
They technically ARE online, but it can't find the country from the list in the script; you might want to add another "if" to the script.
Otherwise, very nice.
This is for networks like DALnet, ones that don't provide native hostmasking for user's. Unfortunately, these are rife with skids.