PHP Script to get the user list, total share / for each user

Problems compiling? Don't understand the source code? Don't know how to code your feature? Post here.

Moderator: Moderators

[RO]VeNoM
Posts: 11
Joined: 2003-05-04 19:36

PHP Script to get the user list, total share / for each user

Post by [RO]VeNoM » 2003-05-04 19:44

I open a connection with the server using fsockopen.
I get the $Lock then :

Code: Select all

            $key = array ();
           
            for ($i = 1; $i < strlen($lock); $i++) {
              $key[$i] = $lock[$i] xor $lock[$i-1];
            }
       
            $key[0] = $lock[0] xor $lock[strlen($lock)-1] xor $lock[strlen($lock)-2] xor 5;
       
            for ($i = 0; $i < count($key); $i++) {
              $key[$i] = (($key[$i]<<4) & 240) | (($key[$i]>>4) & 15);
            }

             $key = implode ('', $key);

              $array = array ('000', '005', '036', '096', '124', '126');
       
              foreach ($array as $a) {

                $key = str_replace ($a, "/%DCN".$a."%/", $key);

              }

           fputs ($fp, '$Key '.$key);
           fputs ($fp, '$ValidateNick [RO]VeNoM23');

           fputs ($fp, '$Version PHP-DC v0.1');
           fputs ($fp, '$GetNickList');


It's this correct ?

ivulfusbar
Posts: 506
Joined: 2003-01-03 12:33

Post by ivulfusbar » 2003-05-05 04:44

no its not correct.
Everyone is supposed to download from the hubs, - I don´t know why, but I never do anymore.

[RO]VeNoM
Posts: 11
Joined: 2003-05-04 19:36

Post by [RO]VeNoM » 2003-05-05 05:32

Can you please help me get the $key in PHP ?
Lock = $lock;

Code: Select all

            $key = array ();
           
            for ($i = 1; $i < strlen($lock); $i++) {
             $key[$i] = $lock{$i} xor $lock{$i-1};
            }
           
            $key[0] = $lock[0] xor $lock[strlen($lock)-1] xor $lock[strlen($lock)-2] xor 5;
            $newkey = array ();
            $key = implode ('', $key);
            for ($i = 0; $i < strlen ($key); $i++) {
             $newkey[$i] = (($key{$i}<4) & 240) | (($key{$i}>4) & 15);
            }
            $newkey = implode ('', $newkey);
              $array = array ('000', '005', '036', '096', '124', '126');
       
              foreach ($array as $a) {

                $newkey = str_replace ($a, "/%DCN".$a."%/", $newkey);

              }

[RO]VeNoM
Posts: 11
Joined: 2003-05-04 19:36

Post by [RO]VeNoM » 2003-05-06 10:45

Code: Select all

class LockDecode
{
  /**
   * Computes the $Key response to a given $Lock command.
   *
   * @param lock is the Lock string in the middle of "$Lock (.*) Pk=".
   * @param xorKey is 0x05 for a connection from a client to a hub,
   * or (localPort+(localPort>>8))&0xFF for a connection from a hub
   * to the hublist.
   */
  function decode($lock)
    {
      $key = '';

      $lockLength = strlen ($lock);

      // The first byte is handled separately from the first, last,
      // and second to last bytes.
      $a1 = $lock{0};
      $a2 = $lock{$lockLength - 1};
      $a3 = $lock{$lockLength - 2};

      // Xor them all and swap nibbles.
      $char1 = $a1 ^ $a2 ^ $a3 ^ 5;
      $char2 = (($char1<<4)&240) | (($char1>>4)&15);

      $key .=$char.$char2;

      // And do the rest of the bytes.
      for ($i = 1; $i < $lockLength; $i++)
      {
   // Each key byte is the xor of the corresponding lock byte
   // and the one before it, nibble-swapped (that's why the
   // first is special).
   $a5 = $lock{$i};
   $a6 = $lock{$i-1};
   
   $char3 = $a5 ^ $a6;
   $char4 = (($char3<<4)&240) | (($char3>>4)&15);

   $key .= $char.$char4;
      }

      // Key has the right bytes, but it needs to have certain
      // characters escaped.
      return $this->escapeChars($key);
    }


  function escapeChars($key)
    {
      $encoded = '';

      for ($i = 0; $i  < strlen($key); $i++)
      {
   // You might think we'd have to add the '/' escape character
   // to this list.  Oh well.
   $a = $key{$i};
   if ($a == 126 || // '~'
       $a == 124 || // '|'
       $a == 96 ||  // '`'
       $a == 36 ||  // '$'
       $a == 5 ||   // '^E'
       $a == 0)     // NUL
   {
     $encoded .= "/%DCN";
     // Ensure we have 3 digits.
     if ($a < 100)
       $encoded .="0";
     if ($a < 10)
       $encoded .="0";
     $encoded .= $a; // As a string integer
     $encoded .= "%/";
   } else {
     $encoded .= $a;  // No transformation.
   }
      }

      return $encoded;
    }
}

[RO]VeNoM
Posts: 11
Joined: 2003-05-04 19:36

Post by [RO]VeNoM » 2003-05-06 10:46

Here's what my debuger had to say :

----- 2003-05-06 13:42:32 -----

NR Connect : 1
WARNING: your PHP build supports real sockets.
Recived Stuff : $Lock 'go/s=9V[t:%uMa(XalOhv>%X:jhTmGWZ=a(*JY5no6iBrmJ.4uGZ9G8xbPRUs/_`Abe;Au06[t)(<x\vH)V1 Pk=Xd_0ao],&IrdumqA|$HubName Metropolis|<Hub-Security> This hub is running version 0.4.0 of the Linux Direct Connect Hub Software.|
Sent Stuff : $Key 8/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/128/%DCN000%//%DCN000%//%DCN000%/144/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/144/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/32/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/32/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/64/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/|
Sent Stuff : $ValidateNick [VeNoM]PHPDc|
Sent Stuff : $MyINFO $ALL [VeNoM]PHPDc Stats$ $Cable$venom@venom-is.yourtrap.com$30000000$|
Sent Stuff : $GetNickList|
Sent Stuff : $Quit [VeNoM]PHPDc|

NR Connect : 2
WARNING: your PHP build supports real sockets.
Sent Stuff : $Quit [VeNoM]PHPDc|

NR Connect : 3
WARNING: your PHP build supports real sockets.
Recived Stuff : $Lock bW6]2W'oa_Rw18R45WCI]41`)j>YI0`17F>ny@85&f22N4k4;4Xsm9ZFSH%w)6Y;Wr0 Pk=dJDJK@zWaDbTex-=|$HubName Metropolis|<Hub-Security> This hub is running version 0.4.0 of the Linux Direct Connect Hub Software.|
Sent Stuff : $Key 8/%DCN000%/8/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/144/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/|
Sent Stuff : $ValidateNick [VeNoM]PHPDc|
Sent Stuff : $MyINFO $ALL [VeNoM]PHPDc Stats$ $Cable$venom@venom-is.yourtrap.com$30000000$|
Sent Stuff : $GetNickList|
Sent Stuff : $Quit [VeNoM]PHPDc|

NR Connect : 4
WARNING: your PHP build supports real sockets.
Sent Stuff : $Quit [VeNoM]PHPDc|

NR Connect : 5
WARNING: your PHP build supports real sockets.
Sent Stuff : $Quit [VeNoM]PHPDc|

NR Connect : 6
WARNING: your PHP build supports real sockets.
Recived Stuff : $Lock pKU<;E5k-Cg/3-O?vvGEi1U0MloX:L%0r*r3JWO'Kf[Yn1Hj-k_Fw:RJ,qRlCRwf,DIRwsTH46Q)ltnI:)kb>C\p:5b.74o?T>A Pk=.-aBAjf*toTc.+nu|$HubName Metropolis|<Hub-Security> This hub is running version 0.4.0 of the Linux Direct Connect Hub Software.|
Sent Stuff : $Key 8/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/16/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/112/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/112/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/64/%DCN000%/16/%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/|
Sent Stuff : $ValidateNick [VeNoM]PHPDc|
Sent Stuff : $MyINFO $ALL [VeNoM]PHPDc Stats$ $Cable$venom@venom-is.yourtrap.com$30000000$|
Sent Stuff : $GetNickList|
Sent Stuff : $Quit [VeNoM]PHPDc|

NR Connect : 7
WARNING: your PHP build supports real sockets.
Sent Stuff : $Quit [VeNoM]PHPDc|

NR Connect : 8
WARNING: your PHP build supports real sockets.
Recived Stuff : $Lock 0K'2l/h)U0t=+B>:=\yTj;U+^)ROt9S*_*b&5PU:1OR7mlv0xu_iad Pk=42HwPR=7*l-2Khl0|$HubName Metropolis|<Hub-Security> This hub is running version 0.4.0 of the Linux Direct Connect Hub Software.|
Sent Stuff : $Key /%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%//%DCN000%/96/%DCN000%//%DCN000%/|
Sent Stuff : $ValidateNick [VeNoM]PHPDc|
Sent Stuff : $MyINFO $ALL [VeNoM]PHPDc Stats$ $Cable$venom@venom-is.yourtrap.com$30000000$|
Sent Stuff : $GetNickList|
Sent Stuff : $Quit [VeNoM]PHPDc|

NR Connect : 9
WARNING: your PHP build supports real sockets.
Sent Stuff : $Quit [VeNoM]PHPDc|

The commands are correct or in the right order ?

Who is online

Users browsing this forum: Google [Bot] and 0 guests