Advertisement
andrewb

K@H Quick Client

Apr 3rd, 2015
666
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.35 KB | None | 0 0
  1. <?php
  2.  
  3. function postData($url, $data) {
  4.     $ch = curl_init($url);    
  5.     curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
  6.     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  7.     curl_setopt($ch, CURLOPT_HEADER, false);
  8.     curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
  9.     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
  10.     curl_setopt($ch, CURLOPT_POST, true);
  11.     curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
  12.     $back = array();
  13.     $back['url'] = $url;
  14.     $back['file'] = curl_exec($ch);
  15.     $back['type'] = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
  16.     $back['size'] = curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD);
  17.     curl_close($ch);
  18.     return $back;
  19. }
  20.  
  21. function pickPath($method, $activity="check_activity") {
  22.     $url = sprintf("http://algersoft.net/kriegerathome/%s",
  23.                    ($method=="calibrate"?"calibrate_attack.php":"attack.php"));
  24.     if ($method == "calibrate") {
  25.         return postData($url, "auth=calibration_authentication");
  26.     } else {
  27.         return postData($url, sprintf("activity=%s", $activity));
  28.     }
  29. }
  30.  
  31. function pageShow($data,$msg,$delay="30") {
  32.     $refresh = sprintf("kats.php?method=%s", $data);
  33. ?>
  34. <html><head><meta http-equiv="refresh" content="<?php echo($delay) ?>; url=<?php echo($refresh); ?>"></head>
  35. <body><h3><?php echo($msg); ?></h3>
  36. <p><a href="<?php echo($refresh); ?>"><?php echo($refresh); ?></a></p>
  37. </body></html>
  38. <?php
  39. }
  40.  
  41. $method = isset($_REQUEST['method']) ? $_REQUEST['method'] : "none";
  42.  
  43. switch($method) {
  44.     case "calibrate":
  45.         $res = pickPath("calibrate");
  46.         $json = json_decode($res['file']);
  47.         if ($json->status == "accepted") {
  48.             pageShow("attack1", "Calibrating...", "2");
  49.         } else {
  50.             pageShow("calibrate", "Whoops...");
  51.         }
  52.         break;
  53.     case "attack1":
  54.         $res = pickPath("attack", "check_activity");
  55.         $json = json_decode($res['file']);
  56.         if ($json->status == "calibrated") {
  57.             pageShow("attack2", "Attacking...", "2");
  58.         } else {
  59.             pageShow("calibrate", "Starting over...", "2");
  60.         }
  61.         break;
  62.     case "attack2":
  63.         $res = pickPath("attack", "record_progress");
  64.         $json = json_decode($res['file']);
  65.         pageShow("calibrate", $json->status);
  66.         break;
  67.     default:
  68.         pageShow("calibrate", "Starting...", "2");
  69. }
  70.  
  71. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement