Whois tracker with IP locator

By Scakk on Feb 13, 2011

This is a whois tracker and IP locator in one. You can have it tell you the locationof their IP or not ( toggleable ). You must have the +W usermode and be an IRCop.

Will show in your Status Window and @Whois as

[00:06] [/whois] MrMorden [IP.Is.Here] did a /whois on you.

If the IP locator is on it will shows as the below in both places mentioned above.

[00:07] [/whois] MrMorden [IP.Is.Here] did a /whois on you.

menu Status {
  Whois Ip Info 
  . $iif(%WhoisIPInfo,Off,On) : $iif(!%WhoisIPInfo,set %WhoisIPInfo on, unset %WhoisIPInfo)
}

on ^*:snotice:*whois*: { if ($6 === /whois) { .enable #snoticewhois | whois $2 $2 | haltdef } }
#snoticewhois off
raw *:*: {
  $iif(!$window(@Whois),window -znk0 @Whois) 
  if ($numeric == 378) { set %snoticewhoisIP $7 | haltdef }
  if ($istok(310 311 312 313 317 318 319 320 330 335 379,$numeric,32)) { haltdef }
  else {
    echo 7 -s $timestamp $+([,/whois,]) $2 $+([,%snoticewhoisIP,]) did a /whois on you.
    if (%WhoisIPInfo) { if (!$sock(IPwhois)) { whoisip %snoticewhoisIP } }
    aline -p @Whois $asctime $+([,/whois,]) $2 $+([,%snoticewhoisIP,]) did a /whois on you.
    haltdef
    .timer -d 1 1 unset %snoticewhoisIP | .timer -d 1 1 .disable #snoticewhois
  }
}
#snoticewhois end
alias whoisip { set %ipnumber $1 | sockopen IPwhois www.melissadata.com 80 }
on *:sockopen:IPwhois: {
  sockwrite -n $sockname GET $+(/lookups/iplocation.asp?ipaddress=,%ipnumber) HTTP/1.1
  sockwrite -n $sockname Host: www.melissadata.com
  sockwrite -n $sockname Connection: close
  sockwrite -n $sockname Authorization: Basic 
  sockwrite -n $sockname $crlf
}
on *:sockread:IPwhois: {
  sockread %iptemp
  if (align='left'><b> isin %iptemp) { inc %tt 1 | set %ipinfo $+ %tt $remove($nohtml(%iptemp),$chr(9)) }
}
on *:sockclose:IPwhois: {
  echo 7 -s $timestamp $&
    [IP]: $removecs(%ipinfo1,$(IP Address)) $&
    [City]: $removecs(%ipinfo2,City) $&
    [State/Region]: $removecs(%ipinfo3,$(State or Region)) $&
    [Country]: $removecs(%ipinfo4,Country) $&
    [ISP]: $removecs(%ipinfo5,ISP)
  aline -p @Whois $asctime  $&
    [IP]: $removecs(%ipinfo1,$(IP Address)) $&
    [City]: $removecs(%ipinfo2,City) $&
    [State/Region]: $removecs(%ipinfo3,$(State or Region)) $&
    [Country]: $removecs(%ipinfo4,Country) $&
    [ISP]: $removecs(%ipinfo5,ISP)
  unset %ip* %tt
}
alias nohtml {
  var %x, %i = $regsub($1-,/(^[^<]*>|<[^>]*>|<[^>]*$)/g,$null,%x), %x = $remove(%x,&nbsp;)
  return %x
}

Comments

Sign in to comment.
Jethro   -  Mar 08, 2011

Well, unless many people want to trigger the socket at the same time from many channels where the code is run, it's not usually necessary to make it dynamic. Besides, I don't reckon the chances of being whois'd are ample.

 Respond  
Firstmate   -  Mar 08, 2011

Throttle it to a maximum of like 5 connections. It's not impossible, just requires a little more coding.

 Respond  
Scakk   -  Mar 08, 2011

Jethro_ .. Just the style I am used to I guess.

Firstmate .. I am reminded of a bot attack on a network I am on that /whois'ed you repeatedly. Your version could lag you off the server due to the repeated /whois's

CrAnK .. Glad to hear that.

 Respond  
CrAnK   -  Mar 08, 2011

Thnx u Jethro_ & Scakk . I have no problem now

 Respond  
Firstmate   -  Mar 08, 2011

Why not allow multiple ones at the same time:

sockopen $+(IPwhois,.,$ticks) ...etc

 Respond  
Jethro   -  Mar 07, 2011

Why not:

if (%WhoisIPInfo) && (!$sock(IPwhois)) { whoisip %snoticewhoisIP }
 Respond  
Scakk   -  Mar 07, 2011

I altered the raw section to fix that issue.

The line

if (%WhoisIPInfo) { whoisip %snoticewhoisIP }

to be

if (%WhoisIPInfo) { if (!$sock(IPwhois)) { whoisip %snoticewhoisIP } }
 Respond  
CrAnK   -  Mar 07, 2011

when someone make more than one whois on me it show me this error log :

-

  • /sockopen: 'IPwhois' socket in use (line 23, IPWhois.ini)
  • Line 23 : > alias whoisip { set %ipnumber $1 | sockopen IPwhois www.melissadata.com 80 }

 Respond  
Firstmate   -  Feb 15, 2011

Dean: "i will remind that, when u do one of urs "it could be" in someone snippets"
While he does do that, he certainly does not call other snippets "crap." Yes, you did show another method, so I have no quarrels there.

But stop being so short-fused, there is no need for so much hate for a mirc scripting community.

I don't care if you're a good scripter or not, just don't be so rude.

 Respond  
Slickone   -  Feb 14, 2011

really nice job Scakk 10/10 +like
Don't worrie about people like that. People like them are nothing more then self absorbed egotistical morons.
To the rest of us reading their comments just remember their comments.."Are a tale told by an idiot, full of sound and fury, signifying nothing.
again really good job on this sippet.

 Respond  
_Dean_   -  Feb 14, 2011

Feeling guilty about something? I never specifically mentioned you. GG nub.

u didnt say my name, but u was talking about me, cause i was the one who just make comments here, about the script, the other ones, just came as ever, to comment on my posts

i dont have to feel guilty about nothing

 Respond  
Jethro   -  Feb 14, 2011

Scakk, the above post by Dean has just concluded for the coward who lowered your snippet, not to mention he claimed your snippet as a "crap" to begin with. This coward has a high level of self-insecurity and ego. He thinks everyone who opposes his comments is a personal enemy to him (that we're an imaginary gang who attempts to overthrow him), and that he'll evaluate his or her work for being a fraud. Worse yet, he thinks everyone, OTHER than himself, who codes in MSL and offers suggestions is acting as a show-off or expert.

This is not technically his fault but his problematic, failed upbringing.

Now, he may reply and say in his feisty defense, "I wasn't the one followed by calling you a rude name" and be a ticking bomb for you to defuse.

You just have to learn to let go and ignore a cowardly troll like him.

 Respond  
TheImrac   -  Feb 14, 2011

dont make me laugh
Feeling guilty about something? I never specifically mentioned you. GG nub.

 Respond  
_Dean_   -  Feb 14, 2011

He couldn't script his way out of a paper sack

dont make me laugh

 Respond  
TheImrac   -  Feb 14, 2011

Good ish Scakk. Don't worry about numb nuts over there. He couldn't script his way out of a paper sack, let alone contribute anything useful to man-kind.

 Respond  
Jethro   -  Feb 14, 2011

The "someone" who rated your snippet a one is a coward, and those with cowardice aren't likely to make themselves reachable for a proper explanation and will usually remain in denial.

This happens to me a number of times for my own snippets, where I've had gotten high ratings, then out of the blue, someone else came along and lowered them out of spite because of his or her personal issues toward me.

It's a bad taste that "someone" has taken Hawkee's rating system as a way for an irresponsible self-gratification.

 Respond  
Scakk   -  Feb 14, 2011

I can make assumptions as to who it was and possibly be right or wrong. I just hoped the person who rated it a 1 had the courage to actually admit to doing so, else they are just rating it out of spite and therefore make me wonder if thet truelly understand the code itself.

By the way I would liek to thank napa and Jethro for their ratings and +likes.

 Respond  
Jethro   -  Feb 14, 2011

Scakk, isn't that "someone" obvious? Hawkee's rating system is flawed. Don't let it get to you. Keep up the good work.

 Respond  
Scakk   -  Feb 14, 2011

Average Score 6.7 (of 3 scores)

Napa gave it a 9
Jethro gave it a 10
That means someone rated it a 1. Mind explaining why the rating of a 1...

 Respond  
napa182   -  Feb 14, 2011

rofl nice

 Respond  
Jethro   -  Feb 14, 2011

I've given Scakk a 10 and like. Why? Because I can.

 Respond  
Jethro   -  Feb 14, 2011

You're just a grumpy, old git that will not get out of your own world. This world doesn't revolve around you. Don't tell people what they can or can't do. I have my right to free speech. Don't be such a dictated prude.

 Respond  
napa182   -  Feb 14, 2011

As I said before nice work Scakk.
and yes everyone has their own way of making sockets. Dean's so called socket edit is-int any better nor is it any worse.
anyways I guess il kick off the scoring =P
9/10 +like

 Respond  
_Dean_   -  Feb 14, 2011

What you've demonstrated here is very similarily typical to napa, sunslayer and I have been doing with sockets before you've submitted your first-ever post regarding sockets at Hawkee.

so you're saying that i copied his ideas? so probably, no one on world, just thought before, in do a socket like this, just napa and sunslayer, by the way, you just 4 days "old" here than me, i made many sockets, and watch many things here on hawkee, i just never posted before

i've learned alot, and read many tutorials before start on sockets, but i dont think, that we just do bad comments in someone snippet, if we dont know do it better than him, as Scakk did

im not interested in what u do or dont Jethro_, dont try to show to others that you're better than other ppl

Regardless of what's a better method or not, scakk wants his socket coding style kept as reserved as intended when he's made it.

i will remind that, when u do one of urs "it could be" in someone snippets

 Respond  
Jethro   -  Feb 14, 2011

Dean, as I have said time and again, you're imagining things. No one's claimed he or she's an elite or expert. You're putting "names" in people's mouths. You need to get rid of such absurd mentality of yours.

Regardless of what's a better method or not, scakk wants his socket coding style kept as reserved as intended when he's made it. We should accommodate that and improve it with our courteous suggestions and whatnot. We do not belittle someone's work and throw it away and then replace it with our examples...unless the script by itself is a total disaster.

Did you first start at socket like you do now? I think not. You must have learned from others' methods and taken their approaches as you preferred format when making a socket script, along with some of your ideas. What you've demonstrated here is very similarly typical to napa, sunslayer and I have been doing with sockets before you've submitted your first-ever post regarding sockets at Hawkee.

P.S. I use sockclose event from time to time; are you gonna tell me I shouldn't just because you think so?

 Respond  
Scakk   -  Feb 13, 2011

I am no expert at mIRC scripting, I just see things a different way than most do it seems as I do things an odd way. I figure as long as it works and does what you want it to then all is well. If there are better ways to do things then by all means show me , or others , so people can learn and grow in their scripting.

I use the sockclose event as that is how I learned sockets and I am to lazy to alter it now :P

 Respond  
_Dean_   -  Feb 13, 2011

when Scakk commented on my snippets, i thought he was an expert
cause he commented many things about it

this is a edit for the socket part
where no need the on sockclose event, and will return the same thing

alias whoisip { sockopen IPwhois www.melissadata.com 80 | sockmark ipwhois $$1 }
on *:sockopen:IPwhois: {
  var %x sockwrite -n $sockname
  %x GET $+(/lookups/iplocation.asp?ipaddress=,$sock(ipwhois).mark) HTTP/1.1
  %x Host: $sock(ipwhois).addr
  %x Connection: close
  %x Authorization: Basic 
  %x $crlf
}
on *:sockread:IPwhois: {
  sockread %iptemp
  if $regex(%iptemp,/<td class='columresult'>(.+)<\/td><td align='left'><b>(.+)<\/b><\/td><\/tr>/g) {
    echo -a $timestamp $+([,$regml(1),],:) $remove($regml(2),&nbsp;,$chr(9))
    $iif($window(@whois), aline -p @whois $timestamp $+([,$regml(1),],:) $remove($regml(2),&nbsp;,$chr(9)))
  }
} 
 Respond  
Jethro   -  Feb 13, 2011

Dean, please don't be disrespectful to our fellow members here at Hawkee. Be nice when offering your input. You don't call someone's work a "crap," at least not in an ignorant sense of yours. This is what I meant by catching you "starting a fire" at someone's thread. You're in the wrong first.

Scakk, nice work and don't let anyone tell you otherwise. :-) We're here to learn and encourage each other to be better.

 Respond  
sunslayer   -  Feb 13, 2011

if you stop to say shi­t, you was able to check, that he forgot it, then, everytime u do a comment, check if before, and dont be a dumbass Please go back to the third grade and make a coherent sentence for once please...

 Respond  
_Dean_   -  Feb 13, 2011

just because you can't understand someone's code doesn't make it crap Dean

if you stop to say shi­t, you was able to check, that he forgot it, then, everytime u do a comment, check if before, and dont be a dumbass

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.