|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2005
Posts: 1,009 |
i want to put in .txt or .ini (no matter) something like this 192.0.0.0 - 193.255.255.255 194.0.0.0 - 195.255.255.255 206.0.0.0 - 207.255.255.255 so script can detect when i make /dns and if IP is not equal to IP range given above then script halts and if it is in range of given above then it calls some url like http://www.test.comhow to do it?
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Do this:
ip.txt formatted like this:
192.0.0.0-193.255.255.255-http://www.host1.com 194.0.0.0-195.255.255.255-http://www.host2.com 206.0.0.0-207.255.255.255-http://www.host3.com
on *:dns: { set %line 1 while (%line <= $lines(ip.txt)) { if ($dns(1).ip > $gettok($read(ip.txt,%line),1,45) && $dns(1).ip < $gettok($read(ip.txt,%line),2,45)) { run $gettok($read(ip.txt,%line),3-,45) } inc %line } }
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2005
Posts: 1,009 |
it looks nice but can you add some sort of checkup for those ip's that dont belong to range so it can be for example just /echo -a "wrong ip" | halt ???
edit:
can be also resolved ip added to %var and then check if it is in specified range that is in .txt ?
like: on dns set ip %varip then if %varip is in 192.0.0.0-193.255.255.255 go to that page if not echo that warning
?
Last edited by raZOR; 13/04/05 08:53 PM.
IceCapped
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
on *:dns: { var %ip = $dns(1).ip var %line 1 while (%line <= $lines(ip.txt)) { if (%ip > $gettok($read(ip.txt,%line),1,45) && %ip < $gettok($read(ip.txt,%line),2,45)) { run $gettok($read(ip.txt,%line),3-,45) halt } inc %line } echo -a IP out of Range halt }
That should cover what you asked for. Anything else?
Invision Support #Invision on irc.irchighway.net
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2005
Posts: 1,009 |
i shall test this tommorow since itz late here and i must ZzZz i'll see then if it covers what i need ![laugh laugh](/images/graemlins/mirc/laugh.gif) and much thanx for your help !
IceCapped
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2005
Posts: 1,009 |
well i tested it a bit now (b4 sleep) :tongue:
and it works ! but i have a lil trouble coz it is interferes with 1 script for dns:
;made by codemastr ;www.codemastr.com
ON *:DNS:{ if ($dns(0) == 0) { linesep -s echo $color(normal text) -s Unable to resolve $iif($iaddress,$iaddress,$dns(0).addr) linesep -s } else { var %numhosts $dns(0), %host = 0 var %hosts while (%host < %numhosts) { inc %host 1 set %hosts %hosts $iif($dns(1) == $dns(1).ip,$dns(%host).addr $+([,$ccode($dns(%host).addr),]),$dns(%host).ip) $+ $chr(44) } linesep -s echo $color(normal text) -s Resolved $dns(1) to $left(%hosts,$calc($len(%hosts)-1)) linesep -s } halt }
any chance that you could "implemt" your code into this so it could work okay ?
|
|
|
|
Joined: Apr 2005
Posts: 1,009
Hoopy frood
|
OP
Hoopy frood
Joined: Apr 2005
Posts: 1,009 |
... nevermind i did it myself =)
thanks again for your help
IceCapped
|
|
|
|
Joined: Oct 2004
Posts: 8,330
Hoopy frood
|
Hoopy frood
Joined: Oct 2004
Posts: 8,330 |
Huh?! I replied to that with it in there.... wonder why it didn't post. Sorry.
Invision Support #Invision on irc.irchighway.net
|
|
|
|
|