Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
use strict; use Data::Random::WordList; use CGI qw/:standard/; my $cgi = CGI->new(); my ($punct, # punctuation, . ! ? or : @punct, $punc, $tld); # top-level domain my $log = "/webroot/logs/raid"; my $wordlist = "/usr/share/dict/american-english"; ######################################################### # To activate this in Apache, add these two lines to your # httpd.conf in the appropriate section: # # AddHandler cgi-script .cgi .pl # AliasMatch ^/raid/.* /path/to/this/cgi/raid.pl # ^^^^^ my $ap_alias = "/raid/"; ######################################################### # list of domains hosted on this machine that will always # point to this script: my @domains = qw/www.foo.bar foo.bar foo.com/; # Throttle # sleep(10); # wrapped for Perl Monks, this is not a multi-line regex exit if ($ENV{HTTP_USER_AGENT} =~ /google|Googlebot| inktomi|search| altavista|wget|htdig/i); if (-e $log ) { open LOG, ">>$log"; } else { open LOG, ">$log"; } my $time = localtime; print LOG "$time $ENV{'REMOTE_ADDR'} $ENV{'HTTP_HOST'}$ENV{'REQUEST_URI'}" . " $ENV{'HTTP_REFERER'} \"$ENV{'HTTP_USER_AGENT'}\"\n"; close LOG; $punct[1] = "."; $punct[2] = "!"; $punct[3] = "\?"; $punct[4] = ":"; my $numurl = my @url = map { "${_}${ap_alias}" } @domains; ######################################################### # Select 'n' words at random from the list, sorted my $wl = new Data::Random::WordList( wordlist => '/usr/share/dict/american-english'); my @word = $wl->get_words(2000); $wl->close(); my $wordnum = @word; # Create a random title from those random words in the list my $title = $word[int(rand $wordnum)] . " " . $word[int(rand $wordnum)] . " " . $word[int(rand $wordnum)] . " " . $word[int(rand $wordnum)]; print $cgi->header(), start_html(-title => "$title", -bgcolor => '#ffffff'); my $para = int(rand 10)+3; my $pagenum = 0; while($pagenum < $para) { $pagenum++; my $words_in_page = int(rand 80)+10; my $total_words = 0; while($total_words < $words_in_page) { $total_words++; my $prword = $word[int(rand $wordnum)]; print "$prword"; if((rand 10)<1) { $punc = $punct[int(rand 4)+1]; print $punc . br() . "\n"; } print " "; } print br(), "\n"; my $num_addr = int(rand 10)+10; my $pres_addr = 0; while ($pres_addr < $num_addr) { my $urlpos; $pres_addr++; my $name = $word[int(rand $wordnum)]; my $d1 = $word[int(rand $wordnum)]; my $d2 = $word[int(rand $wordnum)]; if((rand 4)>1) { if((rand 3)>1) { $tld = "com"; } else { $tld = "net"; } } else { $tld = "org"; } my $mailaddr = $name . '@' . $d1 . $d2 . "." . $tld; if((rand 4)>3) { my $urlh = "http://"; my $urlb = $url[int(rand $numurl)]; my $urlt = $word[int(rand $wordnum)]; if ((rand 5)>1) { $urlt .= ".html"; } else { $urlt .= "/"; } $urlpos = $urlh . $urlb . $urlt; } else { $urlpos = "mailto:" . $mailaddr; } print a({-href => "$urlpos"}, "$mailaddr"), br(), "\n"; } } print end_html(), "\n"; exit;

In reply to Can-o-Raid v1.0 by hacker

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-26 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found