Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
InterfaceAutoTest
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TestAuto
InterfaceAutoTest
Commits
326ba24f
Commit
326ba24f
authored
May 06, 2021
by
jiaqiying
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://git.hikcreate.com/TestAuto/InterfaceAutoTest
parents
296e2ad2
20642cf2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
9 deletions
+18
-9
common/db.py
+4
-2
service/login.py
+14
-7
No files found.
common/db.py
View file @
326ba24f
...
@@ -5,7 +5,7 @@ class RedisBase:
...
@@ -5,7 +5,7 @@ class RedisBase:
def
__init__
(
self
,
inum
):
def
__init__
(
self
,
inum
):
"""每一个数据库实例管理一个连接池"""
"""每一个数据库实例管理一个连接池"""
self
.
num
=
inum
self
.
num
=
inum
pool
=
redis
.
ConnectionPool
(
host
=
'10.197.236.197'
,
port
=
6379
,
db
=
0
,
password
=
'123456'
)
pool
=
redis
.
ConnectionPool
(
host
=
'10.197.236.197'
,
port
=
6379
,
db
=
self
.
num
,
password
=
'123456'
)
self
.
r
=
redis
.
Redis
(
connection_pool
=
pool
)
self
.
r
=
redis
.
Redis
(
connection_pool
=
pool
)
class
RedisString
(
RedisBase
):
class
RedisString
(
RedisBase
):
...
@@ -78,8 +78,10 @@ class MYSQL:
...
@@ -78,8 +78,10 @@ class MYSQL:
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
# r= RedisString(6).get('bmc:captcha:
bf46c0c0-11b4-4b7d-99d7-530f77f8ab88
')
# r= RedisString(6).get('bmc:captcha:
40ec9359-a0e8-42a1-b0c0-c19f199cab60
')
# r = RedisString(0).get('edl:sms_value:17822000010:MOBILE_REGISTER')
# r = RedisString(0).get('edl:sms_value:17822000010:MOBILE_REGISTER')
# print(r)
# print(r)
# print(str(r)[-7:-1])
# print(str(r)[-7:-1])
pass
pass
service/login.py
View file @
326ba24f
...
@@ -33,7 +33,6 @@ class BMY():
...
@@ -33,7 +33,6 @@ class BMY():
②MD5
②MD5
③逆序
③逆序
"""
"""
def
pwd_encrypted
(
self
,
pwd
):
def
pwd_encrypted
(
self
,
pwd
):
key
=
"Jv+h&c0A"
# 原始密钥
key
=
"Jv+h&c0A"
# 原始密钥
m5dkey
=
Encryption
()
.
get_md5
(
key
)
m5dkey
=
Encryption
()
.
get_md5
(
key
)
...
@@ -45,20 +44,23 @@ class BMY():
...
@@ -45,20 +44,23 @@ class BMY():
def
get_imageCode
(
self
,
username
,
pwd
):
def
get_imageCode
(
self
,
username
,
pwd
):
payload
=
{
"username"
:
username
,
"password"
:
pwd
}
payload
=
{
"username"
:
username
,
"password"
:
pwd
}
try
:
try
:
rep
=
requests
.
get
(
f
"http://testtbdzj.hikcreate.com/web
/website/common/graph/login-captcha"
,
params
=
payload
)
rep
=
requests
.
get
(
"http://testyun.banmago.com/api
/website/common/graph/login-captcha"
,
params
=
payload
)
imageId
=
rep
.
json
()[
'data'
][
'jtId'
]
imageId
=
rep
.
json
()[
'data'
][
'jtId'
]
print
(
"imageID为"
,
imageId
)
result
=
RedisString
(
6
)
.
get
(
f
'bmc:captcha:{imageId}'
)
result
=
RedisString
(
6
)
.
get
(
f
'bmc:captcha:{imageId}'
)
print
(
result
)
imageCode
=
str
(
result
)[
-
3
:
-
1
]
imageCode
=
str
(
result
)[
-
3
:
-
1
]
return
imageId
,
imageCode
return
imageId
,
imageCode
except
:
except
:
return
(
"imageId"
,
"imageCode"
)
# 返回错误的验证码
return
(
"imageId"
,
"imageCode"
)
# 返回错误的验证码
def
bmy_login
(
self
,
indata
,
getToken
=
True
):
def
bmy_login
(
self
,
indata
,
getToken
=
True
):
"""企业云登录"""
"""企业云登录"""
# token加密
# token加密
authorization
=
BMY
()
.
get_authorization
()
authorization
=
BMY
()
.
get_authorization
()
header
=
{
"Authorization"
:
authorization
}
header
=
{
"Authorization"
:
authorization
}
payload
=
{
"username"
:
""
,
"password"
:
""
,
"imageId"
:
""
,
"grant_type"
:
"passwordImageCode"
,
"imageCode"
:
""
}
payload
=
{
"username"
:
""
,
"password"
:
""
,
"imageId"
:
""
,
"grant_type"
:
"passwordImageCode"
,
"imageCode"
:
""
}
# 账号
# 账号
payload
[
'username'
]
=
indata
[
'username'
]
payload
[
'username'
]
=
indata
[
'username'
]
...
@@ -70,6 +72,7 @@ class BMY():
...
@@ -70,6 +72,7 @@ class BMY():
imageinfo
=
BMY
()
.
get_imageCode
(
payload
[
'username'
],
payload
[
'password'
])
imageinfo
=
BMY
()
.
get_imageCode
(
payload
[
'username'
],
payload
[
'password'
])
payload
[
'imageId'
]
=
imageinfo
[
0
]
payload
[
'imageId'
]
=
imageinfo
[
0
]
payload
[
'imageCode'
]
=
imageinfo
[
1
]
payload
[
'imageCode'
]
=
imageinfo
[
1
]
print
(
payload
)
resp
=
requests
.
post
(
"http://testyun.banmago.com/api/auth/login"
,
data
=
payload
,
headers
=
header
)
resp
=
requests
.
post
(
"http://testyun.banmago.com/api/auth/login"
,
data
=
payload
,
headers
=
header
)
if
getToken
:
if
getToken
:
...
@@ -87,6 +90,11 @@ if __name__ == '__main__':
...
@@ -87,6 +90,11 @@ if __name__ == '__main__':
# headers=getattr(BaseConfig, 'headers'),
# headers=getattr(BaseConfig, 'headers'),
# method='post',
# method='post',
# data=None)
# data=None)
indata
=
{
"username"
:
"15150000000"
,
"password"
:
"A123456"
}
# indata= {"username":"15150000000","password":"A123456"}
token
=
BMY
()
.
bmy_login
(
indata
,
getToken
=
False
)
# token= BMY().bmy_login(indata,getToken=False)
print
(
token
)
# print(token)
\ No newline at end of file
# res=BMY().get_imageCode("15150000000","8e4b595babec901009ff84f269ee5147")
# print(res)
BMY
()
.
get_imageCode
(
"15150000000"
,
"8e4b595babec901009ff84f269ee5147"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment