Advertisement
Guest User

Untitled

a guest
Jul 8th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.55 KB | None | 0 0
  1. typeof Roblox == "undefined" && (Roblox = {}), typeof Roblox.SignupOrLogin == "undefined" && (Roblox.SignupOrLogin = function() {
  2. var r = {
  3. unknown: 1, //none selected
  4. male: 2, //M selected
  5. female: 3 //F selected
  6. },
  7. u = { //which action to choose
  8. signup: 0,
  9. login: 1
  10. },
  11. f = { //???
  12. signup: 0,
  13. login: 1,
  14. captcha: 2,
  15. twostep: 3
  16. },
  17. n, t, e = function(t) { //n and t appear empty but they're assigned later on in the script??
  18. typeof n == "function" && n(t)
  19. },
  20. o = function(n) {
  21. typeof t == "function" && t(n)
  22. },
  23. i = function(n) { //reset all POST params
  24. n.data("params", {})
  25. },
  26. s = function(r) { //init
  27. typeof r.onSignupSuccess == "function" && (n = r.onSignupSuccess), typeof r.onLoginSuccess == "function" && (t = r.onLoginSuccess), i($(".signup-or-log-in"))
  28. },
  29. h = function(n, t, i) { //addSignupParam
  30. var r = n.data("params");
  31. typeof r == "undefined" && (r = {}), r[t] = {
  32. name: t,
  33. value: i
  34. }, n.data("params", r)
  35. };
  36. return { //later on in the script it says things like Roblox.SignupOrLogin.SectionType....
  37. GenderType: r,
  38. SectionType: f,
  39. CaptchaFlowType: u,
  40. addSignupParam: h,
  41. onLoginSuccess: o,
  42. onSignupSuccess: e,
  43. resetParams: i,
  44. init: s
  45. }
  46. })
  47.  
  48. signupOrLogin.controller("CaptchaController", ["$scope", "$http", "$rootElement", "captchaService", "displayService", function(n, t, i, r, u) {
  49. var f = function() {
  50. Recaptcha.reload()
  51. };
  52. n.isSubmitting = !1, n.submitCaptcha = function(t) {
  53. r.submitCaptcha(t, f, n)
  54. }, n.isSectionShown = !1, n.$on("display:updated", function(t, i) {
  55. n.$validationMessage = "", n.isSectionShown = i === Roblox.SignupOrLogin.SectionType.captcha
  56. }), n.captchaFlowType = Roblox.SignupOrLogin.CaptchaFlowType.signup, n.$on("captcha:loaded", function(t, i) {
  57. n.captchaResponse = "", n.captchaFlowType = i.captchaFlow, n.username = i.username, f(), u.setDisplayState(Roblox.SignupOrLogin.SectionType.captcha), n.isSectionShown = !0, Roblox.SignupOrLoginIframe && Roblox.SignupOrLoginIframe.resizeFrame(Roblox.SignupOrLogin.SectionType.captcha)
  58. })
  59. }]);
  60.  
  61. signupOrLogin.controller("SignupOrLoginController", ["$document", "$rootScope", "displayService", function(n, t, i) {
  62. n.on("display:updated", function(n, r) {
  63. i.setDisplayState(r), t.$apply()
  64. })
  65. }]);
  66.  
  67. signupOrLogin.factory("captchaService", ["$rootScope", "$http", function(n, t) { //just your standard captcha???
  68. var i = Roblox.SignupOrLogin.CaptchaFlowType.signup,
  69. u = function(n, u, f) {
  70. var o = angular.element(n.target),
  71. s = angular.element(".signup-or-log-in .captcha-container"),
  72. h = {
  73. recaptcha_challenge_field: s.find("#recaptcha_challenge_field").val(),
  74. recaptcha_response_field: s.find("#recaptcha_response_field").val()
  75. },
  76. e;
  77. if (f.captchaFlowType === Roblox.SignupOrLogin.CaptchaFlowType.signup) e = o.data("signup-captcha-api-url"); //url: https://api.roblox.com/captcha/validate/signup
  78. //login isn't important right now //else if (i === Roblox.SignupOrLogin.CaptchaFlowType.login) e = o.data("log-in-captcha-api-url"), h.username = f.username;
  79. else throw "Unknown Captcha flow";
  80. f.isSubmitting = !0, t({
  81. method: "POST",
  82. url: e,
  83. data: $.param(h),
  84. headers: {
  85. "Content-Type": "application/x-www-form-urlencoded"
  86. },
  87. crossDomain: !0
  88. }).success(function() {
  89. f.isSubmitting = !1, f.$validationMessage = "", r()
  90. }).error(function(n, t) {
  91. f.isSubmitting = !1, t === 403 ? (f.$validationMessage = "Captcha incorrect", u()) : (f.$validationMessage = "Unknown error", u())
  92. })
  93. },
  94. r = function() {
  95. i == Roblox.SignupOrLogin.CaptchaFlowType.signup ? n.$broadcast("captcha:signupSuccess") : i == Roblox.SignupOrLogin.CaptchaFlowType.login && n.$broadcast("captcha:loginSuccess")
  96. };
  97. return {
  98. getCaptchaFlowType: function() {
  99. return i
  100. },
  101. setCaptchaFlowType: function(t, r) {
  102. i = t;
  103. var u = {
  104. captchaFlow: t
  105. };
  106. r && (u.username = r), n.$broadcast("captcha:loaded", u)
  107. },
  108. onAfterCaptchaSuccess: r,
  109. submitCaptcha: u
  110. }
  111. }]);
  112.  
  113. signupOrLogin.factory("signupService", ["$http", "captchaService", "displayService", "$rootElement", function(n, t, i) {
  114. var u = function(r) {
  115. var s = angular.element("#signup-button"),
  116. h = s.data("signup-api-url"), //this URL is https://api.roblox.com/signup/v1
  117. u = {},
  118. o = angular.element(".signup-or-log-in"),
  119. e = o.data("params"),
  120. f;
  121. typeof e == "undefined" && (e = {}), $.each(e, function(n, t) {
  122. u[n] = t
  123. }), f = o.data("metadata-params"), typeof f == "undefined" && (f = {}), $.each(f, function(n, t) {
  124. u[n] = t
  125. }), $.extend(u, {
  126. username: r.signup.username,
  127. password: r.signup.password,
  128. birthday: r.signup.birthdayDay + " " + r.signup.birthdayMonth + " " + r.signup.birthdayYear,
  129. gender: r.signup.gender,
  130. context: r.signupForm.context
  131. }), n({
  132. method: "POST",
  133. url: h,
  134. data: $.param(u),
  135. headers: {
  136. "Content-Type": "application/x-www-form-urlencoded"
  137. },
  138. crossDomain: !0,
  139. withCredentials: !0
  140. }).success(function(n) {
  141. Roblox.SignupOrLogin.onSignupSuccess(n.userId)
  142. }).error(function(n, u) {
  143. if (r.badSubmit = !0, r.isSubmitting = !1, u === 403) {
  144. var f = 0;
  145. n.reasons.indexOf("Captcha") !== -1 && (r.isSubmitting = !1, r.isSectionShown = !1, i.setDisplayState(Roblox.SignupOrLogin.SectionType.captcha), t.setCaptchaFlowType(Roblox.SignupOrLogin.CaptchaFlowType.signup), f += 1), n.reasons.indexOf("GenderInvalid") !== -1 && (r.signup.gender = 1, f += 1), n.reasons.indexOf("PasswordInvalid") !== -1 && (r.signupForm.password.$setValidity("password", !1), r.signupForm.password.$passwordMessage = "Password is invalid", f += 1), n.reasons.indexOf("UsernameInvalid") !== -1 && (r.signupForm.username.$setValidity("validusername", !1), r.signupForm.username.$usernameMessage = "Username is invalid", f += 1), n.reasons.indexOf("UsernameTaken") !== -1 && (r.signupForm.username.$setValidity("unique", !1), r.signupForm.username.$usernameMessage = "Username is taken", f += 1), f < n.reasons.length && (r.signupForm.$generalError = !0, r.signupForm.$generalErrorText = "Sorry, an error occurred.")
  146. } else r.signupForm.$generalError = !0, r.signupForm.$generalErrorText = "Sorry, an error occurred."
  147. })
  148. },
  149. return {
  150. submitSignup: u
  151. }
  152. }]);
  153.  
  154. data = {
  155. 'username':'1md01923mj', #random
  156. 'password':'1md01923mj00',
  157. 'birthday':'4 Nov 1981',
  158. 'gender':3, #I presume it's an int instead of a str, the JavaScript doesn't use strings with this.
  159. 'context':'RollerCoaster', #required, otherwise we get an InternalServer error
  160. 'isEligibleForHideAdsAbTest':'False', #same as above
  161. }
  162.  
  163. headers = { #same as the JavaScript
  164. "Content-Type": "application/x-www-form-urlencoded",
  165. }
  166.  
  167. url='https://api.roblox.com/signup/v1' #same as JavaScript
  168.  
  169. r=Session.post(url=url, data=data, headers=headers, verify=True) #POST the request
  170. print(r.text, r.status_code)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement