Advertisement
Gerst20051

HnS API Server IP

Jul 30th, 2011
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.68 KB | None | 0 0
  1. 1st Step | Modify Autoexec.bat File
  2.  
  3. -- Calls Updateip.bat File On Computer Boot
  4.  
  5. CALL c:\docume~1\owner\updateip.bat
  6.  
  7.  
  8.  
  9. 2nd Step | Create Updateip.bat File
  10.  
  11. -- Calls Serverip.php Script Every 30 Mintues
  12.  
  13. :START
  14. "c:\xampp\php\php.exe" "c:\xampp\hns\serverip.php"
  15. SLEEP 3600
  16. GOTO START
  17.  
  18.  
  19.  
  20. 3rd Step | Create Serverip.php File
  21.  
  22. -- Get's My Server's IP From Link
  23. -- Logs Into Pastebin's API To Receive API_USER_KEY
  24. -- Pastes IP To Pastebin
  25. -- Stores Old Paste Key From Text File
  26. -- Adds New Paste Key To Text File
  27. -- Removes Old Pastebin Server IP Using Stored Old Paste Key
  28.  
  29. <?php
  30. $ip = file_get_contents('http://whatismyip.org/');
  31.  
  32. $api_dev_key = '';
  33. $api_user_name = urlencode('');
  34. $api_user_password = urlencode('');
  35.  
  36. $ch = curl_init('http://pastebin.com/api/api_login.php');
  37. curl_setopt($ch, CURLOPT_POST, true);
  38. curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_dev_key='.$api_dev_key.'&api_user_name='.$api_user_name.'&api_user_password='.$api_user_password.'');
  39. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  40. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  41. curl_setopt($ch, CURLOPT_NOBODY, 0);
  42.  
  43. $api_user_key = curl_exec($ch);
  44. $api_paste_private = '1';
  45. $api_paste_expire_date = 'N';
  46. $api_paste_format = 'php';
  47. $api_paste_name = urlencode('Server IP Address');
  48. $api_paste_code = urlencode($ip);
  49.  
  50. $ch = curl_init('http://pastebin.com/api/api_post.php');
  51. curl_setopt($ch, CURLOPT_POST, true);
  52. curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=paste&api_user_key='.$api_user_key.'&api_paste_private='.$api_paste_private.'&api_paste_name='.$api_paste_name.'&api_paste_expire_date='.$api_paste_expire_date.'&api_paste_format='.$api_paste_format.'&api_dev_key='.$api_dev_key.'&api_paste_code='.$api_paste_code.'');
  53. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  54. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  55. curl_setopt($ch, CURLOPT_NOBODY, 0);
  56. $response = curl_exec($ch);
  57.  
  58. $filename = 'pastebin.txt';
  59. if (filesize($filename) > 0) {
  60.     $fh = fopen($filename, 'r') or die("can't open file");
  61.     $api_paste_key = fread($fh,filesize($filename));
  62.     fclose($fh);
  63. }
  64. $fh = fopen($filename, 'w') or die("can't open file");
  65. fwrite($fh, substr($response,20));
  66. fclose($fh);
  67.  
  68. $ch = curl_init('http://pastebin.com/api/api_post.php');
  69. curl_setopt($ch, CURLOPT_POST, true);
  70. curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=delete&api_user_key='.$api_user_key.'&api_dev_key='.$api_dev_key.'&api_paste_key='.$api_paste_key.'');
  71. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  72. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  73. curl_setopt($ch, CURLOPT_NOBODY, 0);
  74.  
  75. $response = curl_exec($ch);
  76. ?>
  77.  
  78.  
  79.  
  80. Step 4 | Create Serverpaste.php File
  81.  
  82. -- Allows Access From All Origins
  83. -- Requests All My Pastebin's From My Account
  84. -- Returns Results For ip.html To Interpret Pastes
  85.  
  86. <?php
  87. header('Access-Control-Allow-Origin: *');
  88. $api_dev_key = '';
  89. $api_user_name = urlencode('');
  90. $api_user_password = urlencode('');
  91. $api_paste_name = urlencode('Server IP Address');
  92. $api_results_limit = '50';
  93.  
  94. $ch = curl_init('http://pastebin.com/api/api_login.php');
  95. curl_setopt($ch, CURLOPT_POST, true);
  96. curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_dev_key='.$api_dev_key.'&api_user_name='.$api_user_name.'&api_user_password='.$api_user_password.'');
  97. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  98. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  99. curl_setopt($ch, CURLOPT_NOBODY, 0);
  100. $api_user_key = curl_exec($ch);
  101.  
  102. $ch = curl_init('http://pastebin.com/api/api_post.php');
  103. curl_setopt($ch, CURLOPT_POST, true);
  104. curl_setopt($ch, CURLOPT_POSTFIELDS, 'api_option=list&api_user_key='.$api_user_key.'&api_dev_key='.$api_dev_key.'&api_results_limit='.$api_results_limit.'');
  105. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  106. curl_setopt($ch, CURLOPT_VERBOSE, 1);
  107. curl_setopt($ch, CURLOPT_NOBODY, 0);
  108. $response = curl_exec($ch);
  109.  
  110. echo $response;
  111. ?>
  112.  
  113.  
  114.  
  115. Step 5 | Create ip.html Page
  116.  
  117. -- http://hnsserverip.site90.com Is Serverpastes.php File Renamed To Index.php
  118. -- Remove Analytics Tracking Codes From End Of Response
  119. -- Filter Through All Pastes To Find Paste Titled 'Server IP Address'
  120. -- Return Raw Link To Paste With Paste Key
  121.  
  122. <html>
  123. <head>
  124. <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
  125. <script>
  126. $(document).ready(function(){
  127.     $.get("http://hnsserverip.site90.com", function(response) {
  128.         var ind = response.indexOf("<!--");
  129.         response = response.substring(0,ind);
  130.         $(response).filter('paste').each(function() {
  131.             if ($(this).find('paste_title').text() == "Server IP Address") $("body #result").html("http://pastebin.com/raw.php?i="+$(this).find('paste_key').text());
  132.         });
  133.     });
  134. });
  135. </script>
  136. </head>
  137. <body>
  138. <div id="result"></div>
  139. </body>
  140. </html>
  141.  
  142.  
  143.  
  144. // Step 6 | Create index.html Page
  145.  
  146. -- Retrieve Link To IP On Target Page
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement