Jump to content
Đăng nhập để theo dõi  
Huân Hoàng

Request login Garena gọn nhẹ bằng _HttpRequest ver.14

Recommended Posts

Code sử dụng UDF _HttpRequest. Nếu ai chưa biết về UDF này thì đọc bài viết tại đây:

Mình từng có một bài viết hướng dẫn cách login Garena bằng cách giải thuật thuần tuý, nhìn khá là rối rắm, nội dung tại: 

http://autoitvn.com/threads/thuat-toan-garena-huong-dan-cach-login-va-phuong-thuc-ma-hoa-mat-khau-cua-no-voi-_httprequest.900/

---------------------------------------------------------------------------------

Hôm nay mình sẽ đăng code sử dụng hàm _JS_Execute để giải quyết công đoạn mã hoá mật khẩu khiến nó trở nên đơn giản hơn rất nhiều.

#include <_HttpRequest.au3>
$username = ''
$password = ''

$TimeStamp = _GetTimeStamp()

$PreLogin = _HttpRequest(2, 'https://sso.garena.com/api/prelogin?account=' & $username & '&format=json&id=' & $TimeStamp & '&app_id=10000')
If StringInStr($PreLogin, 'error_require_captcha') Then ; Nếu bt đin captcha thì:
	$UUID = _JS_Execute('', "function uuid() {return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);return v.toString(16);});}; var uuid=uuid()", 'uuid')
	$sCaptcha = _HttpRequest_SimpleCaptchaGUI(_HttpRequest(2, 'https://captcha.garena.com/image?key=' & $UUID))
	$PreLogin = _HttpRequest(2, 'https://sso.garena.com/api/prelogin?account=' & $username & '&format=json&id=' & $TimeStamp & '&app_id=10000&captcha_key=' & $UUID & '&captcha=' & $sCaptcha)
EndIf

$aV = StringRegExp($PreLogin, '"v[12]": "([^"]+)"', 3)

$CodeJS = _
		"var password = '" & $password & "';" & _
		"var passwordMd5 = CryptoJS.MD5(password);" & _
		"var passwordKey = CryptoJS.SHA256(CryptoJS.SHA256(passwordMd5 + '" & $aV[0] & "') + '" & $aV[1] & "');" & _
		"var encryptedPassword = CryptoJS.AES.encrypt(passwordMd5, passwordKey, {mode: CryptoJS.mode.ECB,padding: CryptoJS.pad.NoPadding});" & _
		"encryptedPassword = CryptoJS.enc.Base64.parse(encryptedPassword.toString()).toString(CryptoJS.enc.Hex);"

$encryptedPassword = _JS_Execute('https://sso.garena.com/js/crypto.js?v=0.60', $CodeJS, 'encryptedPassword')

$sLogin = _HttpRequest(2, 'https://sso.garena.com/api/login?account=' & $username & '&password=' & $encryptedPassword & '&redirect_uri=https://www.garena.vn/&format=json&id=1472983484321&app_id=10000')

MsgBox(4096, 'Login data', $sLogin)

 

Have fun :vsMIzfA1.png

Chia sẻ bài đăng này


Link tới bài viết
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Trả lời chủ đề này...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Đăng nhập để theo dõi  

×
×
  • Create New...