![]() |
|< 1 2 >| | ![]() |
12 Einträge, 2 Seiten |
Gast+2008-09-18 17:00:49--Wir suchen jemand, der sich das mal ansehen kann. Hätten daran jemand Interesse?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
$path="e:\\var\\www\\lars\\io\\"; $TimeOutMinutes = 5; $debug = 0; $filenr = 0; $NewFilename=""; $ext=""; binmode STDIN; srand(time()^($$+($$<<15))); $user_input = read(STDIN, $Buffer, $ENV{CONTENT_LENGTH}); open DBG, ">$path" . "debug.trc" if $debug; print DBG $Buffer if $debug; close(DBG) if $debug; $exists = 1; $last = int(rand(99999)) + 1; while($exists != 0) { $last = int(rand(99999)) + 1; $name = $path."h".$last.".in"; if(open(TESTDAT, $name) != 0 ) { close(TESTDAT); $exists = 1; } else { if ( open(TESTDAT,$path."h".$last.".tmp") != 0 ) { close(TESTDAT); $exists = 1; } else { open(LARSOUT, ">".$path."h".$last.".tmp"); $exists = 0; } } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
open DBG, ">$path" . "debug.log" if $debug; binmode DBG; print DBG "content_length:$ENV{CONTENT_LENGTH}\n" if $debug; if( $Buffer =~ /^-----------------------------\d{10,20}/ ) { print DBG $Buffer if $debug; print DBG "Blockid.:$&\n" if $debug; $CountLines = 1; @Blocks = split( /$&/, $Buffer ); undef $Buffer; $Buffer="ANSI2ASCII" ; foreach $Block (@Blocks) { # print DBG "Blocknr.:" . ++$BlockNr . "\n" if $debug; @Lines = split( /\015\012/, $Block ); shift @Lines; foreach $Line (@Lines) { # print DBG "Linenr.:" . ++$LineNr . "\n" if $debug; if( $Line =~ /.*Content-Disposition: .*name="([^"]+)"; filename="(.*)"/ ) { $Fieldname = &Ansii2Ascii( $1 ); $Filename = &Ansii2Ascii( $2 ); $Filename =~ s/.*\\([^\\]+)$/$1/; $Filename =~ s/\.(...).*$/\.$1/; # print DBG "File.:$Filename\n" if $debug; if ( $Filename ) { $filenr = $filenr + 1; ($ext=$Filename)=~s/.*\.(.*)/\.$1/ if $Filename=~/\..+/; $NewFilename = "f".$filenr.$last.$ext; } else { $NewFilename = ""; } $Buffer .= "&_org$Fieldname=$Filename" if $Filename; $Buffer .= "&$Fieldname=$NewFilename"; last if ! ($Block =~ s/[\s\S]*Content-Type:[^\n]*\n//); chop $Block; chop $Block; open FILEOUT, ">$path$NewFilename"; binmode FILEOUT; print FILEOUT substr( $Block, $EmptyLines * 2 ); close FILEOUT; last; } elsif( $Line =~ /Content-Disposition: form-data; name="(.+)"/ ) { $name = $1; $Buffer .= "&" . &Ansii2Ascii( $1 ) . "="; $FldEmptyLines = 0; # print DBG "Varname:$1\n" if $debug; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
elsif( $Line =~ /\S+/ ) { if( $name ) { $FldEmptyLines -= $EmptyLines; } else { $FldEmptyLines++; } undef $name; $Buffer .= '%0D%0A' x $FldEmptyLines; $FldEmptyLines = 0; $Buffer .= &Ansii2Ascii( $Line ); print DBG "Varvalue:$Line\n" if $debug; $CountLines = 0; } else { $CountLines && $EmptyLines++; $FldEmptyLines++; } } } $Buffer =~ s/^&//; } close DBG if $debug; unlink $path."h".$last.".tmp"; unlink $path."h".$last.".out"; $name = $path."h".$last.".tmp"; print LARSOUT $Buffer; close(LARSOUT); rename( $name, $path."h".$last.".in" ); &Timer( 'Start' ); $gefunden = 0; while($gefunden != 1) { $name = $path."h".$last.".out"; if(open(NEUDAT, "<".$name) != 0) { $gefunden = 1; } else { exit if &Timer( 'Test' ); sleep 1; } } print "Content-type: text/html\n\n"; while(<NEUDAT>) { print; } close(NEUDAT); $name = $path."h".$last.".out"; unlink $name; sub Ansii2Ascii { local( $wert ) = @_; # $wert =~ s/(.)/$map{$wert} || $wert /ge; $wert =~ s/\&/%26/g; return $wert; } sub Timer { local( $What ) = @_; if( $What eq 'Start' ) { $StartTime = time(); return 0; } elsif( $What eq 'Test' ) { return ( time() - $StartTime ) > $TimeOutMinutes * 60; } }
![]() |
|< 1 2 >| | ![]() |
12 Einträge, 2 Seiten |