Skip to content

Instantly share code, notes, and snippets.

@june9713
Last active November 29, 2019 06:52
Show Gist options
  • Save june9713/90a03262f545701097b91423af07d9c1 to your computer and use it in GitHub Desktop.
Save june9713/90a03262f545701097b91423af07d9c1 to your computer and use it in GitHub Desktop.
import requests
import time
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
ID = 'yout id'
PASS = 'your pass'
MemberNo = "member no found from Fiddler"
def mkhdr(hds):
x = {}
for hd in hds.strip().split("\n"):
tmp = hd.split(":")
key = tmp[0].strip()
data = ":".join( hd.split(":")[1:]).strip()
x[ key ] = data
return x
login_hdr= '''Host: joagift.com
Connection: keep-alive
Cache-Control: max-age=0
Origin: http://wang-gift.com
Upgrade-Insecure-Requests: 1
Content-Type: application/x-www-form-urlencoded
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36
Sec-Fetch-User: ?1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: nested-navigate
Referer: http://wang-gift.com/new/member/login.php
Accept-Encoding: gzip, deflate
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7'''
ss = requests.session()
print("your Id : " , ID)
print("your pass : " , PASS)
print("your memeber no : " , MemberNo)
print("************* Now login process is starting***************\n\n")
localtime = time.localtime()
data = ('nowdomain=wang-gift.com&preurl=http://wang-gift.com/new/member/join_result.php?md=view&'+
'member_no=%s&join_url=wang-gift.com&'%MemberNo+
'join_ymd=%d|%d|%d&'%(localtime[0] , localtime[1] , localtime[2])+
'id=%s'%ID +
'&x=41&y=29&passwd=%s'%PASS)
print("post datas for login to https://joagift.com/new/member/loginok.php\n")
r = ss.post('''https://joagift.com/new/member/loginok.php''' ,
headers = mkhdr(login_hdr) , verify=False ,
data =data )
if r.status_code == 200:
print("first login process is successed")
redir_hdr = '''Host: wang-gift.com
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Accept-Encoding: gzip, deflate
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7
'''
tmp = "top.location.href = '"
cnt = r.text.find(tmp)
cnt2 = r.text.find('//-->' , cnt)
redirect = r.text[cnt + len(tmp) : cnt2].strip()[:-1]
r2 = ss.get(redirect , verify=False,headers = mkhdr(redir_hdr))
print("redirect Address : %s"%redirect)
veri_hdr = '''Host: wang-gift.com
Connection: keep-alive
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
Referer: http://wang-gift.com/new/member/loginok.php?hash=5508f78d3c254420c432bfdb7a821c11&returnStr=anVuZTk3MTM%3D&GAGALOGIN=&preurl=http://wang-gift.com/new/member/join_result.php?md=view&member_no=11255527&join_url=wang-gift.com&join_ymd=2019|11|19
Accept-Encoding: gzip, deflate
Accept-Language: ko-KR,ko;q=0.9,en-US;q=0.8,en;q=0.7
'''
r3= ss.get('http://wang-gift.com/new/member/join_result.php?md=view' , verify=False,headers = mkhdr(veri_hdr))
print("\n\nIs your id in response text? : " , ID in r3.text) # will print True
print("Finally your login process is succesd")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment