-
Notifications
You must be signed in to change notification settings - Fork 26
/
werbio_v1.2.py
959 lines (850 loc) · 33.9 KB
/
werbio_v1.2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
# # 项目说明
#
# ## pikpak会员自动邀请程序1.2,python编写
# ## 原作者:B站纸鸢的花语
# ## 二改作者:非雨
# GitHub:[https://github.com/liuxianlu/pikpak_werbio](https://github.com/liuxianlu/pikpak_werbio)
#
# ## 已知问题
# 运行两个小时后会出现`add_days`异常失败,部署在宝塔面板的可设置为定时重启项目即可解决!
#
# ## 声明
# 纸鸢花的花语所提供的任何资源或素材代码,仅供学习交流和技术分析,严禁用于任何商业牟利行为(包括但不限于引流用户加入社群,利用免费学习素材牟利贩卖,冒充原作者盗用引流增加用户数等)。
# 出现任何后果自行承担,与资源的分享者没有任何关系和责任,如出现违反规定侵权行为,原作者有权对违规者进行版权控诉处理。
#
# ## 如何运行
# 1. 下载`werbio_v1.2.py`文件到本地用 Python 运行。
# 2. 运行后提示什么错误就安装什么库,例如: `pip install requests`。
# 3. 将file_path = r'C:\Users\admin\小米云盘\桌面\邮箱.txt'# 自己修改代码中txt替换为自己实际的邮箱文件地址。将card_keys代码中卡密及使用次数修改为自己喜欢的卡密
# 4. 运行成功后复制网址到浏览器打开,输入邀请码 例:123456 卡密 例:0727-0827-3382SJ2SJ 即可运行在网页执行邀请程序,可搭建部署在服务器运行。
#
# ## 更新内容
# v1.2
# 1.去除3个API短效邮箱接口,改为自动读取txt中的微软邮箱 账号----密码
#
# v1.1
# 1. 增加3个API邮箱接口(将接口卡密1,2,3替换为实际购买的邮箱卡密)
# 2. 增加卡密验证(可自定义卡密及使用次数 有卡密的用户才能执行邀请程序) 、可直接部署在网页运行
import poplib
import hashlib
import json
import random
import re
import time
import requests
import uuid
import email
from concurrent.futures import ThreadPoolExecutor
from concurrent.futures import ThreadPoolExecutor
from pywebio.input import input_group, input, TEXT
from pywebio.output import put_text, put_markdown, clear, put_html
from pywebio import start_server
from datetime import datetime
# -------------改这里-------------
# r'替换为自己txt文件所在地址'
file_path = r'C:\Users\admin\小米云盘\桌面\邮箱.txt'
# 定义卡密和其使用次数
card_keys = {
"0727-0827-3382SJ2SJ": 10000,
"替换为自己想要的卡密": 10
}
# --------------------------------
# 读取文件内容提取邮箱和密码,跳过包含登录成功或失败的行
def read_and_process_file(file_path):
try:
email_user_list = []
email_pass_list = []
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
updated_lines = []
for line in lines:
line = line.strip()
if "登录成功" in line or "失败" in line:
continue
match = re.match(r'^(.+?)----([^\s@]+)$', line)
if match:
email, password = match.groups()
email_user_list.append(email)
email_pass_list.append(password)
else:
print(f"无法匹配行: {line}")
updated_lines.append(line)
return email_user_list, email_pass_list
except Exception as e:
print("读取文件失败:", e)
return None, None
# 更新文件
def update_file_status(file_path, email, password, status):
try:
with open(file_path, 'r', encoding='utf-8') as file:
lines = file.readlines()
with open(file_path, 'w', encoding='utf-8') as file:
for line in lines:
if line.strip().startswith(email) and "----" in line:
file.write(f"{line.strip()} {status}\n")
else:
file.write(line)
except Exception as e:
print("更新文件状态失败:", e)
# POP微软邮箱登录
def get_email_with_third_party(recipient_email, email_user, email_pass, delay=2, max_retries=40):
pop3_server = "pop-mail.outlook.com"
retries = 0
while retries < max_retries:
try:
mail = poplib.POP3_SSL(pop3_server)
mail.user(email_user)
mail.pass_(email_pass)
num_messages = len(mail.list()[1])
for i in range(num_messages):
response, lines, octets = mail.retr(i + 1)
raw_email = b'\n'.join(lines)
code = process_email(raw_email, i + 1, mail)
if code:
return code
mail.quit()
except Exception as e:
print(f"发生错误: {e}")
retries += 1
time.sleep(delay)
return None
# 读取邮箱中验证码
def process_email(raw_email, email_id, mail):
email_message = email.message_from_bytes(raw_email)
if email_message.is_multipart():
for part in email_message.walk():
if part.get_content_type() == 'text/plain' and not part.get('Content-Disposition'):
body = part.get_payload(decode=True)
body_text = body.decode('utf-8')
match = re.search(r'\d{6}', body_text)
if match:
code = match.group()
print(f'获取到验证码: {code}')
return code
else:
body = email_message.get_payload(decode=True)
body_text = body.decode('utf-8')
match = re.search(r'\d{6}', body_text)
if match:
code = match.group()
print(f'获取到验证码: {code}')
return code
print("邮件正文为空或无法解码")
return None
# 邀请成功结果推送到微信
def wxpusher(new_email, password, invitation_code):
global randint_ip
app_token = ""
if app_token:
api_url = "https://wxpusher.zjiecode.com/api/send/message"
data = {
"appToken": app_token,
"summary": "邀请成功: " + invitation_code,
"content": "<h1>PikPak运行结果通知🔔</h1><br/><h3>邀请码:" + invitation_code + "</h3><h4>账户:" + new_email + "</h4><h4>密码:" + password + "</h4>",
"contentType": 2,
"topicIds": [30126],
"uids": [],
"verifyPayType": 0
}
headers = {
# X-Forwarded-For': str(randint_ip)
}
json_data = json.dumps(data)
headers = {'Content-Type': 'application/json'}
response = requests.post(api_url, headers=headers, data=json_data)
data = response.json()
# print(f'wxpusher推送结果:{data["msg"]}')
# 动态代理
def get_proxy():
proxies = {}
return proxies
def get_randint_ip():
m = random.randint(0, 255)
n = random.randint(0, 255)
x = random.randint(0, 255)
y = random.randint(0, 255)
randomIP = str(m) + '.' + str(n) + '.' + str(x) + '.' + str(y)
return randomIP
randint_ip = get_randint_ip()
# 加密算法
def r(e, t):
n = t - 1
if n < 0:
n = 0
r = e[n]
u = r["row"] // 2 + 1
c = r["column"] // 2 + 1
f = r["matrix"][u][c]
l = t + 1
if l >= len(e):
l = t
d = e[l]
p = l % d["row"]
h = l % d["column"]
g = d["matrix"][p][h]
y = e[t]
m = 3 % y["row"]
v = 7 % y["column"]
w = y["matrix"][m][v]
b = i(f) + o(w)
x = i(w) - o(f)
return [s(a(i(f), o(f))), s(a(i(g), o(g))), s(a(i(w), o(w))), s(a(b, x))]
def i(e):
return int(e.split(",")[0])
def o(e):
return int(e.split(",")[1])
def a(e, t):
return str(e) + "^^" + str(t)
def s(e):
t = 0
n = len(e)
for r in range(n):
t = u(31 * t + ord(e[r]))
return t
def u(e):
t = -2147483648
n = 2147483647
if e > n:
return t + (e - n) % (n - t + 1) - 1
if e < t:
return n - (t - e) % (n - t + 1) + 1
return e
def c(e, t):
return s(e + "" + str(t))
def img_jj(e, t, n):
return {"ca": r(e, t), "f": c(n, t)}
def uuid():
return ''.join([random.choice('0123456789abcdef') for _ in range(32)])
def md5(input_string):
return hashlib.md5(input_string.encode()).hexdigest()
def get_sign(xid, t):
e = [
{"alg": "md5", "salt": "KHBJ07an7ROXDoK7Db"},
{"alg": "md5", "salt": "G6n399rSWkl7WcQmw5rpQInurc1DkLmLJqE"},
{"alg": "md5", "salt": "JZD1A3M4x+jBFN62hkr7VDhkkZxb9g3rWqRZqFAAb"},
{"alg": "md5", "salt": "fQnw/AmSlbbI91Ik15gpddGgyU7U"},
{"alg": "md5", "salt": "/Dv9JdPYSj3sHiWjouR95NTQff"},
{"alg": "md5", "salt": "yGx2zuTjbWENZqecNI+edrQgqmZKP"},
{"alg": "md5", "salt": "ljrbSzdHLwbqcRn"},
{"alg": "md5", "salt": "lSHAsqCkGDGxQqqwrVu"},
{"alg": "md5", "salt": "TsWXI81fD1"},
{"alg": "md5", "salt": "vk7hBjawK/rOSrSWajtbMk95nfgf3"}
]
md5_hash = f"YvtoWO6GNHiuCl7xundefinedmypikpak.com{xid}{t}"
for item in e:
md5_hash += item["salt"]
md5_hash = md5(md5_hash)
return md5_hash
# 初始安全验证
def init(xid, mail):
global randint_ip
url = 'https://user.mypikpak.com/v1/shield/captcha/init'
body = {
"client_id": "YvtoWO6GNHiuCl7x",
"action": "POST:/v1/auth/verification",
"device_id": xid,
"captcha_token": "",
"meta": {
"email": mail
}
}
headers = {
'host': 'user.mypikpak.com',
'content-length': str(len(json.dumps(body))),
'accept': '*/*',
'accept-encoding': 'gzip, deflate, br',
'referer': 'https://pc.mypikpak.com',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'MainWindow Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) '
'PikPak/2.3.2.4101 Chrome/100.0.4896.160 Electron/18.3.15 Safari/537.36',
'accept-language': 'zh-CN',
'content-type': 'application/json',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'x-client-id': 'YvtoWO6GNHiuCl7x',
'x-client-version': '2.3.2.4101',
'x-device-id': xid,
'x-device-model': 'electron%2F18.3.15',
'x-device-name': 'PC-Electron',
'x-device-sign': 'wdi10.ce6450a2dc704cd49f0be1c4eca40053xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'x-net-work-type': 'NONE',
'x-os-version': 'Win32',
'x-platform-version': '1',
'x-protocol-version': '301',
'x-provider-name': 'NONE',
'x-sdk-version': '6.0.0',
'X-Forwarded-For': str(randint_ip)
}
retries = 0
max_retries = 3
while retries < max_retries:
try:
response = requests.post(
url, json=body, headers=headers, timeout=5)
response_data = response.json()
print('初始安全验证')
return response_data
except:
retries += 1
# 获取token
def get_new_token(xid, captcha):
retries = 0
max_retries = 3
while retries < max_retries:
try:
response2 = requests.get(
f"https://user.mypikpak.com/credit/v1/report?deviceid={xid}&captcha_token={captcha}&type"
f"=pzzlSlider&result=0", proxies=get_proxy(), timeout=5)
response_data = response2.json()
# print('获取验证TOKEN中......')
return response_data
except:
retries += 1
# 发送验证码
def verification(captcha_token, xid, mail):
global randint_ip
url = 'https://user.mypikpak.com/v1/auth/verification'
body = {
"email": mail,
"target": "ANY",
"usage": "REGISTER",
"locale": "zh-CN",
"client_id": "YvtoWO6GNHiuCl7x"
}
headers = {
'host': 'user.mypikpak.com',
'content-length': str(len(json.dumps(body))),
'accept': '*/*',
'accept-encoding': 'gzip, deflate, br',
'referer': 'https://pc.mypikpak.com',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'MainWindow Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) '
'PikPak/2.3.2.4101 Chrome/100.0.4896.160 Electron/18.3.15 Safari/537.36',
'accept-language': 'zh-CN',
'content-type': 'application/json',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'x-captcha-token': captcha_token,
'x-client-id': 'YvtoWO6GNHiuCl7x',
'x-client-version': '2.3.2.4101',
'x-device-id': xid,
'x-device-model': 'electron%2F18.3.15',
'x-device-name': 'PC-Electron',
'x-device-sign': 'wdi10.ce6450a2dc704cd49f0be1c4eca40053xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'x-net-work-type': 'NONE',
'x-os-version': 'Win32',
'x-platform-version': '1',
'x-protocol-version': '301',
'x-provider-name': 'NONE',
'x-sdk-version': '6.0.0'
# 'X-Forwarded-For': str(randint_ip)
}
retries = 0
max_retries = 2
while retries < max_retries:
try:
response = requests.post(
url, json=body, headers=headers, timeout=5)
response_data = response.json()
print('发送验证码')
return response_data
except:
retries += 1
# 验证码结果
def verify(xid, verification_id, code):
global randint_ip
url = 'https://user.mypikpak.com/v1/auth/verification/verify'
body = {
"verification_id": verification_id,
"verification_code": code,
"client_id": "YvtoWO6GNHiuCl7x"
}
headers = {
'host': 'user.mypikpak.com',
'content-length': str(len(json.dumps(body))),
'accept': '*/*',
'accept-encoding': 'gzip, deflate, br',
'referer': 'https://pc.mypikpak.com',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'MainWindow Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) '
'PikPak/2.3.2.4101 Chrome/100.0.4896.160 Electron/18.3.15 Safari/537.36',
'accept-language': 'zh-CN',
'content-type': 'application/json',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'x-client-id': 'YvtoWO6GNHiuCl7x',
'x-client-version': '2.3.2.4101',
'x-device-id': xid,
'x-device-model': 'electron%2F18.3.15',
'x-device-name': 'PC-Electron',
'x-device-sign': 'wdi10.ce6450a2dc704cd49f0be1c4eca40053xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'x-net-work-type': 'NONE',
'x-os-version': 'Win32',
'x-platform-version': '1',
'x-protocol-version': '301',
'x-provider-name': 'NONE',
'x-sdk-version': '6.0.0'
# 'X-Forwarded-For': str(randint_ip)
}
retries = 0
max_retries = 2
while retries < max_retries:
try:
response = requests.post(
url, json=body, headers=headers, timeout=5)
response_data = response.json()
print('验证码验证结果')
return response_data
except:
retries += 1
# 验证注册结果
def signup(xid, mail, code, verification_token):
global randint_ip
url = 'https://user.mypikpak.com/v1/auth/signup'
body = {
"email": mail,
"verification_code": code,
"verification_token": verification_token,
'name': f'qihang{random.randint(1, 1000000000)}vip',
"password": "qwe103",
"client_id": "YvtoWO6GNHiuCl7x"
}
headers = {
'host': 'user.mypikpak.com',
'content-length': str(len(json.dumps(body))),
'accept': '*/*',
'accept-encoding': 'gzip, deflate, br',
'referer': 'https://pc.mypikpak.com',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'MainWindow Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) '
'PikPak/2.3.2.4101 Chrome/100.0.4896.160 Electron/18.3.15 Safari/537.36',
'accept-language': 'zh-CN',
'content-type': 'application/json',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'x-client-id': 'YvtoWO6GNHiuCl7x',
'x-client-version': '2.3.2.4101',
'x-device-id': xid,
'x-device-model': 'electron%2F18.3.15',
'x-device-name': 'PC-Electron',
'x-device-sign': 'wdi10.ce6450a2dc704cd49f0be1c4eca40053xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'x-net-work-type': 'NONE',
'x-os-version': 'Win32',
'x-platform-version': '1',
'x-protocol-version': '301',
'x-provider-name': 'NONE',
'x-sdk-version': '6.0.0'
# 'X-Forwarded-For': str(randint_ip)
}
retries = 0
max_retries = 2
while retries < max_retries:
try:
response = requests.post(
url, json=body, headers=headers, timeout=5)
response_data = response.json()
print('验证注册结果')
return response_data
except:
retries += 1
# 二次安全验证
def init1(xid, access_token, sub, sign, t):
global randint_ip
url = 'https://user.mypikpak.com/v1/shield/captcha/init'
body = {
"client_id": "YvtoWO6GNHiuCl7x",
"action": "POST:/vip/v1/activity/invite",
"device_id": xid,
"captcha_token": access_token,
"meta": {
"captcha_sign": "1." + sign,
"client_version": "undefined",
"package_name": "mypikpak.com",
"user_id": sub,
"timestamp": t
},
}
headers = {
'host': 'user.mypikpak.com',
'content-length': str(len(json.dumps(body))),
'accept': '*/*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN',
'referer': 'https://pc.mypikpak.com',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'MainWindow Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) '
'PikPak/2.3.2.4101 Chrome/100.0.4896.160 Electron/18.3.15 Safari/537.36',
'content-type': 'application/json',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'x-client-id': 'YvtoWO6GNHiuCl7x',
'x-client-version': '2.3.2.4101',
'x-device-id': xid,
'x-device-model': 'electron%2F18.3.15',
'x-device-name': 'PC-Electron',
'x-device-sign': 'wdi10.ce6450a2dc704cd49f0be1c4eca40053xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'x-net-work-type': 'NONE',
'x-os-version': 'Win32',
'x-platform-version': '1',
'x-protocol-version': '301',
'x-provider-name': 'NONE',
'x-sdk-version': '6.0.0'
# 'X-Forwarded-For': str(randint_ip)
}
retries = 0
max_retries = 2
while retries < max_retries:
try:
response = requests.post(
url, json=body, headers=headers, timeout=5)
response_data = response.json()
print('通过二次安全验证')
return response_data
except:
retries += 1
# 确认邀请
def invite(access_token, captcha_token, xid):
global randint_ip
url = 'https://api-drive.mypikpak.com/vip/v1/activity/invite'
body = {
"apk_extra": {
"invite_code": ""
}
}
headers = {
'host': 'api-drive.mypikpak.com',
'content-length': str(len(json.dumps(body))),
'accept': '*/*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN',
'authorization': 'Bearer ' + access_token,
'referer': 'https://pc.mypikpak.com',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) PikPak/2.3.2.4101 '
'Chrome/100.0.4896.160 Electron/18.3.15 Safari/537.36',
'content-type': 'application/json',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'x-captcha-token': captcha_token,
'x-client-id': 'YvtoWO6GNHiuCl7x',
'x-client-version': '2.3.2.4101',
'x-device-id': xid,
'x-system-language': 'zh-CN'
# 'X-Forwarded-For': str(randint_ip)
}
retries = 0
max_retries = 2
while retries < max_retries:
try:
response = requests.post(
url, json=body, headers=headers, timeout=5)
response_data = response.json()
print('确认邀请')
return response_data
except:
retries += 1
# 三次安全验证
def init2(xid, access_token, sub, sign, t):
global randint_ip
url = 'https://user.mypikpak.com/v1/shield/captcha/init'
body = {
"client_id": "YvtoWO6GNHiuCl7x",
"action": "post:/vip/v1/order/activation-code",
"device_id": xid,
"captcha_token": access_token,
"meta": {
"captcha_sign": "1." + sign,
"client_version": "undefined",
"package_name": "mypikpak.com",
"user_id": sub,
"timestamp": t
},
}
headers = {
'host': 'user.mypikpak.com',
'content-length': str(len(json.dumps(body))),
'accept': '*/*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN',
'referer': 'https://pc.mypikpak.com',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'MainWindow Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) '
'PikPak/2.3.2.4101 Chrome/100.0.4896.160 Electron/18.3.15 Safari/537.36',
'content-type': 'application/json',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'x-client-id': 'YvtoWO6GNHiuCl7x',
'x-client-version': '2.3.2.4101',
'x-device-id': xid,
'x-device-model': 'electron%2F18.3.15',
'x-device-name': 'PC-Electron',
'x-device-sign': 'wdi10.ce6450a2dc704cd49f0be1c4eca40053xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'x-net-work-type': 'NONE',
'x-os-version': 'Win32',
'x-platform-version': '1',
'x-protocol-version': '301',
'x-provider-name': 'NONE',
'x-sdk-version': '6.0.0'
# 'X-Forwarded-For': str(randint_ip)
}
retries = 0
max_retries = 2
while retries < max_retries:
try:
response = requests.post(
url, json=body, headers=headers, timeout=5)
response_data = response.json()
print('通过三次安全验证')
return response_data
except:
retries += 1
# 验证邀请码
def activation_code(access_token, captcha, xid, in_code):
global randint_ip
url = 'https://api-drive.mypikpak.com/vip/v1/order/activation-code'
body = {
"activation_code": in_code,
"page": "invite"
}
headers = {
'host': 'api-drive.mypikpak.com',
'content-length': str(len(json.dumps(body))),
'accept': '*/*',
'accept-encoding': 'gzip, deflate, br',
'accept-language': 'zh-CN',
'authorization': 'Bearer ' + access_token,
'referer': 'https://pc.mypikpak.com',
'sec-fetch-dest': 'empty',
'sec-fetch-mode': 'cors',
'sec-fetch-site': 'cross-site',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) PikPak/2.3.2.4101 '
'Chrome/100.0.4896.160 Electron/18.3.15 Safari/537.36',
'content-type': 'application/json',
'sec-ch-ua': '" Not A;Brand";v="99", "Chromium";v="100"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
'x-captcha-token': captcha,
'x-client-id': 'YvtoWO6GNHiuCl7x',
'x-client-version': '2.3.2.4101',
'x-device-id': xid,
'x-system-language': 'zh-CN',
'X-Forwarded-For': str(randint_ip)
}
retries = 0
max_retries = 2
while retries < max_retries:
try:
response = requests.post(
url, json=body, headers=headers, timeout=5)
response_data = response.json()
print('开始填写邀请码')
# print(f'邀请结果: {json.dumps(response_data, indent=4)}')
return response_data
except:
retries += 1
# -------------------------- 主函数一系列网络请求--------------------------
invite_success_limit = 1
invitation_records = {}
def main(incode, num_invitations=5):
now = datetime.now()
print("当前日期: ", now)
start_time = time.time()
success_count = 0
global invitation_records
current_time = time.time()
if incode in invitation_records:
last_submissions = invitation_records[incode]
last_submissions = [
t for t in last_submissions if current_time - t < 36000] # 10小时
if len(last_submissions) >= 1:
return "24小时内已提交1次,请明日再试。"
invitation_records[incode] = last_submissions
else:
invitation_records[incode] = []
while success_count < num_invitations:
try:
xid = uuid()
email_users, email_passes = read_and_process_file(file_path)
if not email_users or not email_passes:
return "未能读取邮箱或密码"
for email_user, email_pass in zip(email_users, email_passes):
mail = email_user
# 执行初始化安全验证
Init = init(xid, mail)
captcha_token_info = get_new_token(xid, Init['captcha_token'])
Verification = verification(
captcha_token_info['captcha_token'], xid, mail)
# 获取验证码
code = get_email_with_third_party(mail, email_user, email_pass)
if not code:
print(f"无法从邮箱获取验证码: {mail}")
continue
# 使用验证码完成其他操作
verification_response = verify(xid, Verification['verification_id'], code)
signup_response = signup(xid, mail, code, verification_response['verification_token'])
current_time = str(int(time.time()))
sign = get_sign(xid, current_time)
init1_response = init1(xid, signup_response['access_token'], signup_response['sub'], sign, current_time)
invite(signup_response['access_token'],init1_response['captcha_token'], xid)
init2_response = init2(xid, signup_response['access_token'], signup_response['sub'], sign, current_time)
activation = activation_code(signup_response['access_token'], init2_response['captcha_token'], xid, incode)
end_time = time.time()
run_time = f'{(end_time - start_time):.2f}'
# 检查邀请是否成功
if activation.get('add_days') == 5:
result = f"邀请成功 邀请码: {incode} email: {mail} 密码:qwe103"
print(result)
success_count += 1
invitation_records[incode].append(time.time())
# 更新文件中的邮箱和密码状态
update_file_status(file_path , email_user, email_pass, "登录成功")
return f"邀请成功: {incode} 运行时间: {run_time}秒<br> 邮箱: {mail} <br> 密码: qwe103"
elif activation.get('add_days') == 0:
result = f'邀请码: {incode} 邀请失败, 重试...'
print(result)
update_file_status(r'C:\Users\admin\小米云盘\桌面\邮箱.txt', email_user, email_pass, "失败")
return result
else:
result = f"未知情况: {activation}"
print(result)
update_file_status(r'C:\Users\admin\小米云盘\桌面\邮箱.txt', email_user, email_pass, "失败")
return result
except Exception as e:
# 检查异常信息并设置结果
if "cannot unpack non-iterable NoneType object" in str(e):
result = "异常: 临时邮箱暂没货,等待补货 预计1小时恢复"
elif "add_days" in str(e):
result = f"异常: {e} 检查邀请码是否有效 程序出错"
elif 'captcha_token' in str(e):
result = f"异常: {e} 临时邮箱暂没货,等待补货 预计1小时恢复"
else:
result = f'异常重试... {e}'
print(result)
return result
# html页面
def web_app():
put_html('''
<style>
.footer {
display: none !important;
}
.pywebio_header {
text-align: center;
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}
.km_title {
text-align: center;
color: #495057;
font-size: 12px;
}
</style>
''')
put_html('<script>document.title = "PIKPAK临时会员邀请程序";</script>')
put_html('<div class="pywebio_header">PIKPAK临时会员邀请程序</div>')
put_html('<div class="km_title">随用随充次日会员会掉 邀请超50人充不上需要换号 多刷无效<br> 服务器断开/页面卡住解决方法: 复制网址到微信消息里访问</div>')
form_data = input_group("", [
input("请输入你的邀请码6-8位数字:", name="incode", type=TEXT,
required=True, placeholder="打开pikpak我的界面-引荐奖励计划-获取邀请码数字"),
input("请输入卡密:", name="card_key", type=TEXT,
required=True, placeholder="请输入卡密")
# input("邀请次数:", name="numberInvitations", type=NUMBER, value=1, required=True, readonly=True,
# placeholder="默认填写1次,不可修改"),
])
incode = form_data['incode']
card_key = form_data['card_key']
# numberInvitations = form_data['numberInvitations']
# 验证卡密
if card_key not in card_keys or card_keys[card_key] <= 0:
put_text("卡密无效,联系客服")
return
# 更新卡密使用次数
card_keys[card_key] -= 1
clear()
put_html('''
<style>
.footer {
display: none !important;
}
.pywebio_header {
text-align: center;
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}
</style>
''')
put_html('''
<div id="countdown" style="text-align: center;">
正在邀请中...请不要退出页面, <span id="time">30</span> 秒 <br>
页面倒计时为1秒还未跳转请刷新页面重试一遍
</div>
<script>
var timeLeft = 30;
var countdownTimer = setInterval(function(){
if(timeLeft <= 0){
clearInterval(countdownTimer);
pywebio.output.put_markdown("## 邀请结果");
} else {
document.getElementById("time").innerHTML = timeLeft;
}
timeLeft -= 1;
}, 1000);
</script>
''')
# document.getElementById("countdown").innerHTML = "邀请已结束,稍等...正在处理结果";
results = []
with ThreadPoolExecutor(max_workers=10) as executor:
# futures = [executor.submit(main, incode) for _ in range(numberInvitations)]
futures = [executor.submit(main, incode) for _ in range(1)]
for future in futures:
result = future.result()
print(result)
results.append(result)
clear()
put_markdown("## 邀请结果")
put_html('''
<style>
.footer {
display: none !important;
}
.pywebio_header {
text-align: center;
font-size: 24px;
font-weight: bold;
margin-bottom: 20px;
}
.result-container {
text-align: center;
font-size: 18px;
margin-top: 20px;
}
</style>
''')
for result in results:
# put_text(result)
put_html(f'<div class="result-container">{result}</div>')
if __name__ == '__main__':
start_server(web_app, host='0.0.0.0', port=8081)