#!/usr/bin/perl # # MiniVendor -- MiniVend configuration uploader # # Copyright 1997 Internet Robotics and Mike Heins ALL RIGHTS RESERVED # # This is proprietary source code of Internet Robotics. No duplication # or reproduction is permitted without the express written consent of: # # Internet Robotics, 131 Willow Lane, Floor 2, Oxford, OH 45056 # # use vars qw($VERSION $UPLOAD_DIR); # use Carp; use POSIX qw(tmpnam); use strict; $VERSION = substr(q$Revision: 0.0 $, 10); use CGI_Lite; my $NAILPROG = '/home/minivend/bin/nailem'; my $NAILEM_URL = '/cgi-bin/nph-nailem.cgi'; my $NAILEM_FORM = '/cgi-bin/nailem.html'; my $prog = $0; $prog =~ s:.*/::; my $status_line = ''; if($prog =~ /^nph-/) { $status_line = "HTTP/1.0 200 OK\n"; $| = 1; } else { print_form(); exit; } # Return this message to the browser when a system error occurs. # sub die_page { my ($msg, $extended) = @_; print $status_line; print <

This usually means something went wrong with the trace. All the bugs are not out yet! It may work the next time -- use your back button to try again. EOF if($extended) { print <

EOF } print < EOF exit; } my $Hostchars = '[-A-Z@a-z0-9]'; my $Nothost = '[^-\sA-Za-z0-9.]'; sub print_form { my $trust = $ENV{REMOTE_HOST}; $trust =~ m[ ( $Hostchars+\. $Hostchars{3} | $Hostchars+\. $Hostchars+\. $Hostchars{2} )$]xo and $trust = $1; print $status_line; print < Nail 'em! -- generate a spam complaint

Nail 'em!

Generate a spam complaint

To use this program, place the spam message in a file and then upload it, or clip and paste it to the text area. You must keep the header lines in the proper format for the program to find the source.

You should enter the names of any trusted backbones or networks in the TRUSTED DOMAINS entry, space-separated. We tried to insert your provider to begin with. If you are connected through one or more other networks then you probably will want to include them in the field.

Traceroutes that go through the backbones hosting this CGI will not generate complaints to those upstreams.

Check the generated complaint for correctness and then send the results to sendmail or some other mailer. Often you will want to trim the To: field -- if the program doesn't find an injecting host, you will probably want to discard the results.

Send comments, problems, kudos, and complaints to: nospam\@minivend.com


From file      File to send:

WARNING: This can take several minutes if there are lots of traces to be done!

 Append traces   Append whois records   Debug mode   Check for click-through

Send clipped message
NOTE: If you are clipping from within a mailer, you need to select full headers. The more standard the format, the better, though the program will try to correct problems caused by Netscape and other suspect mail agents.

You are welcome to the source for these programs, but due to lack of time there will be absolutely no questions answered about it. Don't download these unless you know Perl and are prepared for some heavy going. (program) (CGI front-end) EOF } if($ENV{REQUEST_METHOD} eq "GET") { print_form(); exit; } elsif($ENV{REQUEST_METHOD} eq "HEAD") { exit; } elsif($ENV{REQUEST_METHOD} ne "POST") { die_page "Unrecognized request method.\n"; } my $q = new CGI_Lite (); #$q->set_directory($UPLOAD_DIR) # or die_page "Couldn't set directory to $UPLOAD_DIR: $!\n"; my $data = $q->parse_form_data(); my $file; if($$data{send_method} eq 'clip') { $file = $$data{clipped_message}; } elsif($$data{send_method} eq 'file' or $$data{'first_file'}) { $q->set_file_type ("handle"); $file = $$data{'first_file'}; } elsif($$data{clipped_message}) { $file = $$data{clipped_message}; } die_page("No data! Check the file you sent or what you pasted in.") unless $file; my $trusted = $$data{'trusted'}; my $trace_mode = $$data{'trace_mode'}; my $whois_mode = $$data{'whois_mode'}; my $debug_mode = $$data{'debug_mode'}; my $click_check = $$data{'click_check'}; $trace_mode = '-a' if $trace_mode; $whois_mode = '-w' if $whois_mode; $debug_mode = '' unless $debug_mode eq '-D'; $click_check = '' unless $click_check =~ /-C/; if($trusted) { $trusted =~ tr/,/ /; $trusted =~ m/($Nothost)/ and do { my $char = $1; die_page ("Bad character $char in trusted hosts field."); }; $trusted = "-t '$trusted'"; } if ($file =~ /\r\n/) { $file =~ s/\r//g; } else { $file =~ s/\r/\n/g; } my $infile = POSIX::tmpnam(); my $errfile = "$infile.err"; open(IN, ">$infile") or die_page( "Couldn't open output file: $!\n"); print IN $file; close IN; open(NAILEM, "$NAILPROG $trusted $whois_mode $click_check $trace_mode $debug_mode $infile 2>$errfile|") or die "cannot fork: $!"; print $status_line; print <) { print; } close NAILEM; if($?) { my $s = $?; my $sig = $? & 255; my $msg = "Status: $s\n"; $msg .= "Error: " . ($! || 'unknown' ) . "\n\n"; $msg .= "Died on signal: $sig\n\n" if $sig; if (-s $errfile) { $msg .= "

		open(OUT, $errfile) or warn "Couldn't open error file: $!\n";
		while () { $msg .= "$_" }
		close OUT;
		$msg .= "\n";

unlink $errfile;