Home | Networks | Community | Need Help? 

 
 Quick search

 
 
 RegisterRegister   Log inLog in 

Reversing a ip with mIRC script

 
Post new topic   Reply to topic    SearchIRC Forum Index -> IRC Help
Author Message
m33p
none
none


Joined: 19 Feb 2004
Posts: 1

PostPosted: Jan 26, 2005 3:53pm    Post subject: Reversing a ip with mIRC script Reply with quote

I want to know how I could reverse an ip like

127.0.0.1 to 1.0.0.127

or

192.168.1.12 to 12.1.168.192

any help?
Back to top
zeke
Idler
Idler


Joined: 04 Oct 2003
Posts: 325

PostPosted: Jan 27, 2005 12:06am    Post subject: Reply with quote

i would imagine you would probably use tokens, (this is likely buggy)

/revip 192.168.1.65

Code:
alias revip {
  var %toks = $numtoks($1-,46)
  var %toks2 = $null
  while (%toks > 0) {
    var %toks2 = $gettok($1-,%toks,46) $+ . $+ %toks2
    dec %toks
  }
  return %toks2
}
Back to top
W-Unit
Newbie
Newbie


Joined: 29 Jul 2004
Posts: 83

PostPosted: Jan 27, 2005 8:23pm    Post subject: Reply with quote

Yeah, that script is buggy lol. First of all, $numtoks is not an identifier; it should be $numtok. Second, using $numtok($1-,46) will confuse the script greatly because using $1- causes it to possibly return spaces, which are not valid tokens since you have chosen character 46 (the period) as your token seperator, therefore they are treated as normal text in the tokens and the output will be messed up. It is possible to make one that does as many reversed IPs as you specify, but he didn't ask for that so I'm not going to take the extra time to code it.
Code:
alias revip {
  if ( !$1 ) {
    echo $colour(info) -a * Syntax: /revip <IP Address>
    halt
  }
  var %x = 1,%f = $gettok($1,$wildtok($1,*,0,46),46)
  while ( %x < $wildtok($1,*,0,46) ) {
    %f = $addtok(%f,$gettok($1,$calc($wildtok($1,*,0,46) - %x),46),46)
    inc %x 1
  }
  echo $colour(info) -a * Reversed IP: %f
}

Despite my playing with it, I cant get it to return repetitive numbers (/revip 127.0.0.1 will for some reason return 1.0.127) but other than that (and since real IPs other than the localhost IP never have repeated numbers) it works fine.
Back to top
phrozen77
Newbie
Newbie


Joined: 13 Jul 2004
Posts: 86
Location: There!! A 3-headed monkey, right behind you!

PostPosted: Jan 28, 2005 5:59am    Post subject: Reply with quote

Quote:
(and since real IPs other than the localhost IP never have repeated numbers)


how comes that my server has two same numbers in the middle of it? (like a.b.b.c)
Back to top
Cobi
Lurker
Lurker


Joined: 30 Dec 2003
Posts: 121
Location: IRC

PostPosted: Feb 08, 2005 6:42pm    Post subject: Reply with quote

Code:
alias revip { return $+($gettok($1,4,46),.,$gettok($1,3,46),.,$gettok($1,2,46),.,$gettok($1,1,46)) }

usage:
$revip(ip.add.re.ss)
Back to top
EqualSlashed_Brian
Lurker
Lurker


Joined: 29 Aug 2004
Posts: 222
Location: IRC

PostPosted: Feb 09, 2005 4:13am    Post subject: Reply with quote

You are wrong about the same numbers thing. Now is a good time to read the RFC.
Back to top
W-Unit
Newbie
Newbie


Joined: 29 Jul 2004
Posts: 83

PostPosted: Feb 14, 2005 9:13am    Post subject: Reply with quote

OK, I just never saw an IP with repeated digits. I assumed they didn't exist.

Anyway, here's code that will work with repeated digits as an alternative to Cobi's. It echoes it, and is not an identifier, unlike his.
Code:
alias revip {
  if ( !$1 ) {
    echo $colour(info) -a * Syntax: /revip <IP Address>
    halt
  }
  var %x = 1,%f = $gettok($1,$numtok($1,0,46),46)
  while ( %x < $numtok($1,46) ) {
    %f = $addtok(%f,$gettok($1,$calc($numtok($1,46) - %x),46),46)
    inc %x 1
  }
  echo $colour(info) -a * Reversed IP: %f
}
Back to top
Display posts from previous:   
Post new topic   Reply to topic    SearchIRC Forum Index -> IRC Help All times are GMT - 6 Hours
Page 1 of 1

 
 
Forum powered by phpBB
 
 © 2000 - 2008 EverythingIRC, Inc. All rights reserved. Please read our disclaimer