入侵oracle数据库的一些技巧(4)
use strict; # a grumpy perl interpreter is your friend
select(STDOUT);$|=1;
#
# process arguments
#
my ($cmd) = $ARGV[0] if ($ARGV[0] !~ /^-/);
my ($arg);
while ($arg = shift @ARGV) {
$main::hostname = shift @ARGV if ($arg eq "-h");
$main::port = shift @ARGV if ($arg eq "-p");
$main::logfile = shift @ARGV if ($arg eq "--logfile");
$main::fakepacketsize = shift @ARGV if ($arg eq "--packetsize");
$main::fakecmdsize = shift @ARGV if ($arg eq "--cmdsize");
$main::indent = 1 if ($arg eq "--indent");
$main::rawcmd = shift @ARGV if ($arg eq "--rawcmd");
$main::rawout = shift @ARGV if ($arg eq "--rawout");
}
if ($main::hostname eq "") {
print <<_EOF_;
usage: $0 [command] -h hostname
where 'command' is something like ping, version, status, etc.
(default is ping)
[-p port] - alternate TCP port to use (default is 1521)
[--logfile logfile] - write raw packets to specified logfile
[--indent] - indent & outdent on parens
[--rawcmd command] - build your own CONNECT_DATA string
[--cmdsize bytes] - fake TNS command size (reveals packet leakage)
_EOF_
exit(0);
}
# with no commands, default to pinging port 1521
$cmd = "ping" if ($cmd eq "");
$main::port = 1521 if ($main::port eq ""); # 1541, 1521.. DBAs are so whimsical
#
# main
#
my ($command);
if (defined($main::rawcmd))
{
$command = $main::rawcmd;
}
else
{
$command = "(CONNECT_DATA=(COMMAND=$cmd))";
内容版权声明:除非注明,否则皆为本站原创文章。