import time
import hashlib
import gzip
import sys
import re
import urllib.request
import urllib.parse
import urllib.error
import http.cookiejar
from bs4 import BeautifulSoup
import datetime
import random
import re
def ungzip(data):
try:
print("正在解压.....")
data = gzip.decompress(data)
print("解压成功")
except:
print("未经压缩,无需解压")
return data
t=time.time()
millis = int(round(t*1000))
def md5(s):
m = hashlib.md5()
m.update(s.encode(encoding='utf-8'))
return m.hexdigest()
print(md5('1484740695133'))
print(millis)
LoginUrl = "http://erp.sciyon.com:9090/CheckIn/GetUpdateConfig.aspx"
headers = {
'Charset':'UTF-8',
'User-Agent':'Mozilla/5.0 (Linux; U; Mobile; Android 5.1.1;MI 4S Build/FRF91',
'Referer':'http://10.88.10.15/jsFrame/jsFrame/login.aspx?login=login',
'Accept':'*/*',
'Connection':'Keep-Alive',
'Accept-Encoding':'gzip, deflate',
'appverify':'md5=440cb37c164691c80716b34a39e7e335;ts=1484740695133',
'x-mas-app-id':'aaald10031',
'Content-Type':'application/x-www-form-urlencoded',
'Host':'erp.sciyon.com:9090'
}
platForm = 'android'
postDict = {
'platForm':platForm
}
postData=urllib.parse.urlencode(postDict).encode()
request = urllib.request.Request(LoginUrl, data=postData, headers=headers)
try:
#模拟浏览器发送请求,并获取返回结果
response = urllib.request.urlopen(request)
#将返回结果解压
response = ungzip(response.read())
#将返回结果解码
page = response.decode()
print(page)
except urllib.error.URLError as e:
print(e.code,':',e.reason)
#----------------------------------
LoginUrl = "http://网址.com:9090/CheckIn/LoginProxy.aspx?userID=111&password=123"
headers = {
'appverify':'md5=440cb37c164691c80716b34a39e7e335;ts=1484740695133',
'Charset':'UTF-8',
'x-mas-app-id':'aaald10031',
'User-Agent':'Mozilla/5.0 (Linux; U; Mobile; Android 5.1.1;MI 4S Build/FRF91',
'Referer':'http://10.88.10.15/jsFrame/jsFrame/login.aspx?login=login',
'Accept':'*/*',
'Connection':'Keep-Alive',
'Accept-Encoding':'gzip, deflate',
'Host':'erp.sciyon.com:9090'
}
cookie_filename = 'cookiesss.txt'
cookie = http.cookiejar.MozillaCookieJar(cookie_filename)
cookie_support = urllib.request.HTTPCookieProcessor(cookie)
opener = urllib.request.build_opener(cookie_support)
try:
#模拟浏览器发送请求,并获取返回结果
response = opener.open(LoginUrl)
#将返回结果解压
response = ungzip(response.read())
#将返回结果解码
page = response.decode()
print(page)
except urllib.error.URLError as e:
print(e.code,':',e.reason)
cookie.save(ignore_discard=True, ignore_expires=True)
print(cookie)
#--------------------------
'''
t_url = "http://erp.sciyon.com:9090/CheckIn/CheckAppProxy.ashx"
t_postDict = {
'Action':'CHECKIN',
'platForm':'android',
'PNO':'123',
'SIM':'64:cc:2e:73:1c:8f',
'LNG':'118.851191',
'LAT':'31.897862'
}
t_postData=urllib.parse.urlencode(t_postDict).encode()
try:
#模拟浏览器发送请求,并获取返回结果
response = opener.open(t_url,t_postData)
#将返回结果解压
response = ungzip(response.read())
#将返回结果解码
page = response.decode()
print(page)
except urllib.error.URLError as e:
print(e.code,':',e.reason)
'''
opener.close()
import hashlib
import gzip
import sys
import re
import urllib.request
import urllib.parse
import urllib.error
import http.cookiejar
from bs4 import BeautifulSoup
import datetime
import random
import re
def ungzip(data):
try:
print("正在解压.....")
data = gzip.decompress(data)
print("解压成功")
except:
print("未经压缩,无需解压")
return data
t=time.time()
millis = int(round(t*1000))
def md5(s):
m = hashlib.md5()
m.update(s.encode(encoding='utf-8'))
return m.hexdigest()
print(md5('1484740695133'))
print(millis)
LoginUrl = "http://erp.sciyon.com:9090/CheckIn/GetUpdateConfig.aspx"
headers = {
'Charset':'UTF-8',
'User-Agent':'Mozilla/5.0 (Linux; U; Mobile; Android 5.1.1;MI 4S Build/FRF91',
'Referer':'http://10.88.10.15/jsFrame/jsFrame/login.aspx?login=login',
'Accept':'*/*',
'Connection':'Keep-Alive',
'Accept-Encoding':'gzip, deflate',
'appverify':'md5=440cb37c164691c80716b34a39e7e335;ts=1484740695133',
'x-mas-app-id':'aaald10031',
'Content-Type':'application/x-www-form-urlencoded',
'Host':'erp.sciyon.com:9090'
}
platForm = 'android'
postDict = {
'platForm':platForm
}
postData=urllib.parse.urlencode(postDict).encode()
request = urllib.request.Request(LoginUrl, data=postData, headers=headers)
try:
#模拟浏览器发送请求,并获取返回结果
response = urllib.request.urlopen(request)
#将返回结果解压
response = ungzip(response.read())
#将返回结果解码
page = response.decode()
print(page)
except urllib.error.URLError as e:
print(e.code,':',e.reason)
#----------------------------------
LoginUrl = "http://网址.com:9090/CheckIn/LoginProxy.aspx?userID=111&password=123"
headers = {
'appverify':'md5=440cb37c164691c80716b34a39e7e335;ts=1484740695133',
'Charset':'UTF-8',
'x-mas-app-id':'aaald10031',
'User-Agent':'Mozilla/5.0 (Linux; U; Mobile; Android 5.1.1;MI 4S Build/FRF91',
'Referer':'http://10.88.10.15/jsFrame/jsFrame/login.aspx?login=login',
'Accept':'*/*',
'Connection':'Keep-Alive',
'Accept-Encoding':'gzip, deflate',
'Host':'erp.sciyon.com:9090'
}
cookie_filename = 'cookiesss.txt'
cookie = http.cookiejar.MozillaCookieJar(cookie_filename)
cookie_support = urllib.request.HTTPCookieProcessor(cookie)
opener = urllib.request.build_opener(cookie_support)
try:
#模拟浏览器发送请求,并获取返回结果
response = opener.open(LoginUrl)
#将返回结果解压
response = ungzip(response.read())
#将返回结果解码
page = response.decode()
print(page)
except urllib.error.URLError as e:
print(e.code,':',e.reason)
cookie.save(ignore_discard=True, ignore_expires=True)
print(cookie)
#--------------------------
'''
t_url = "http://erp.sciyon.com:9090/CheckIn/CheckAppProxy.ashx"
t_postDict = {
'Action':'CHECKIN',
'platForm':'android',
'PNO':'123',
'SIM':'64:cc:2e:73:1c:8f',
'LNG':'118.851191',
'LAT':'31.897862'
}
t_postData=urllib.parse.urlencode(t_postDict).encode()
try:
#模拟浏览器发送请求,并获取返回结果
response = opener.open(t_url,t_postData)
#将返回结果解压
response = ungzip(response.read())
#将返回结果解码
page = response.decode()
print(page)
except urllib.error.URLError as e:
print(e.code,':',e.reason)
'''
opener.close()