Commit 2a0d7404739b5e2d5222292baebfe2c5edefb68d
1 parent
239bd679
更新
Showing
5 changed files
with
7 additions
and
6 deletions
commons/api/doLogin.py
@@ -12,12 +12,13 @@ | @@ -12,12 +12,13 @@ | ||
12 | import requests | 12 | import requests |
13 | import json | 13 | import json |
14 | from commons.scripts.readConf import readConfig | 14 | from commons.scripts.readConf import readConfig |
15 | +from commons.scripts.pwdCry import pwdCry | ||
15 | 16 | ||
16 | class doLogin(): | 17 | class doLogin(): |
17 | def __init__(self): | 18 | def __init__(self): |
18 | rC = readConfig() | 19 | rC = readConfig() |
19 | self.userName = rC.returnOptionsItems("loginInfo","userName") | 20 | self.userName = rC.returnOptionsItems("loginInfo","userName") |
20 | - self.password = rC.returnOptionsItems("loginInfo","password") | 21 | + self.password = pwdCry(rC.returnOptionsItems("loginInfo","password")) |
21 | self.loginUrl = rC.returnOptionsItems("host","uapHost")+"/api/authenticationApi/loginWeb" | 22 | self.loginUrl = rC.returnOptionsItems("host","uapHost")+"/api/authenticationApi/loginWeb" |
22 | self.loginData = {"userName":self.userName,"password":self.password} | 23 | self.loginData = {"userName":self.userName,"password":self.password} |
23 | self.webHeaders = {"X-Requested-With":"XMLHttpRequest", | 24 | self.webHeaders = {"X-Requested-With":"XMLHttpRequest", |
commons/clientSession.py
@@ -12,6 +12,7 @@ | @@ -12,6 +12,7 @@ | ||
12 | import requests | 12 | import requests |
13 | import json | 13 | import json |
14 | from commons.scripts.readConf import readConfig | 14 | from commons.scripts.readConf import readConfig |
15 | +from commons.scripts.pwdCry import pwdCry | ||
15 | 16 | ||
16 | class cliSession(object): | 17 | class cliSession(object): |
17 | def __init__(self): | 18 | def __init__(self): |
@@ -20,7 +21,7 @@ class cliSession(object): | @@ -20,7 +21,7 @@ class cliSession(object): | ||
20 | def __init__(self): | 21 | def __init__(self): |
21 | rC = readConfig() | 22 | rC = readConfig() |
22 | self.userName = rC.returnOptionsItems("loginInfo","userName") | 23 | self.userName = rC.returnOptionsItems("loginInfo","userName") |
23 | - self.password = rC.returnOptionsItems("loginInfo","password") | 24 | + self.password = pwdCry(rC.returnOptionsItems("loginInfo","password")) |
24 | self.loginUrl = rC.returnOptionsItems("host","uapHost")+"/api/authenticationApi/loginWeb" | 25 | self.loginUrl = rC.returnOptionsItems("host","uapHost")+"/api/authenticationApi/loginWeb" |
25 | self.loginData = {"userName":self.userName,"password":self.password} | 26 | self.loginData = {"userName":self.userName,"password":self.password} |
26 | self.webHeaders = {"X-Requested-With":"XMLHttpRequest", | 27 | self.webHeaders = {"X-Requested-With":"XMLHttpRequest", |
commons/scripts/pwdCry.py
@@ -17,7 +17,6 @@ def pwdCry(string): | @@ -17,7 +17,6 @@ def pwdCry(string): | ||
17 | public_key = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgN7kda5L4ztOUquoHjubQIEyqBpjpaYeq+DBKXA3JNOZsMjGwLGVqfCwQg3HHAGTaWnxsp5gjmh0tSziJFgQf2u45TqA2UObOvklRhbWr56QoTNsjm72wZoSOlUzW3xHi/6PocHdy/7bMOiDf6fmYhFBZdRleX6tCAp7w6DsdbQIDAQAB' | 17 | public_key = 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCgN7kda5L4ztOUquoHjubQIEyqBpjpaYeq+DBKXA3JNOZsMjGwLGVqfCwQg3HHAGTaWnxsp5gjmh0tSziJFgQf2u45TqA2UObOvklRhbWr56QoTNsjm72wZoSOlUzW3xHi/6PocHdy/7bMOiDf6fmYhFBZdRleX6tCAp7w6DsdbQIDAQAB' |
18 | key = '-----BEGIN PUBLIC KEY-----\n' + public_key + '\n-----END PUBLIC KEY-----' | 18 | key = '-----BEGIN PUBLIC KEY-----\n' + public_key + '\n-----END PUBLIC KEY-----' |
19 | rsakey = RSA.importKey(key) | 19 | rsakey = RSA.importKey(key) |
20 | - print(rsakey) | ||
21 | cipher = Cipher_pksc1_v1_5.new(rsakey) | 20 | cipher = Cipher_pksc1_v1_5.new(rsakey) |
22 | encrypt_text = cipher.encrypt(string.encode("utf-8")) | 21 | encrypt_text = cipher.encrypt(string.encode("utf-8")) |
23 | cipher_text = base64.b64encode(encrypt_text) | 22 | cipher_text = base64.b64encode(encrypt_text) |
config/marketConfig/test_config_hg
1 | #沈阳市场信息 | 1 | #沈阳市场信息 |
2 | [loginInfo] | 2 | [loginInfo] |
3 | userName=scgy | 3 | userName=scgy |
4 | -password=DYdgRcAyx2bPboAmu0tgIYBM1kMxFAuDty7IQk4162Zh+8KKa8jtu6xIjG9W4yauTfPiuP1sqxDatskXFqCOz76ea14AqRCYEBz53xVr+vLfcz9zOB2d1T3aIlJbEk8yi2c21pd/MFkBw+Fhd0tky/6eN8kJA8mtsj3uDwSb9qo= | 4 | +password=123123 |
5 | 5 | ||
6 | [testInfo] | 6 | [testInfo] |
7 | #已添加的身份证号 | 7 | #已添加的身份证号 |
report/test.log