PLA Forums

Other Stuff That Has Little To Do With PLA => Techinical Shit => Phreaking, Hacking, Social Engineering, Lock Picking => Topic started by: trevelyn on September 20, 2007, 12:32:52 PM

Title: net-seeker program
Post by: trevelyn on September 20, 2007, 12:32:52 PM
you guys remember DNS the planet?? the reason why the "MOTD" of WHOIS is now really long and pathetically lawful and licit?? well, i was thinking about it, and i made one too. but mine you can use for nmap/whois/nikto/nslookup/etc.  Just give it the program you want to ...
i am running this from many many machines and am ammending the |o to a file i hope will reach many GB in size. teh GB will be big enough.

Code: [Select]
#!/usr/bin/perl
#DNS TEH PLANET, written by Trevelyn. "if teh roof is on fire, it's an electrical fault."
($arg) = @ARGV;
if ($arg eq "-h") { print "USAGE ./net-seek.pl <n> where <n> = 1,2,3,...,inf\n
makes an output, net-seek.OUT.txt"; exit;}
if ($arg eq "") { print "type ./net-seek.pl -h for help.\n"; exit; }
if ($arg eq "-s") { print "[b][color=red]My own mediocre attempt at humor has been highly amusing to myself.[/color][/b] HI\n"; exit;}
print "what network tool would you like to sex?... ";
$tool = <STDIN>; chomp $tool; $n = 0;
while ($n < $arg) { $range = 255;
        $ran0 = int(rand($range)); $ran1 = int(rand($range));
        $ran2 = int(rand($range)); $ran3 = int(rand($range));
        system ("$tool $ran0.$ran1.$ran2.$ran3 >> net-seek-OUT.txt"); $n++;}

   
save it as net-seek.pl and cd into that dir.  chmod +x net-seek.pl, and simply ./net-seek.pl
piece ouTTY.
Title: Re: net-seeker program
Post by: breaknick on September 26, 2007, 11:26:08 PM
what a joke
Title: Re: net-seeker program
Post by: RijilV on September 27, 2007, 05:19:47 PM
meh, I typically just use a simple bash for loop for that..this requires bash 3.x.  either save it for export it as a function within your shell. You call it like: "foo.sh 149.101.1 nmap -O > my-output"

Code: [Select]
for ip in {1..254}; do
   ${@:2} ${1}.ip
done

it should also be noted that nmap supports doing a range of IPs natively.  Also, nmaping a range of IPs for no reason is really lame.  Whois servers also have a tendency to block you IP.

Also, I don't know where you learned perl, but your code looks terrible.  Just to go down it line by line:

Code: [Select]
#!/usr/bin/perl
You should use /usr/bin/perl -w to print warnings and such.  Also you should write your programs with 'use strict;'

Code: [Select]
($arg) = @ARGV;
Uhg, just use $ARGV[0].  or if you're going to call the first argument something, call it something meaningful.  "$arg" isn't any better than $ARGV[0] in terms of readablity.  Also, it would be better written as "my $tries = shift @ARGV"

Code: [Select]
if ($arg eq "-h") { print "USAGE ./net-seek.pl <n> where <n> = 1,2,3,...,inf\n
makes an output, net-seek.OUT.txt"; exit;}
if ($arg eq "") { print "type ./net-seek.pl -h for help.\n"; exit; }
if ($arg eq "-s") { print "[b][color=red]My own mediocre attempt at humor has been highly amusing to myself.[/color][/b] HI\n"; exit;}
All of these lines suck for the same reason.  You never test to see if the input is what you expect it to be, namely a digit.  Cut the crap too, its not cool.  The whole thing would be better written as:
Code: [Select]
if ($tries !~ /^\d+$/) {
  print "Usage: $0 <n>\n";
  exit 1;
}

Code: [Select]
print "what network tool would you like to sex?... ";
$tool = <STDIN>; chomp $tool; $n = 0;
What the hell is that crap?  Why don't you just read the command to run on the command line like any other normal human? 

Code: [Select]
while ($n < $arg) { $range = 255;
        $ran0 = int(rand($range)); $ran1 = int(rand($range));
        $ran2 = int(rand($range)); $ran3 = int(rand($range));
        system ("$tool $ran0.$ran1.$ran2.$ran3 >> net-seek-OUT.txt"); $n++;}
so wait, couldn't that generate 0.0.0.0?  Is that a valid IP?  and couldn't it generate 255.255.255.255?  Wouldn't that also generate IPs in the D and E class, which are multicast and unused?  Who the hell taught you to format code like that?  Also, why the hell should I have to save my output as "net-seek-OUT.txt"?  Why don't you check to make sure that I can actually write to "net-seek-OUT.txt".  Why aren't you using a for loop if you're going to increment the counter the same way every time?  Why do you set $range every single time you're in that loop?
Title: Re: net-seeker program
Post by: trevelyn on September 29, 2007, 12:28:46 PM
16:24 <@trevelyn> !dice d20
16:24 <@phreaker> trevelyn, d20: 7 [Total: 7 (Low), Avg: 7.00]

o_o "OUCH!" *trevelyn gets hit with a wall of flames!*

     Factors related to or dependent upon other factors, will for my distant fate, include me punishing myself later for oppressing you with this mockery of 'your' staple.  No one taught me Perl, nor do i  have a Perl book (which i soooooo hoped someone would have offered in the trading thread - thats why i put so much stuff up for grabs)  I learned simply from looking at other peoples code or googling functions plus the word "Perl."  Oh, and bugging my friends on IRC for help, I am forever in their debt (realizing after reading your response) for their patience.  Your examples are much stronger i agree in examination of my LOC.  I will save them for future use, and consider dropping monies on a Perl Book soon (I'm sure Half Priced Books will have one soon).  Though i have to say your esteem for eloquence seems high, but of mediocre earnestness.  If you were trying to really "help" thank you, i really appreciate it.  But, If the ratio of [Heuristic(ness)] to [Gratuitous "masters's" lvl of knowledge/ego] in the universe of our discourse (anything internet related) is this high it's almost axiomatic someone will intervene with a profane attitude.  - dewd, my program was FILLED with raillery!?!? Rijiivijiv.   thanks again guys. - trev.   :)                 
Title: Re: net-seeker program
Post by: RijilV on September 29, 2007, 11:54:37 PM
----------- Main perl site ----------------
Get all the docs here:
http://perldoc.perl.org/

Good tutorials:
http://perldoc.perl.org/index-tutorials.html

Nice index of docs:
http://perldoc.perl.org/perl.html

Formatting your code guide:
http://perldoc.perl.org/perlstyle.html


----- other sites ------

Perl monks rock:
http://www.perlmonks.org/

Perl beginner's site:
http://perl-begin.org/

Perl wiki:
http://www.perlfoundation.org/perl5/

Bunch more links:
http://kgptech.blogspot.com/2005/07/perl.html




No really, you don't need to buy/acquire a book.  Though if you're hell bent on a book (warning, I haven't read these):

http://thepiratebay.org/tor/3763670/Wicked_Cool_Perl___Scripts_-_Useful_Scripts_That_Solve_Difficult
http://thepiratebay.org/tor/3762248/Perl__Hacks_-_Tips_And_Tools_For_Programming_Debugging_And_Survi
http://thepiratebay.org/tor/3712030/Learning_Perl__4th_Edition
http://thepiratebay.org/tor/3711486/Advanced_Perl_Programming__2nd_Edition
http://thepiratebay.org/tor/3707502/Intermediate_Perl
http://thepiratebay.org/tor/3559281/Perl_Programmers_Reference_Guide.pdf

Title: Re: net-seeker program
Post by: breaknick on September 30, 2007, 12:19:56 AM
why do I get the distinct feeling you've participated in perl underground? hm.... wheres "dr" krawetz when you need an (incorrect) profiling of writing samples.
Title: Re: net-seeker program
Post by: trevelyn on September 30, 2007, 09:38:32 AM
whoa..
Quote
Perl beginner's site:
http://perl-begin.org/
is nice :D  Wino sent me a nice site too that i never saw before.  thanks! I am going to try the torrent books too, but theres only 1 im sure id understand - beginners guide ._.
thanks! - trev