Web info-x
   
THIS SITE IS FOR SALE
 
 
Programming
 Info-x : Technology : Programming
Message Icon Topic: Hostname creating Post Reply Post New Topic
Author Message
Guests
Guest Group
Guest Group

Quote Guests Replybullet Topic: Hostname creating
    Posted: 24 Apr 2000 at 07:57
Hostname creating

Ok, recently I posted to Packet Storm a small Java class along with Juman from 2600's C code for cracking Austnet's VW hostmasking. All my class did was create a list of IPs given the first two octets [ie. if given 202.132. it would generate 202.132.1.1 to 202.132.255.255]. This was used if the user was using a non-resolvable IP.Now the problem is when you want to crack a masked hostname. If their ISP allows hostlist retrieval [*ix: host -l host.com] then you just pipe that to a file, and Duane's your Auntie. BUT, if it doesn't, then I want to write a class similar to what I did for the IPs, just generate hostnames given a certain mask.An example. If it's known that the mask is dialup-##-#.host.com.au then I want to start with dialup-11-1 and end with dialup-99-9.Due to brainlock, I just can't work out how to do it. My problem is not knowing how many loops that're needed [can be any number if you think about it], and I just don't have the logical thinking to work it out.If someone could point me in the right direction, I'd be rather happy... I'll be doing it in Java [duh] and I'll happily credit whoever puts in something [that I use].
IP IP Logged
deej
Admin Group
Admin Group


Joined: 22 Nov 1997
Online Status: Offline
Posts: 3
Quote deej Replybullet Posted: 24 Apr 2000 at 13:45
Re: Hostname creating

heh, i went through the same shit when i was writing a scanner and wanted the user to be able to put in an IP and netmask. I gave up in the end, don't have the time to figure it out. But after a bit of thinking i think i decided it'd be easier if we convert the address and mask to binary... can't remember what to do from there.. but maybe that will send you off in the right direction. Try not to lose too much hair over it.





TheBarman
IP IP Logged
Guests
Guest Group
Guest Group

Quote Guests Replybullet Posted: 24 Apr 2000 at 14:21
Re: Hostname creating

*polishes his dome* Lose what?What you're thinking of would be similar to simple parity checking, though, wouldn't it? You want to find if the first bit is odd or even so you apply 101010101010 to the binary value of the number you want to check, check whether it's odd/even, and I won't go into the rest because I drove myself insane doing it last year [fuck you PDP8 ASM].This is really shitting me off though... it's just trying to work out how many loops I'll need and being able to implement that. Once I've got that, it's done. *cries* I have a script that does it, but it's done in mIRC scripting :(Here is the business bit of it [I think]:Sorry for length of this...alias findip2 {

set %findip.num 0

:again

who %findip.ip $+ %findip.num $+ $chr(42)

inc %findip.num

if (%findip.num > 9) {

halt

}

goto again

}alias findip3 {

set %findip.num 0

:again

if (%findip.pos > 1) { set %findip.hosttemp $mid(%findip.host,1,$calc(%findip.pos - 1)) $+ %findip.num $+ $mid(%findip.host,$calc(%findip.pos + 1), $len(%findip.host)) }

else { set %findip.hosttemp %findip.num $+ $mid(%findip.host,$calc(%findip.pos + 1), $len(%findip.host)) }

who $replace(%findip.hosttemp,$chr(35),$chr(42))

inc %findip.num

if (%findip.num > 9) {

halt

}

goto again

}raw 315:*: {

if (%findip.status == on) {

inc %findip.replycount

if (%findip.grabip == on) {

if (%findip.findhost == true) {

set %findip.host $mid($2,1,$calc(%findip.pos)) $+ $mid(%findip.host,$calc(%findip.pos + 1), $len(%findip.host))

set %findip.grabip off

inc %findip.tempcount

if (%findip.tempcount > %findip.realcount) {

echo -a [findip]: Real Host Found! %findip.nick $+ @ $+ %findip.host

unset %findip.*

halt

}

set %findip.pos $pos(%findip.host,$chr(35),1)

findip3

}

else {

set %findip.ip $left($2, $calc($len($2) - 1))

set %findip.grabip off

if ($count(%findip.ip,$chr(46)) == 2) {

if ($gettok(%findip.ip,3,46) > 0 && $gettok(%findip.ip,3,46) 0 && $gettok(%findip.ip,4,46) 9) {

if (%findip.findhost == true) {

if (%findip.ipgrabbed != true) {

echo -a [findip]: Unable to determine real host. Stopping.

echo -a [findip]: You may wish to try an alternative host pattern if exists.

unset %findip.*

halt

}

else { unset %findip.ipgrabbed }

}

else {

echo -a [findip]: Unable to determine real IP. Stopping.

echo -a [findip]: You may have to scan for host.

unset %findip.*

halt

}

}

}

}

}

IP IP Logged
Guests
Guest Group
Guest Group

Quote Guests Replybullet Posted: 24 Apr 2000 at 15:09
Why not use recursion ?

I'm not sure what you're trying to achieve,

but why not use some recursion, and fill in every number at each position that contains a # (in your example) ?In pseudo-C-like Perl, this would be :$start = 'dialup-##-#.host.com.au';

getdigit($start);sub getdigit {

my($current) = @_;

my($pos,$new,$i);

$pos = index($current,'#');

if ($pos > -1) {

for ($i = 0; $i Of course, the trouble begins when some numbers actually vary between 0 and 255, like my own dialup name :)

But you can use the same kind of logic there...

IP IP Logged
Guests
Guest Group
Guest Group

Quote Guests Replybullet Posted: 25 Apr 2000 at 02:51
Re: Why not use recursion ?

I see where you're coming from, and I've _almost_ got my head around it...Basically what I have to do is create the following:Given dialup-##-#.host.com.au as a mask, I want to generate...dialup-11-1.host.com.au

dialup-11-2.host.com.au

dialup-11-3.host.com.au...dialup-23-9.host.com.au

dialup-24-0.host.com.au

dialup-24-1.host.com.au...dialup-99-7.host.com.au

dialup-99-8.host.com.au

dialup-99-9.host.com.auBasically I increment the first digit until it hits nine, then incremement the preceeding digit by one, cycle through values 0-9 again, increment preceeding digit by one, and so on.
IP IP Logged
tress
Newbie
Newbie


Joined: 05 Mar 2000
Online Status: Offline
Posts: 286
Quote tress Replybullet Posted: 25 Apr 2000 at 10:40
Re: Why not use recursion ?

this what u want to do ?

my java skills are weak so, perl -

for$a(0..99){for$b(0..9){print "dialup-",$a,"-",$b,".host.com.au\n";}print "dialup-",$a,"-",$b,".host.com.au\n";}or u want to extract the numbers from it go to 9+ and then cicle back round ?

/(\D)(\d{1,2})(\D)(\d)(\D)/;someloop{..do stuff.. ;print$2,"-",$4,"\n";..rest nums back when reach limit}hrm





plop plop
IP IP Logged
Guests
Guest Group
Guest Group

Quote Guests Replybullet Posted: 25 Apr 2000 at 11:48
Well, here's what this does...

print "dialup-10-0.host.com.au"

etc.You can improve this a little bit by not calling getdigit() again if you have no #'s left, but the difference in processing would be small anyway, so why bother.

Hey, it's a quick & dirty hack anyway :)
IP IP Logged
Guests
Guest Group
Guest Group

Quote Guests Replybullet Posted: 25 Apr 2000 at 12:56
Damn board - deej, when are you...

...going to fix it so that > signs can be used ?

Anyway - FallenAngel, just check any programming book or course on the use of recursion.

IP IP Logged
Guests
Guest Group
Guest Group

Quote Guests Replybullet Posted: 26 Apr 2000 at 02:35
Re: Well, here's what this does...

I decided to look at one of my other Java books, and lo, it was there :) *starts reading* The book I usually use didn't have it in there...Thanks for helping tho
IP IP Logged
Guests
Guest Group
Guest Group

Quote Guests Replybullet Posted: 26 Apr 2000 at 02:38
Re: Why not use recursion ?

Naw, I wanna do almost a brute-force type thing using the #s.User inputs "dialup-##-#.host.com.au"Class then outputs all possible three number combinations from 111 to 999 [in the respective areas of course].It would ideally output all values from:"dialup-11-1.host.com.au"to"dialup-99-9.host.com.au"You were right the first time, but you have the same problem there as I encountered, how to work out how many for() loops you need...
IP IP Logged
tress
Newbie
Newbie


Joined: 05 Mar 2000
Online Status: Offline
Posts: 286
Quote tress Replybullet Posted: 26 Apr 2000 at 11:46
Re: Why not use recursion ?

its just gonna be as many loops within each other as as many numbers there are u wish to do stuff with

so for 2 numbers

for()

{

for()

{

do stuff

}

do stuff

}





plop plop
IP IP Logged
Guests
Guest Group
Guest Group

Quote Guests Replybullet Posted: 26 Apr 2000 at 13:42
Re: Why not use recursion ?

Yeah, but getting my program to do as many loops as needed was the problem. See, the number of loops is dynamic, the user could input any hostmask with any number of #s, therefore any number of loops will be needed.But now I'm on the right track using recursion. Simply keep calling the same method within itself, with a counter to tell it which # to increment.
IP IP Logged
tress
Newbie
Newbie


Joined: 05 Mar 2000
Online Status: Offline
Posts: 286
Quote tress Replybullet Posted: 26 Apr 2000 at 13:47
Re: Why not use recursion ?

rightyo, recursion the way u go

good luck :)



plop plop
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

Bulletin Board Software by Web Wiz Forums version 8.04
Copyright ©2001-2006 Web Wiz Guide

This page was generated in 0.063 seconds.
  Log in  
User:
Pass:
Remember Me:
Register
Forgot Password
  Christmas Gifts  

Bar Gifts
Xmas Gifts for Him
Xmas Gifts for Dads
Gadgets and Gizmos
Sporting Gifts
Games
Unique Lifestyle Gifts
Geek Gifts
iPod Mains Charger More Gadgets

THIS SITE IS FOR SALE
Sedo - Buy and Sell Domain Names and Websites project info: info-x.co.uk Statistics for project info-x.co.uk etracker® web controlling instead of log file analysis