[prev in list] [next in list] [prev in thread] [next in thread]
List: elza
Subject: [elza] suggested changes
From: hamann.w () t-online ! de
Date: 2001-08-03 22:44:49
[Download RAW message or body]
Hi,
this is a diff against original 1.4.7-beta code and so repeats gettag function posted
previously. The changes I added:
a) delete all fields - used once on error recovery
b) implemented persistent tunnel if keepsslalive is set to 'on'
c) some server chose to send http responses with only a code - no text
d) slight delay after starting and stopping stunnel - even on unix systems
e) implemented new var 'ordering': fields listed in there will appear first in a POST \
or GET request in that specific order - required to handle some jsp pages that insist \
on the SESSION variable first - an alternative approach would be to send fields in \
the order they were found in html page or defined by field statements
f) printraw \a - make a joyful noise if long-running scripts finish
g) add eq and ne for exact comparisons - probably not useful for comparing to \
%%body%% etc.
Wolfgang Hamann
--- orig/elza.pl Sat Aug 4 00:03:34 2001
+++ elza Sat Aug 4 00:07:07 2001
@@ -398,6 +398,11 @@
$BogusFieldSize = $Param[3];
$BogusTextSize = $Param[4];
} elsif ($ToBeDeleted > 0) {
+ if ($Param[1] eq '%ALL%') {
+ %FLD = ();
+ $AnyFields = 0;
+ return;
+ }
delete $FLD{$Param[1]};
} else {
$FLD{$Param[1]} = $TempValue;
@@ -468,7 +473,7 @@
} else {
shout ('critical', "Syntax errror: $ParamAfter[0] .");
}
- } elsif (($Param[0] eq 'get') || ($Param[0] eq 'post') || ($Param[0] eq 'head') || \
($Param[0] eq 'request')) { + } elsif (($Param[0] eq 'get') || ($Param[0] eq 'post') \
|| ($Param[0] eq 'head') || ($Param[0] eq 'request') || ($Param[0] eq 'gettag')) { \
if ($Param[0] ne 'request') { $VAR{method} = uc($Param[0]);
} else {
@@ -529,9 +534,14 @@
}
# Send the next request.
+ if($Param[0] ne 'gettag') {
&SendRequestToHost;
- %FLD = ();
shout ('debug', "REQUEST: We are done with \' $TheCommand \'");
+ } else {
+ $VAR{TAG} = $VAR{url};
+ shout ('debug', "stored $VAR{url} in TAG");
+ }
+ %FLD = ();
return;
} elsif ($Param[0] eq 'pause') {
print STDOUT "--- Ran into pause command. Hit ENTER to continue ...";
@@ -684,6 +694,7 @@
return;
} elsif ($Param[0] eq 'exit') {
print " Exiting ... \n";
+ &SSLKillTunnel;
exit;
} elsif ($Param[0] eq 'print') {
if ($Param[1] eq 'cookies') {
@@ -830,8 +841,12 @@
}
sub ParseHeaderParts {
- $RawResponse[0] =~ /(.*?) (.*?) (.*)/;
- $VAR{'protoversion'} = $1;$VAR{'retcode'} = $2;$VAR{'rettext'} = $3;
+ if($RawResponse[0] =~ /(.*?) (.*?) (.*)/)
+ { $VAR{'protoversion'} = $1;$VAR{'retcode'} = $2;$VAR{'rettext'} = $3;
+ }
+ elsif($RawResponse[0] =~ /(.*?) (\d+)/)
+ { $VAR{'protoversion'} = $1;$VAR{'retcode'} = $2;$VAR{'rettext'} = '';
+ }
if (($VAR{in_attack} > 0) && ($VAR{'retcode'} != '401') && ($VAR{'retcode'} != \
'407') && ($VAR{'retcode'} != '400') && ($VAR{'retcode'} != '500')
@@ -1103,6 +1118,14 @@
}
sub SSLSpawnTunnel {
+
+ if($SSLTunnelFunctional ne '' && $SSLTunnelFunctional ne \
"$SSLRemoteHost:$SSLRemotePort") + { shout ('debug', "TUNNEL: Making new connection \
to $SSLRemoteHost:$SSLRemotePort."); + &SSLKillTunnel;
+ }
+ elsif($SSLTunnelFunctional eq "$SSLRemoteHost:$SSLRemotePort")
+ { return;
+ }
my $TmpCmdLine;
$TmpCmdLine = $DEF{'sslcmd'};
@@ -1130,15 +1153,17 @@
shout ('verbose', " Spawned. Waiting for 5 seconds ...");
sleep 5;
} else {
+print STDERR "$TmpCmdLine\n";
`$TmpCmdLine`;
+ sleep 2;
}
- $SSLTunnelFunctional = 1;
+ $SSLTunnelFunctional = "$SSLRemoteHost:$SSLRemotePort";
}
sub SSLKillTunnel {
- return if ($SSLTunnelFunctional != 1);
+ return if ($SSLTunnelFunctional eq '');
shout ('verbose', "Killing SSL Tunnel to $VAR{'host'}:$VAR{'port'}. ");
if ($^O =~ /win/i) {
@@ -1147,7 +1172,7 @@
`killall $DEF{'sslapp'}`;
}
- $SSLTunnelFunctional = 0;
+ $SSLTunnelFunctional = '';
}
sub RequestFileURL {
@@ -1235,9 +1260,20 @@
if ($AnyFields > 0 ) {
# Build QUERY string
+ if(defined $VAR{ordering}) {
+ foreach $key (split /\s+/, $VAR{ordering}) {
+ if(defined $FLD{$key}) {
+ $VAR{allfields}.="$key=$FLD{$key}&";
+ shout ('verbose', ">>> Field (ordered): $key = $value");
+ undef $FLD{$key};
+ }
+ }
+ }
while (($key,$value) = each %FLD) {
- $VAR{allfields}.="$key=$value&";
- shout ('verbose', ">>> Field: $key = $value");
+ if(defined $FLD{$key}) {
+ $VAR{allfields}.="$key=$value&";
+ shout ('verbose', ">>> Field: $key = $value");
+ }
}
$AnyFields = 0;
$VAR{allfields} =~ s/ /+/g;
@@ -1502,7 +1539,7 @@
$VAR{'ses_speed'} = sprintf ("%d", $VAR{'ses_speed'});
$SuccessfulRequests++;
- &SSLKillTunnel;
+ &SSLKillTunnel if($VAR{'keepsslalive'} ne 'on');
if ($RawResponse[0] ne '') {
if ($VAR{in_attack} < 1) {
@@ -1564,12 +1601,14 @@
} elsif ($NoiseLevel eq 'critical') {
print STDOUT "!!! $ShoutLine";
print STDOUT " Terminating ...\n";
+ &SSLKillTunnel;
exit;
} elsif ($NoiseLevel eq 'user') {
print STDOUT "=== $ShoutLine\n";
} elsif ($NoiseLevel eq 'raw') {
$ShoutLine =~ s/\\n/\n/g;
$ShoutLine =~ s/\\t/\t/g;
+ $ShoutLine =~ s/\\a/\a/g;
print STDOUT $ShoutLine;
} elsif ($VAR{shout} eq 'silent') {
return;
@@ -1654,7 +1693,11 @@
my $Result = 0;
if (($First =~ /$Second/si) && ($Condition eq '==')) {
- $Result = 1;
+ $Result = 1;
+ } elsif($First eq $Second && $Condition eq 'eq') {
+ $Result = 1;
+ } elsif($First ne $Second && $Condition eq 'ne') {
+ $Result = 1;
} elsif ((!($First =~ /$Second/si)) && ($Condition eq '!=')) {
$Result = 1;
} elsif (($First > $Second) && ($Condition eq '>')){
To Post a message, send it to: elza@eGroups.com
To Unsubscribe, send a blank message to: elza-unsubscribe@eGroups.com
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic