본문 바로가기
Autohotkey/스크립트

[Autohotkey] Winhttp 네이버 로그인 스크립트

by 슈퍼닷 2015. 1. 5.
반응형

 

rsa.txt

 

http://blog.naver.com/dnstlr14/220145940537

위 블로그에서 소스를 얻게 되었습니다.

그래서 한번 소스를 써보니깐 안되더군요.

그래서 이리저리 고쳐서 소스를 올려보겠습니다.

 

네이버 로그인이 예전에는 간단하게 id pw enctp  등등을 data로 보내면 됬는데

이제 encpw에 암호화해서 담아서 보내야되서 힘들어졌어요.

 

밑의 소스는 ScriptControl과 Winhttp를 이용한 스크립트입니다.

첨부파일에 있는 파일 rsa.txt는 이 스크립트를 실행하기위해 필요한 vb함수입니다. 꼭 스크립트와 같은 위치에 두십시오.

성공하면 참을 반환, 실패하면 거짓을 반환합니다.

 

아래는 스크립트입니다.

 

Winhttp:=ComObjCreate("WinHttp.WinHttpRequest.5.1")
id=
pw=
Naver_Login(id,pw)

If (Naver_Login(id,pw))
msgbox,로그인 성공
;; id 변수와 pw변수에 아이디랑 비밀번호 적으시면 됩니다.

return
Naver_Login(user_id, user_pw)
{

 global Winhttp

FileEncoding, UTF-8
id := user_id
pw := user_pw
sc :=  ComObjCreate("ScriptControl")
sc.Language := "JavaScript"
c=0
IfNotExist,rsa.txt
{
msgbox,64,rsa.txt없음,rsa.txt가 없거나 rsa.txt가 스크립트와 같은 위치에 있지않습니다. `n 그러므로 rsa.txt를 다운받기위해 첨부파일이 있는 블로그를 실행하겠습니다.
Run,http://jogamja.tistory.com/entry/Autohotkey-Winhttp-네이버-로그인
exitapp
}
text:= "return rsa.encrypt(comVal + getLenChar(pw) + pw);"
loop,
{
FileReadLine,a,rsa.txt,%A_index%
js_script.= a   .  "`n"
if (c)
{
break
}
ifinstring,a,%text%
c++
}
sc.reset
sc.AddCode(js_script)
;// WinHttpRequest
Winhttp :=  ComObjCreate("WinHttp.WinHttpRequest.5.1")
Winhttp.Open("GET","http://static.nid.naver.com/enclogin/keys.nhn")
Winhttp.Send
res:=Winhttp.responsetext
StringSplit,SendKey,res, `,
vData =
vData .= "enctp=1"
vData .= "&encpw=" . sc.run("createRsaKey", Id, pw, SendKey1, SendKey2, SendKey3, SendKey4) 
vData .= "&encnm=" . SendKey2
vData .= "&svctype=" . "0"
vData .= "&id="
vData .= "&pw="
vData .= "&x=" . "35"
vData .= "&y=" . "14"
Winhttp.Open("POST","https://nid.naver.com/nidlogin.login")
Winhttp.SetRequestHeader("Referer","http://static.nid.naver.com/login.nhn?svc=wme&url=http%3A%2F%2Fwww.naver.com&t=20120425")
Winhttp.SetRequestHeader("Content-Type","application/x-www-form-urlencoded")
Winhttp.Send(vData)
Winhttp.WaitForResponse
txt_str := Winhttp.Responsetext
clipboard:=txt_str
IfInString, txt_str, /sso/
 return true
else
 return false
}

 

반응형

'Autohotkey > 스크립트' 카테고리의 다른 글

[Autohotkey] Winhttp로 네이버 메일 보내기  (4) 2015.01.07

댓글