Advertisement
Guest User

Untitled

a guest
Mar 27th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. <?php
  2. /*
  3. Create two .txt files for storing ROBLOSECURITY and token.
  4. The script will automatically update the files when ROBLOSECURITY or token is no longer usable.
  5. */
  6. // Input
  7. //$subject = $_GET['subject'];
  8. //$body = $_GET['body']; //this was for something else
  9. //$target_user_id = $_GET['id'];
  10. // Login User Data
  11. $login_user = 'username=publicapi&password=protected';
  12. $file_path_rs = 'rs.txt';
  13. $file_path_token = 'token.txt';
  14. $current_rs = file_get_contents($file_path_rs);
  15. $current_token = file_get_contents($file_path_token);
  16. // [Function] Get ROBLOSECRUITY
  17. function getRS()
  18. {
  19. global $login_user, $file_path_rs;
  20. $get_cookies = curl_init('https://www.roblox.com/newlogin');
  21. curl_setopt_array($get_cookies,
  22. array(
  23. CURLOPT_RETURNTRANSFER => true,
  24. CURLOPT_HEADER => true,
  25. CURLOPT_POST => true,
  26. CURLOPT_POSTFIELDS => $login_user
  27. //CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.6 (KHTML, like Gecko) Chrome/16.0.897.0 Safari/535.6",
  28. //CURLOPT_FOLLOWLOCATION => true,
  29. //CURLOPT_REFERER => "http://www.roblox.com"
  30. )
  31. );
  32. $rs = (preg_match('/(\.ROBLOSECURITY=.*?);/', curl_exec($get_cookies), $matches) ? $matches[1] : '');
  33. file_put_contents($file_path_rs, $rs, true);
  34. curl_close($get_cookies);
  35. return $rs;
  36. }
  37. // [Function] Change User's Group Rank
  38. function changeRank($rs, $token, $target_user_id, $subject, $body)
  39. {
  40. global $subject, $body, $target_user_id, $file_path_token;
  41.  
  42. $promote_user = curl_init("http://www.roblox.com/messages/send");
  43. curl_setopt_array($promote_user,
  44. array(
  45. CURLOPT_RETURNTRANSFER => true,
  46. CURLOPT_POST => true,
  47. CURLOPT_HEADER => true,
  48. CURLOPT_HTTPHEADER => array("Cookie: $rs", "X-CSRF-TOKEN: $token"),
  49. CURLOPT_POSTFIELDS => "subject=".$subject."&body=".$body."&recipientid=".$target_user_id."&cacheBuster=1424880894709",
  50. CURLOPT_USERAGENT => "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.6 (KHTML, like Gecko) Chrome/16.0.897.0 Safari/535.6",
  51. CURLOPT_FOLLOWLOCATION => true,
  52. CURLOPT_REFERER => "http://www.roblox.com/My/NewMessage.aspx?RecipientID=" . $target_user_id
  53. )
  54. );
  55. $resp = curl_exec($promote_user);
  56. $resp_header_size = curl_getinfo($promote_user, CURLINFO_HEADER_SIZE);
  57. $resp_header = substr($resp, 0, $resp_header_size);
  58. $resp_body = substr($resp, $resp_header_size);
  59. if (preg_match('/GuestData/', $resp_header)) {
  60. // RS invalid
  61. $resp_body = changeRank( getRS(), $token );
  62. } else if (preg_match('/Token Validation Failed/', $resp_header)) {
  63. // Token invalid
  64. $new_token = (preg_match('/X-CSRF-TOKEN: (\S+)/', $resp_header, $matches) ? $matches[1] : '');
  65. file_put_contents($file_path_token, $new_token, true);
  66. $resp_body = changeRank( $rs, $new_token );
  67. }
  68. curl_close($promote_user);
  69. return $resp_body;
  70. }
  71. // Change user's group rank and echo results
  72. echo changeRank(getRS(), $current_token, 21208890, "subject", "body");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement