ASNMTAP
view release on metacpan or search on metacpan
applications/htmlroot/cgi-bin/runCmdOnDemand.pl view on Meta::CPAN
$capture_html = 0;
print "$capture\n</td></tr>\n";
} elsif ( ! $capture_text and $capture =~ /^scan_socket_info :|^<!---Start debug:-->/ ) {
$capture_text = 1;
print "</td></tr><tr><td class=\"RunCmdOnDemandCaptureTrue\"><pre>$capture\n";
} elsif ( ! $capture_debug and $capture =~ /^Start time :|^Status :/ ) {
$capture_debug = 1;
print "</td></tr><tr><td class=\"RunCmdOnDemandCaptureDebug\"><pre>$capture\n";
} elsif ($capture =~ /WebTransact::response_time: /) {
push (@WebTransactResponses, $capture);
} elsif ($capture =~ /WebTransact::timing_tries: /) {
push (@WebTransactResponses, $capture);
} elsif ($capture ne '') {
if ($capture_debug) {
print "$capture\n";
} elsif ($capture_text) {
print "$capture\n";
} elsif ($capture_html) {
$capture =~ s/(window.location.href)/\/\/$1/gi;
# RFC 1738 -> [ $\/:;=?@.\-!*'()\w&+,]+
$capture =~ s/(<META\s+HTTP-EQUIV\s*=\s*\"Refresh\"\s+CONTENT\s*=\s*\"\d+;\s*URL\s*=[^"]+\"(?:\s+\/?)?>)/<!--$1-->/img;
# remove password from Basic Authentication URL before putting into database!
$capture =~ s/(http[s]?)\:\/\/(\w+)\:(\w+)\@/$1\:\/\/$2\:********\@/img;
# comment <SCRIPT></SCRIPT>
$capture =~ s/<SCRIPT/<!--<SCRIPT/gi;
$capture =~ s/<\/SCRIPT>/<\/SCRIPT>-->/gi;
# replace <BODY onload="..."> with <BODY>
$capture =~ s/<BODY\s*onload\s*=\s*.*\s*>/<BODY>/gi;
print "$capture\n";
} elsif ($capture_long) {
print "$capture<br>\n";
} else {
print "<tr><td class=\"RunCmdOnDemandCaptureTrue\">$capture</td></tr>\n";
}
}
}
foreach my $WebTransactResponses (@WebTransactResponses) {
print "</td></tr><tr><td class=\"RunCmdOnDemandCaptureTime\">$WebTransactResponses\n";
}
print "<tr><td> </td></tr>\n" if ($capture_array == 0);
my ($status, undef) = split(/ - /, $capture_array[$capture_array], 2);
$status = ( $status =~ /(^OK|^WARNING|^CRITICAL|^UNKNOWN|^DEPENDENT|^OFFLINE|^NO TEST)/ ) ? $1 : 'UNKNOWN';
print '</table><br><IMG SRC="', $IMAGESURL, '/', $ICONS{$status}, '" ALT="$status" WIDTH="16" HEIGHT="16" BORDER=0 ALIGN="middle"> ', encode_html_entities('M', $capture_array[$capture_array]), "<br>";
} else {
print "<br>Select application for immediate launch.<br>";
}
}
print '<BR>', "\n";
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
sub maskPassword {
my ($parameters) = @_;
# --dnPass=
if ($parameters =~ /--dnPass=/) {
$parameters =~ s/(--dnPass=)\w+/$1********/g;
}
# --proxy=user:pasword\@proxy
if ($parameters =~ /--proxy=/) {
$parameters =~ s/(--proxy=\w*:)\w*(\@\w+)/$1********$2/g;
}
# -p user:pasword\@proxy
if ($parameters =~ /-p / and ($parameters !~ /-u / and $parameters !~ /--username=/)) {
$parameters =~ s/(-p \w*:)\w*(\@\w+)/$1********$2/g;
}
# --password=
if ($parameters =~ /--password=/) {
$parameters =~ s/(--password=)\w+/$1********/g;
}
# --username= or -u and --password= or -p (database plugins)
if ($parameters =~ /-p / and ($parameters =~ /-u / or $parameters =~ /--username=/)) {
$parameters =~ s/(-p )\w+/$1********/g;
}
# --username= or -U and --password= or -P (ftp plugins)
if ($parameters =~ /-P / and ($parameters =~ /-U / or $parameters =~ /--username=/)) {
$parameters =~ s/(-P )\w+/$1********/g;
}
# j_username= or j_password= (J2EE based Applications)
if ($parameters =~ /j_username=/ and $parameters =~ /j_password=/) {
$parameters =~ s/(j_password=)\w+/$1********/g;
}
return ($parameters);
}
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
print_legend (*STDOUT);
print '</BODY>', "\n", '</HTML>', "\n";
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
( run in 0.576 second using v1.01-cache-2.11-cpan-39bf76dae61 )