#!/usr/bin/perl print "Content-type:text/html\n\n"; print <SPCard Authentication Information EndOfHTML $ip=$ENV{'REMOTE_ADDR'}; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @ans = split(/&/, $buffer); #ans will contain variable "custadd=somestring", "transno=439585" ($temp, $custadd) = split(/=/, $ans[0]); ($temp, $compadd) = split(/=/, $ans[1]); ($temp, $transno) = split(/=/, $ans[2]); ($temp, $amount) = split(/=/, $ans[3]); ($temp, $url) = split(/=/, $ans[4]); $custadd =~ tr/+/ /; $custadd =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $compadd =~ tr/+/ /; $compadd =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $transno =~ tr/+/ /; $transno =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $amount =~ tr/+/ /; $amount =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $url =~ tr/+/ /; $url =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; srand (time ^ $$ ^ unpack "%32L*", `ps axww | gzip`); #a truely random seed unlike time #challenge string generation $challenge=""; for($i=0;$i<16;$i++) { $temp=chr(rand(256)); if(($temp eq "|") || ($temp eq "\n") || ($temp eq "\r")) { $temp="r";} $challenge=join("",("$temp",$challenge)); } open(outf,">$ip.txt"); flock(outf,2); print outf "$challenge|$custadd|$compadd|$transno|$amount\n"; close(outf); system("./rsa S $ip.txt $ip.sign"); #temp 4 lines #open(outf,">chall.txt"); #flock(outf,2); #print outf "$challenge"; #close(outf); print <
Welcome to Secure Payment Card


Download EndOfHTML print " file1 and file2"; print <

Important Note: Check all the information provided by the software
Enter the authentication information only if all the information is correct.


Enter you SPCard ID and response to the challange to pay the bill

ID:

Response:

EndOfHTML print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print <

EndOfHTML