After the critics(:-)) i modified the script to catch only link address & don't also email.... =:-( usage: "script.pl url depth" or simply "script.pl"
#!/usr/bin/perl -w require LWP::UserAgent; open LINK, ">", "link.txt"; if (!@ARGV) { print "Insert starting URL: "; $indirizzo=<STDIN>; chomp($indirizzo); print "\nInsert searching depth: "; $profond=<STDIN>; chomp($profond); } else { $indirizzo = $ARGV[0]; $profond = $ARGV[1]; } $indirizzohttp="http://".$indirizzo; my @elencolink = $indirizzohttp; my $ua = LWP::UserAgent->new; $ua->agent('WizCaptureBot/1.11'); $ua->timeout(10); $ua->env_proxy; sub pausa #pausing the script before ending { print "\nPress Enter to exit.\n"; my $pausa = <STDIN>; } sub catturalink #procedure for url capture { my $codice = shift; my $cont = 0; while ($codice =~m/(http|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@ +?^=%&:\/~\+#]*[\w\-\@?^=%&\/~\+#])?/g) { $indirizzolink="$&"; $cont++; print LINK "$indirizzolink\n"; push @elencolink, $indirizzolink; } print "Find $cont links\n"; } sub visitapagina #capture the site code { my $pagina = shift; my $response = $ua->get("$pagina"); if ($response->is_success) { $codicehtml = $response->content; print "\n -- $pagina --\n"; catturalink($codicehtml); } else { print "\n -- $pagina --\n"; print $response->status_line."\n"; } } my $inizio=0; my $fine=0; visitapagina($elencolink[0]); while($profond!=0) { $profond--; $inizio=$fine+1; $fine = scalar(@elencolink)-1; for($c=$inizio; $c<=$fine; $c++) { print "\n$inizio $c $fine"; visitapagina($elencolink[$c]); } } print"\n Operation ended! \n"; pausa; close LINK;

In reply to Link Hunter by wizbancp

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.