gfregfregfr
This commit is contained in:
758
text/phones.txt
Normal file
758
text/phones.txt
Normal file
@@ -0,0 +1,758 @@
|
||||
8617065764836
|
||||
14432585660
|
||||
8617065764812
|
||||
8617065764657
|
||||
8617065764599
|
||||
14433631524
|
||||
8617065764410
|
||||
14433631677
|
||||
8617065763897
|
||||
14433817043
|
||||
8617065763800
|
||||
14433817045
|
||||
8617065746410
|
||||
14433817250
|
||||
8617065746319
|
||||
14433817459
|
||||
8617065746315
|
||||
14433817686
|
||||
8617065746296
|
||||
8617065745294
|
||||
14434194893
|
||||
8617065745221
|
||||
14434196099
|
||||
8617065745212
|
||||
14434416274
|
||||
8617065745194
|
||||
8617065745070
|
||||
8617065745018
|
||||
8617065744868
|
||||
14434416281
|
||||
8617065744833
|
||||
8617065744808
|
||||
14434416441
|
||||
8617065744788
|
||||
8617045998427
|
||||
8617045996784
|
||||
14434416608
|
||||
14434416830
|
||||
8617038468793
|
||||
14434435525
|
||||
8617038466918
|
||||
14434435581
|
||||
14434435715
|
||||
8617038466536
|
||||
14434436234
|
||||
14089827921
|
||||
8617038466519
|
||||
14434436329
|
||||
16013016236
|
||||
8617038465337
|
||||
14434861991
|
||||
8617038463865
|
||||
8619280495314
|
||||
16202032872
|
||||
14434863761
|
||||
8617038460105
|
||||
16202202221
|
||||
8617038293336
|
||||
16202205631
|
||||
14435510541
|
||||
8617035789405
|
||||
14435510634
|
||||
8617035781300
|
||||
14435510712
|
||||
8619280492829
|
||||
8617030006317
|
||||
16513000471
|
||||
8616779853414
|
||||
8619280492535
|
||||
14435510745
|
||||
17633401471
|
||||
14435510788
|
||||
8616779852849
|
||||
8619280491887
|
||||
8619280490394
|
||||
17816565721
|
||||
14482334195
|
||||
8619280489405
|
||||
8616779852546
|
||||
14482334874
|
||||
8619280488467
|
||||
18179731064
|
||||
8616741753409
|
||||
14482336527
|
||||
14482336599
|
||||
8616741753394
|
||||
8619280477627
|
||||
8616741752124
|
||||
14482336715
|
||||
18288182398
|
||||
8619280474614
|
||||
8616741751549
|
||||
18314280803
|
||||
8619280472554
|
||||
8616741751494
|
||||
8619280471863
|
||||
8616726612043
|
||||
8616726583413
|
||||
18578580056
|
||||
8619280469750
|
||||
8616726582848
|
||||
8616726582694
|
||||
18578580132
|
||||
8619280469538
|
||||
8616726580754
|
||||
8619280467196
|
||||
8616725304814
|
||||
8616725303835
|
||||
18656571251
|
||||
8616725302291
|
||||
8616724615134
|
||||
8619260296849
|
||||
8616704850015
|
||||
18648082362
|
||||
8616702740714
|
||||
19097260070
|
||||
8619260295018
|
||||
8616702740575
|
||||
18648422698
|
||||
19792676369
|
||||
8619260291951
|
||||
8616702370071
|
||||
18654137080
|
||||
8619260286641
|
||||
18654243199
|
||||
8616534077159
|
||||
8616533744981
|
||||
8619260286617
|
||||
8616533738435
|
||||
8619260282787
|
||||
18654320160
|
||||
8616533652496
|
||||
8619260278701
|
||||
18654328529
|
||||
8619260275457
|
||||
8616533652413
|
||||
8619260275323
|
||||
8616533652317
|
||||
8619260274729
|
||||
8619260270714
|
||||
8616533652282
|
||||
8616533652266
|
||||
8616533652254
|
||||
8619260269270
|
||||
8616533652136
|
||||
8619260267078
|
||||
8616533652106
|
||||
8619260266507
|
||||
8616533652102
|
||||
8619260261942
|
||||
8616533652087
|
||||
8619260261795
|
||||
8616533652081
|
||||
8619260259178
|
||||
8616533652006
|
||||
8616533119051
|
||||
8619260258040
|
||||
8619376951832
|
||||
8619260256979
|
||||
8619260256914
|
||||
8619376951772
|
||||
8619260256019
|
||||
8619260254974
|
||||
8619376951580
|
||||
8619260251183
|
||||
8619376951552
|
||||
8619376950539
|
||||
8619376950396
|
||||
8619260250875
|
||||
8619376895707
|
||||
8619260234351
|
||||
8619375169503
|
||||
8619260233045
|
||||
8619375163501
|
||||
8619373165802
|
||||
8619373108191
|
||||
8619260217503
|
||||
8619313165102
|
||||
8619260215153
|
||||
8619293453753
|
||||
8619260212135
|
||||
8619290178771
|
||||
8619260211284
|
||||
8619290170529
|
||||
8619260197797
|
||||
8619260197381
|
||||
8619290156840
|
||||
8619278499847
|
||||
8619260195587
|
||||
8619270891073
|
||||
8619260194910
|
||||
8619260192846
|
||||
8619260192455
|
||||
8619260191580
|
||||
8619260190367
|
||||
8619260189445
|
||||
8619260187421
|
||||
8619260186420
|
||||
8619260183290
|
||||
8619260181311
|
||||
8619260173118
|
||||
8619260169389
|
||||
8619260169152
|
||||
8619260168438
|
||||
8619260155720
|
||||
8619260154530
|
||||
8619260153487
|
||||
8619260126095
|
||||
8619260121316
|
||||
8619260104717
|
||||
8619260012028
|
||||
8619238157338
|
||||
8619232134165
|
||||
8619231293485
|
||||
8619231278941
|
||||
8619217091015
|
||||
8619217048605
|
||||
8619210721773
|
||||
8618702299073
|
||||
8618525018036
|
||||
8618525012331
|
||||
8618525011869
|
||||
8618322639783
|
||||
8618302205294
|
||||
8618292083273
|
||||
8617179671691
|
||||
8617174853391
|
||||
8617174851473
|
||||
8617174851170
|
||||
8617103627703
|
||||
8617103627693
|
||||
8617103621855
|
||||
8617103621535
|
||||
8617103484984
|
||||
8617103482787
|
||||
8617103482490
|
||||
8617103480561
|
||||
8617103480541
|
||||
8619270861623
|
||||
8617069657741
|
||||
8619217071959
|
||||
8617069656945
|
||||
8619217055202
|
||||
8617069654413
|
||||
8617041096950
|
||||
8617038345353
|
||||
8617038342925
|
||||
8617038342617
|
||||
8617038342524
|
||||
8617038342281
|
||||
8617038341209
|
||||
8617038341077
|
||||
8617038340622
|
||||
8617038340381
|
||||
8617038297835
|
||||
8617030005463
|
||||
8616797571437
|
||||
8616797571421
|
||||
8617072902439
|
||||
8616797571354
|
||||
8617072893429
|
||||
8617069908384
|
||||
8617072874469
|
||||
8616797571164
|
||||
8617072874425
|
||||
8616797570945
|
||||
8617069908381
|
||||
8617072874350
|
||||
8616783368132
|
||||
8617069908375
|
||||
8617072874340
|
||||
8616783368131
|
||||
8617069908362
|
||||
8616783321055
|
||||
8617069908360
|
||||
8616783320966
|
||||
8617072874174
|
||||
8616783298093
|
||||
8615846051834
|
||||
8617069908290
|
||||
8616783270570
|
||||
8617072873842
|
||||
8615802038670
|
||||
8616783270569
|
||||
8617069908034
|
||||
8615804050680
|
||||
8616783221655
|
||||
8617072872742
|
||||
8617067566024
|
||||
8615796416528
|
||||
8616744679953
|
||||
8615629338293
|
||||
8616783221622
|
||||
8617071541043
|
||||
8617065358024
|
||||
8616744679665
|
||||
8616783221599
|
||||
8617070569404
|
||||
8617065358005
|
||||
8616783221288
|
||||
8615573561621
|
||||
8617070568884
|
||||
8617065215981
|
||||
8616783220900
|
||||
8617070568640
|
||||
8617070564984
|
||||
8616744679381
|
||||
8616783220322
|
||||
8617065215311
|
||||
8616783220233
|
||||
8617069898337
|
||||
8615562313897
|
||||
8616746107415
|
||||
8615540955579
|
||||
8617065215044
|
||||
8617069898320
|
||||
8616746107414
|
||||
8617069898313
|
||||
8616744678673
|
||||
8617065215014
|
||||
8617069898310
|
||||
8617065215007
|
||||
8616746107324
|
||||
8615394770710
|
||||
8617069817037
|
||||
8617065214975
|
||||
8616746107164
|
||||
8615377791064
|
||||
8617069813988
|
||||
8617065214952
|
||||
8617069813856
|
||||
8616746106947
|
||||
8617069813815
|
||||
8616746106894
|
||||
8619260051143
|
||||
8613992171966
|
||||
8617065214862
|
||||
8613990160741
|
||||
8616746106744
|
||||
8617069813602
|
||||
8613767767261
|
||||
8616746106564
|
||||
8617048702479
|
||||
8617069813490
|
||||
8613667718078
|
||||
8617056266408
|
||||
8617069813475
|
||||
8616796539492
|
||||
8619253532013
|
||||
8617069813372
|
||||
8617050463928
|
||||
8617133236939
|
||||
8617050463129
|
||||
8617069813323
|
||||
8617050167038
|
||||
8616532615265
|
||||
8616746106514
|
||||
8617069813268
|
||||
8616532615264
|
||||
8617048704043
|
||||
8616746106497
|
||||
8617048703584
|
||||
8617069813206
|
||||
8616746106493
|
||||
8616532615207
|
||||
8617069812843
|
||||
8617048703542
|
||||
8616746106465
|
||||
8617069812578
|
||||
8616746106459
|
||||
8616532615177
|
||||
8616746106449
|
||||
8616532615171
|
||||
8617048703491
|
||||
8616746106445
|
||||
8616532615163
|
||||
8617069812514
|
||||
8617038344237
|
||||
8616532615117
|
||||
8616746106437
|
||||
8617069806039
|
||||
8617799419783
|
||||
8615980423583
|
||||
8616746106430
|
||||
8617069803494
|
||||
8615717352116
|
||||
8616792103684
|
||||
8616746106348
|
||||
8615523519406
|
||||
8617069659419
|
||||
8616796539467
|
||||
8616746106324
|
||||
8617069658202
|
||||
8616796539124
|
||||
8616746106194
|
||||
8617069657197
|
||||
8616796538804
|
||||
8616746106046
|
||||
8617069655944
|
||||
8617069655247
|
||||
8616796535674
|
||||
8616746105984
|
||||
8617069654339
|
||||
8616796535634
|
||||
8616746105954
|
||||
8617069653575
|
||||
8617067562396
|
||||
8616796535624
|
||||
8616746105804
|
||||
8617065779607
|
||||
8616796534472
|
||||
8616746105480
|
||||
8616746105476
|
||||
8617065779602
|
||||
8616796534463
|
||||
8616746105449
|
||||
8616796534461
|
||||
8616796534406
|
||||
8617065779521
|
||||
8616796534405
|
||||
8616746105447
|
||||
8617065777211
|
||||
8616796534284
|
||||
8616746105442
|
||||
8616796533641
|
||||
8616746105407
|
||||
8616792103694
|
||||
8616746105405
|
||||
8616792103647
|
||||
8616746105294
|
||||
8616746105274
|
||||
8616792103646
|
||||
8616746105174
|
||||
8616746105140
|
||||
8616792103545
|
||||
8616746105114
|
||||
8616746105042
|
||||
8616792103504
|
||||
8616746104840
|
||||
8616792103489
|
||||
8616746104749
|
||||
8616792103476
|
||||
8616746104734
|
||||
8616792103474
|
||||
8616792103463
|
||||
8616746104614
|
||||
8616746104549
|
||||
8616792103462
|
||||
8616792103458
|
||||
8616746104453
|
||||
8616792103453
|
||||
8616746104264
|
||||
8616792103446
|
||||
8616746103945
|
||||
8616792103430
|
||||
8616746103748
|
||||
8616792103422
|
||||
8616746103744
|
||||
8616792024115
|
||||
8616790547441
|
||||
8616746103714
|
||||
8616790419406
|
||||
8616790417300
|
||||
8616746103604
|
||||
8616790416856
|
||||
8616746103374
|
||||
8616746103294
|
||||
8616790410975
|
||||
8616746103174
|
||||
8616771389554
|
||||
8616746103140
|
||||
8616756929905
|
||||
8616746103046
|
||||
8616756928562
|
||||
8616746103014
|
||||
8616756889140
|
||||
8616746102934
|
||||
8616756859349
|
||||
8616746102914
|
||||
8616756489728
|
||||
8616746102744
|
||||
8616756456734
|
||||
8616746102614
|
||||
8616756454665
|
||||
8616746102534
|
||||
8616756454653
|
||||
8616746102504
|
||||
8616746102491
|
||||
8616756438020
|
||||
8616746102487
|
||||
8616756431292
|
||||
8616746102485
|
||||
8616756273845
|
||||
8616746102483
|
||||
8616756195319
|
||||
8616746102475
|
||||
8616756173578
|
||||
8616746102468
|
||||
8616756070139
|
||||
8616746102465
|
||||
8616751562468
|
||||
8616746102436
|
||||
8616751560643
|
||||
8616746102435
|
||||
8616747084971
|
||||
8616746102432
|
||||
8616746102429
|
||||
8616747084957
|
||||
8616746102428
|
||||
8616747084938
|
||||
8616746102425
|
||||
8616747084922
|
||||
8616746102424
|
||||
8616747084919
|
||||
8616746102417
|
||||
8616747084918
|
||||
8616746102412
|
||||
8616747084912
|
||||
8616746102354
|
||||
8616747084911
|
||||
8616746102148
|
||||
8616747084907
|
||||
8616746101841
|
||||
8616747084906
|
||||
8616746101794
|
||||
8616746101746
|
||||
8616747084903
|
||||
8616746101745
|
||||
8616747084884
|
||||
8616746101549
|
||||
8616747084841
|
||||
8616746101496
|
||||
8616747084839
|
||||
8616746101490
|
||||
8616747084838
|
||||
8616746101482
|
||||
8616747084815
|
||||
8616746101474
|
||||
8616747084558
|
||||
8616746101448
|
||||
8616747084556
|
||||
8616746101442
|
||||
8616747084316
|
||||
8616746101409
|
||||
8616747084304
|
||||
8616746101384
|
||||
8616747084238
|
||||
8616746101364
|
||||
8616747084235
|
||||
8616746101348
|
||||
8616747084181
|
||||
8616747084172
|
||||
8616747084170
|
||||
8616747084128
|
||||
8616746101324
|
||||
8616741753048
|
||||
8616747084092
|
||||
8616741752949
|
||||
8616747084059
|
||||
8616741752674
|
||||
8616747084031
|
||||
8616741752664
|
||||
8616747083491
|
||||
8616727075004
|
||||
8616747083484
|
||||
8616727073748
|
||||
8616747083460
|
||||
8616727073423
|
||||
8616747083409
|
||||
8616727072468
|
||||
8616747083244
|
||||
8616698525870
|
||||
8616698525570
|
||||
8616747083042
|
||||
8616698508057
|
||||
8616747081459
|
||||
8616698400381
|
||||
8616747081445
|
||||
8616603054462
|
||||
8616747080497
|
||||
8615650461464
|
||||
8616747080490
|
||||
8615627720465
|
||||
8616747080442
|
||||
8615627235104
|
||||
8616747080431
|
||||
8615625491630
|
||||
8616747080354
|
||||
8615602842145
|
||||
8616735025807
|
||||
8615588011241
|
||||
8616745541710
|
||||
8615570874944
|
||||
8616745541696
|
||||
8615564921147
|
||||
8615553959904
|
||||
8616745541632
|
||||
8615552983417
|
||||
8616745541623
|
||||
8615552946725
|
||||
8616745541494
|
||||
8613287187285
|
||||
8616745541402
|
||||
8613287159646
|
||||
8616745541346
|
||||
8613280504171
|
||||
8616745541295
|
||||
8613280432314
|
||||
8616745541245
|
||||
8613266324069
|
||||
8616745541197
|
||||
8613250114313
|
||||
8613250110350
|
||||
8616735304906
|
||||
8613249217104
|
||||
8616735029588
|
||||
8613242146719
|
||||
8616735029508
|
||||
8613210664526
|
||||
8616735028878
|
||||
8613202907647
|
||||
8613202355931
|
||||
8616735028208
|
||||
8613178545307
|
||||
8613176083101
|
||||
8613172340673
|
||||
8613113794127
|
||||
8616735026013
|
||||
8613078473270
|
||||
8616735025794
|
||||
8613078469220
|
||||
8616734294757
|
||||
8613078450361
|
||||
8616727961381
|
||||
8613077497446
|
||||
8613077497436
|
||||
8616726196368
|
||||
8613074259637
|
||||
8616725609449
|
||||
8613074232602
|
||||
8616621093870
|
||||
8613074229109
|
||||
8616602197923
|
||||
8613068611649
|
||||
8616718204700
|
||||
8616715840802
|
||||
8616715840530
|
||||
8616715840484
|
||||
8616715840453
|
||||
8616714465095
|
||||
8616703400966
|
||||
8616703400961
|
||||
8616628562784
|
||||
8616628408253
|
||||
8616628404253
|
||||
8616621651854
|
||||
8616621546750
|
||||
8616621378915
|
||||
8616621374761
|
||||
8616621229136
|
||||
8616621219183
|
||||
8616621217503
|
||||
8616621217261
|
||||
8616621195691
|
||||
8616621037903
|
||||
8616621005089
|
||||
8616602185329
|
||||
8616602129937
|
||||
8616602112139
|
||||
8616601975481
|
||||
8616601773786
|
||||
8616586853370
|
||||
8616586853006
|
||||
8616538737872
|
||||
8616534284004
|
||||
8616534283844
|
||||
8616534283722
|
||||
8616534283595
|
||||
8616534283399
|
||||
8616534283383
|
||||
8616534283289
|
||||
8616534283253
|
||||
8616534281755
|
||||
8616534281420
|
||||
8616534281393
|
||||
8616534281387
|
||||
8616534281380
|
||||
8616534281356
|
||||
8616534281336
|
||||
8616534281307
|
||||
8616534281305
|
||||
8616534281226
|
||||
8616534059698
|
||||
8616534281208
|
||||
8616534281205
|
||||
8616534281110
|
||||
8616534281013
|
||||
8616534217104
|
||||
8616534215049
|
||||
8616534214082
|
||||
8616534213924
|
||||
8616534213596
|
||||
8616534169164
|
||||
8616534151484
|
||||
8616534151331
|
||||
8616534150912
|
||||
8616534150891
|
||||
8616534150871
|
||||
8616534123938
|
||||
8616534123840
|
||||
8616533817352
|
||||
8616534059927
|
||||
8616534059687
|
||||
8616534059589
|
||||
8616534058431
|
||||
8616534058270
|
||||
8616534057133
|
||||
8616534052228
|
||||
8616533819964
|
||||
8616533819903
|
||||
8616533819361
|
||||
8616533819143
|
||||
8616533819011
|
||||
8616533818623
|
||||
8616533645024
|
||||
8616533818353
|
||||
8616533818336
|
||||
8616533818321
|
||||
8616533818119
|
||||
8616533818092
|
||||
8616533818075
|
||||
8616533818018
|
||||
8616533817606
|
||||
8616533817456
|
||||
8616533645570
|
||||
8616533645285
|
||||
8616533645248
|
||||
8616533645246
|
||||
8616533645238
|
||||
8616533645219
|
||||
8616533645192
|
||||
8616533645146
|
||||
8616533645141
|
||||
8616533645131
|
||||
8616533645127
|
||||
8616533645123
|
||||
8616533645119
|
||||
8616533645095
|
||||
8616533645094
|
||||
8616533645091
|
||||
8616533645086
|
||||
8616533645085
|
||||
8616533645048
|
||||
8616533645034
|
||||
8616533645004
|
||||
8616533644972
|
||||
8617103484027
|
||||
8617078028915
|
||||
49
text/text.py
49
text/text.py
@@ -57,13 +57,15 @@ async def create_telegram_client(server):
|
||||
|
||||
async def main():
|
||||
server, server_type = TgPhoneDevices().get_or_create(
|
||||
phone="8613661496481",
|
||||
phone="8613641805330",
|
||||
)
|
||||
|
||||
client = await create_telegram_client(server)
|
||||
|
||||
await client.connect()
|
||||
|
||||
# await client.log_out()
|
||||
|
||||
# if await client.is_user_authorized():
|
||||
# me = await client.get_me()
|
||||
# logger.info(f'账号 {8617882004254} -- {me.username} 登录成功!')
|
||||
@@ -170,7 +172,7 @@ async def main():
|
||||
|
||||
# # ---------------------------------------------------------------------------------------------
|
||||
# try:
|
||||
# await client.edit_2fa(current_password="123123", new_password="123")
|
||||
# await client.edit_2fa(current_password="Haxi@123456@", new_password="123456qwe")
|
||||
# except NewSettingsInvalidError:
|
||||
# print(1)
|
||||
# except PasswordHashInvalidError:
|
||||
@@ -264,17 +266,44 @@ async def main():
|
||||
# ]
|
||||
# await client(InviteToChannelRequest(target_group, users_to_add))
|
||||
|
||||
# 2️⃣ 发送消息
|
||||
update = await client(ImportChatInviteRequest("+E6E4i3svka81MGY1"))
|
||||
chat = update.chats[0]
|
||||
try:
|
||||
await client.send_message(chat.id, "你好,这是一条来自 Telethon 的测试消息!")
|
||||
print("消息已发送!")
|
||||
except Exception as e:
|
||||
print(f"发送失败: {e}")
|
||||
# # 2️⃣ 发送消息
|
||||
# update = await client(ImportChatInviteRequest("+E6E4i3svka81MGY1"))
|
||||
# chat = update.chats[0]
|
||||
# try:
|
||||
# await client.send_message(chat.id, "你好,这是一条来自 Telethon 的测试消息!")
|
||||
# print("消息已发送!")
|
||||
# except Exception as e:
|
||||
# print(f"发送失败: {e}")
|
||||
|
||||
|
||||
#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
print("正在获取对话列表...")
|
||||
# 获取所有对话
|
||||
dialogs = await client.get_dialogs()
|
||||
|
||||
# 退出所有群聊
|
||||
for dialog in dialogs:
|
||||
if dialog.is_group or dialog.is_channel:
|
||||
try:
|
||||
await client.delete_dialog(dialog.entity)
|
||||
print(f"已退出群聊/频道: {dialog.title}")
|
||||
except Exception as e:
|
||||
print(f"退出群聊/频道 {dialog.title} 时出错: {e}")
|
||||
|
||||
# 取消关注所有机器人
|
||||
for dialog in dialogs:
|
||||
if hasattr(dialog.entity, 'bot') and dialog.entity.bot:
|
||||
try:
|
||||
await client.delete_dialog(dialog.entity)
|
||||
print(f"已取消关注机器人: {dialog.title}")
|
||||
except Exception as e:
|
||||
print(f"取消关注机器人 {dialog.title} 时出错: {e}")
|
||||
|
||||
await client.disconnect()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
||||
|
||||
|
||||
# .\xray.exe -c .\1_3078_client_liu_http_ip_1v1.json
|
||||
348
text/text1.py
348
text/text1.py
@@ -1,312 +1,52 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
from Crypto.Cipher import AES
|
||||
from Crypto.Util.Padding import pad, unpad
|
||||
import base64
|
||||
import hashlib
|
||||
|
||||
"""
|
||||
优化后的 Telegram 客户端代码
|
||||
"""
|
||||
# 加密函数
|
||||
def encrypt(plain_text, key):
|
||||
key = hashlib.sha256(key.encode('utf-8')).digest()[:16] # 保证密钥为16字节
|
||||
cipher = AES.new(key, AES.MODE_CBC) # CBC模式
|
||||
ct_bytes = cipher.encrypt(pad(plain_text.encode('utf-8'), AES.block_size))
|
||||
iv = base64.b64encode(cipher.iv).decode('utf-8')
|
||||
ct = base64.b64encode(ct_bytes).decode('utf-8')
|
||||
return iv + ct # 返回初始化向量和密文
|
||||
|
||||
import asyncio
|
||||
from urllib.parse import unquote
|
||||
from typing import Optional, Dict, Any
|
||||
# 解密函数
|
||||
def decrypt(cipher_text, key):
|
||||
key = hashlib.sha256(key.encode('utf-8')).digest()[:16] # 保证密钥为16字节
|
||||
iv = base64.b64decode(cipher_text[:24]) # 提取初始化向量
|
||||
ct = base64.b64decode(cipher_text[24:]) # 提取密文
|
||||
cipher = AES.new(key, AES.MODE_CBC, iv)
|
||||
decrypted = unpad(cipher.decrypt(ct), AES.block_size)
|
||||
return decrypted.decode('utf-8')
|
||||
|
||||
from loguru import logger
|
||||
from telethon import TelegramClient, functions, events, client
|
||||
from telethon.errors import (
|
||||
NewSaltInvalidError,
|
||||
NewSettingsInvalidError,
|
||||
PasswordHashInvalidError,
|
||||
FloodWaitError,
|
||||
SessionPasswordNeededError
|
||||
)
|
||||
from telethon.tl import types
|
||||
from telethon.tl.functions.account import GetAuthorizationsRequest, ResetAuthorizationRequest
|
||||
from telethon.tl.functions.channels import JoinChannelRequest
|
||||
from telethon.tl.functions.messages import RequestAppWebViewRequest, StartBotRequest
|
||||
from telethon.tl.types import InputBotAppShortName
|
||||
|
||||
from models.tg_phone_devices import TgPhoneDevices
|
||||
# 使用示例
|
||||
key = 'thisisaverysecret' # 16字节的密钥
|
||||
phone_number = '8616533817456'
|
||||
|
||||
|
||||
class OptimizedTelegramClient:
|
||||
"""优化的 Telegram 客户端类"""
|
||||
|
||||
def __init__(self, server):
|
||||
self.server = server
|
||||
self.client = None
|
||||
self.verification_answers = {
|
||||
"年龄": "25",
|
||||
"职业": "程序员",
|
||||
"目的": "学习交流",
|
||||
"来自": "中国",
|
||||
"兴趣": "编程、阅读",
|
||||
"名字": "张三"
|
||||
}
|
||||
|
||||
async def create_client(self) -> TelegramClient:
|
||||
"""创建并配置 Telegram 客户端"""
|
||||
proxy = {
|
||||
'proxy_type': self.server.proxy_type,
|
||||
'addr': self.server.addr,
|
||||
'port': int(self.server.port),
|
||||
'username': self.server.user if self.server.user else "",
|
||||
'password': self.server.pwd if self.server.pwd else ""
|
||||
}
|
||||
|
||||
self.client = TelegramClient(
|
||||
fr"C:\sessions\{self.server.phone}",
|
||||
api_id=self.server.api_id,
|
||||
api_hash=self.server.api_hash,
|
||||
device_model=self.server.device_model,
|
||||
system_version=self.server.system_version,
|
||||
app_version=self.server.app_version,
|
||||
system_lang_code=self.server.system_lang_code,
|
||||
lang_code=self.server.lang_code,
|
||||
proxy=proxy
|
||||
)
|
||||
return self.client
|
||||
|
||||
async def connect_and_auth(self) -> bool:
|
||||
"""连接并验证客户端"""
|
||||
try:
|
||||
await self.client.connect()
|
||||
|
||||
if await self.client.is_user_authorized():
|
||||
me = await self.client.get_me()
|
||||
logger.info(f'账号 {self.server.phone} -- {me.username} 登录成功!')
|
||||
return True
|
||||
else:
|
||||
logger.error(f'账号 {self.server.phone} 登录失败!')
|
||||
return False
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"连接失败: {e}")
|
||||
return False
|
||||
|
||||
async def setup_verification_handler(self):
|
||||
"""设置验证问题处理器"""
|
||||
|
||||
import re
|
||||
|
||||
@self.client.on(events.NewMessage)
|
||||
async def handle_verification(event):
|
||||
try:
|
||||
message_text = event.message.text.strip()
|
||||
logger.info(f"收到消息: {message_text}")
|
||||
|
||||
# ========== 1. 加法验证题处理 ==========
|
||||
match = re.match(r"(\d+)\s*\+\s*(\d+)", message_text)
|
||||
if match:
|
||||
a, b = int(match.group(1)), int(match.group(2))
|
||||
answer = str(a + b)
|
||||
logger.info(f"检测到加法题: {a}+{b} 答案是 {answer}")
|
||||
|
||||
# 获取按钮并点击正确答案
|
||||
if event.buttons:
|
||||
for row in event.buttons:
|
||||
for button in row:
|
||||
if button.text.strip() == answer:
|
||||
await asyncio.sleep(2) # 模拟人工延迟
|
||||
await event.click(button)
|
||||
logger.info(f"已点击正确答案按钮: {answer}")
|
||||
return
|
||||
|
||||
# ========== 2. 关键字问答处理 ==========
|
||||
lower_text = message_text.lower()
|
||||
for keyword, answer in self.verification_answers.items():
|
||||
if keyword in lower_text:
|
||||
logger.info(f"检测到验证问题: {message_text}")
|
||||
logger.info(f"自动回答: {answer}")
|
||||
|
||||
await asyncio.sleep(2)
|
||||
await event.respond(answer)
|
||||
logger.info("验证答案已发送")
|
||||
return
|
||||
|
||||
# ========== 3. 泛化验证提示 ==========
|
||||
if any(kw in message_text for kw in ['请回答', '请验证', '回答问题', '验证问题']):
|
||||
logger.info("检测到需要回答验证问题")
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"处理验证问题时出错: {e}")
|
||||
|
||||
async def join_channel(self, channel_name: str) -> bool:
|
||||
"""加入频道/群组"""
|
||||
try:
|
||||
await self.client(JoinChannelRequest(channel_name))
|
||||
logger.info(f"成功加入频道: {channel_name}")
|
||||
return True
|
||||
except FloodWaitError as e:
|
||||
logger.warning(f"需要等待 {e.seconds} 秒后重试")
|
||||
return False
|
||||
except Exception as e:
|
||||
logger.error(f"加入频道失败: {e}")
|
||||
return False
|
||||
|
||||
async def check_bot_interaction(self, bot_username: str) -> bool:
|
||||
"""检查是否与机器人有过交互"""
|
||||
try:
|
||||
async for dialog in self.client.iter_dialogs():
|
||||
if dialog.is_user and dialog.entity.username == bot_username:
|
||||
logger.info(f'已与机器人交互: @{bot_username}')
|
||||
return True
|
||||
try:
|
||||
for username in dialog.entity.usernames:
|
||||
if username.username == bot_username:
|
||||
logger.info(f'已与机器人交互: @{bot_username}')
|
||||
return True
|
||||
except:
|
||||
pass
|
||||
logger.info(f'尚未与机器人交互: @{bot_username}')
|
||||
return False
|
||||
except Exception as e:
|
||||
logger.error(f"检查机器人交互时出错: {e}")
|
||||
return False
|
||||
|
||||
async def start_bot_with_invite(self, bot_name: str, invite_code: str) -> bool:
|
||||
"""使用邀请码启动机器人"""
|
||||
try:
|
||||
result = await self.client(StartBotRequest(
|
||||
bot=bot_name,
|
||||
peer=bot_name,
|
||||
start_param=invite_code
|
||||
))
|
||||
logger.info(f"成功启动机器人 {bot_name} 使用邀请码 {invite_code}")
|
||||
return True
|
||||
except Exception as e:
|
||||
logger.error(f"启动机器人失败: {e}")
|
||||
return False
|
||||
|
||||
async def get_webapp_data(self, bot_name: str, invite_code: Optional[str] = None) -> Optional[str]:
|
||||
"""获取 WebApp 数据"""
|
||||
try:
|
||||
await self.client.get_input_entity(bot_name)
|
||||
|
||||
app_info = await self.client(RequestAppWebViewRequest(
|
||||
'me',
|
||||
InputBotAppShortName(await self.client.get_input_entity(bot_name), "app"),
|
||||
platform="web",
|
||||
start_param=invite_code if invite_code else None
|
||||
))
|
||||
|
||||
tg_data = unquote(app_info.url.split('tgWebAppData=')[1].split('&tgWebAppVersion')[0])
|
||||
logger.info(f"成功获取 WebApp 数据: {tg_data[:50]}...")
|
||||
return tg_data
|
||||
except Exception as e:
|
||||
logger.error(f"获取 WebApp 数据失败: {e}")
|
||||
return None
|
||||
|
||||
async def get_authorizations(self) -> list:
|
||||
"""获取所有登录设备信息"""
|
||||
try:
|
||||
authorizations = await self.client(GetAuthorizationsRequest())
|
||||
return authorizations.authorizations
|
||||
except Exception as e:
|
||||
logger.error(f"获取授权信息失败: {e}")
|
||||
return []
|
||||
|
||||
async def kick_device(self, target_device_model: str) -> bool:
|
||||
"""踢出指定设备"""
|
||||
try:
|
||||
authorizations = await self.get_authorizations()
|
||||
|
||||
for authorization in authorizations:
|
||||
if authorization.device_model == target_device_model and not authorization.current:
|
||||
await self.client(ResetAuthorizationRequest(hash=authorization.hash))
|
||||
logger.info(f"已踢出设备: {authorization.device_model} (授权ID: {authorization.hash})")
|
||||
return True
|
||||
|
||||
logger.warning(f"未找到设备: {target_device_model}")
|
||||
return False
|
||||
except Exception as e:
|
||||
logger.error(f"踢出设备失败: {e}")
|
||||
return False
|
||||
|
||||
async def click_confirm_button(self, chat_id: int = 777000, limit: int = 5) -> bool:
|
||||
"""点击确认按钮"""
|
||||
try:
|
||||
messages = await self.client.get_messages(chat_id, limit=limit)
|
||||
|
||||
for message in messages:
|
||||
if message.buttons:
|
||||
for row in message.buttons:
|
||||
for button in row:
|
||||
if 'confirm' in button.text.lower():
|
||||
await button.click()
|
||||
logger.info(f"已点击消息 {message.id} 的 Confirm 按钮")
|
||||
return True
|
||||
|
||||
logger.warning("未找到包含 Confirm 按钮的消息")
|
||||
return False
|
||||
except Exception as e:
|
||||
logger.error(f"点击确认按钮失败: {e}")
|
||||
return False
|
||||
|
||||
async def monitor_channel_messages(self, channel_name: str, duration: int = 60):
|
||||
"""监控频道消息"""
|
||||
try:
|
||||
# 获取频道实体
|
||||
entity = await self.get_channel_entity(channel_name)
|
||||
if not entity:
|
||||
logger.error(f"无法获取频道实体: {channel_name}")
|
||||
return
|
||||
|
||||
logger.info(f"开始监控频道: {entity.title} (ID: {entity.id})")
|
||||
|
||||
# 设置消息处理器
|
||||
await self.setup_verification_handler(entity.id)
|
||||
|
||||
# ✅ 使用 asyncio.wait_for 控制时间
|
||||
try:
|
||||
await asyncio.wait_for(self.client.run_until_disconnected(), timeout=duration)
|
||||
except asyncio.TimeoutError:
|
||||
logger.info(f"监控 {duration} 秒结束,主动断开连接")
|
||||
await self.client.disconnect()
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"监控频道消息时出错: {e}")
|
||||
|
||||
async def run_with_verification(self, channel_name: str, wait_time: int = 60):
|
||||
"""运行客户端并处理验证"""
|
||||
try:
|
||||
# 加入频道
|
||||
if not await self.join_channel(channel_name):
|
||||
logger.error("加入频道失败")
|
||||
return
|
||||
|
||||
# 监控频道消息
|
||||
await self.monitor_channel_messages(channel_name, wait_time)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"运行过程中出错: {e}")
|
||||
finally:
|
||||
if self.client and self.client.is_connected():
|
||||
await self.client.disconnect()
|
||||
logger.info("客户端已断开连接")
|
||||
|
||||
|
||||
async def main():
|
||||
"""主函数"""
|
||||
try:
|
||||
# 获取设备信息
|
||||
server, server_type = TgPhoneDevices().get_or_create(
|
||||
phone="201285449831",
|
||||
)
|
||||
|
||||
# 创建客户端
|
||||
tg_client = OptimizedTelegramClient(server)
|
||||
client = await tg_client.create_client()
|
||||
|
||||
# 连接并验证
|
||||
if not await tg_client.connect_and_auth():
|
||||
logger.error("客户端验证失败")
|
||||
return
|
||||
|
||||
# 运行主要功能
|
||||
await tg_client.run_with_verification('newmoneyai', wait_time=60)
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"主函数执行失败: {e}")
|
||||
|
||||
# 使用示例
|
||||
key = 'thisisaverysecret' # 16字节的密钥
|
||||
|
||||
if __name__ == '__main__':
|
||||
asyncio.run(main())
|
||||
|
||||
with open('phones.txt', 'r', encoding='utf-8') as f:
|
||||
content = f.read()
|
||||
|
||||
tasks = [] # 创建任务列表
|
||||
lines = content.split('\n')
|
||||
|
||||
n = 0
|
||||
for _, line in enumerate(lines):
|
||||
print(line)
|
||||
|
||||
phone_number =line
|
||||
|
||||
# 加密
|
||||
encrypted = encrypt(phone_number, key)
|
||||
# print("Encrypted:", encrypted)
|
||||
|
||||
print(f"http://205.198.72.45:5000/get_verification_code?token={encrypted}")
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ async def main():
|
||||
print(message_text)
|
||||
|
||||
try:
|
||||
code = re.findall(r'\d{5}', message_text)[0]
|
||||
code = re.findall(r'\d{6}', message_text)[0]
|
||||
logger.info(f"当前验证码:{code}")
|
||||
|
||||
except:
|
||||
|
||||
180
text/获取验证码接口.py
Normal file
180
text/获取验证码接口.py
Normal file
@@ -0,0 +1,180 @@
|
||||
from flask import Flask, jsonify, request, render_template_string
|
||||
import asyncio
|
||||
import re
|
||||
from loguru import logger
|
||||
from opentele.api import API
|
||||
from telethon.errors import SessionPasswordNeededError, PhoneCodeInvalidError, RPCError, NewSettingsInvalidError, \
|
||||
PasswordHashInvalidError
|
||||
from telethon import TelegramClient
|
||||
from models.tg_phone_devices import TgPhoneDevices
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
|
||||
from Crypto.Cipher import AES
|
||||
from Crypto.Util.Padding import pad, unpad
|
||||
import base64
|
||||
import hashlib
|
||||
|
||||
# 加密函数
|
||||
def encrypt(plain_text, key):
|
||||
key = hashlib.sha256(key.encode('utf-8')).digest()[:16] # 保证密钥为16字节
|
||||
cipher = AES.new(key, AES.MODE_CBC) # CBC模式
|
||||
ct_bytes = cipher.encrypt(pad(plain_text.encode('utf-8'), AES.block_size))
|
||||
iv = base64.b64encode(cipher.iv).decode('utf-8')
|
||||
ct = base64.b64encode(ct_bytes).decode('utf-8')
|
||||
return iv + ct # 返回初始化向量和密文
|
||||
|
||||
# 解密函数
|
||||
def decrypt(cipher_text, key):
|
||||
key = hashlib.sha256(key.encode('utf-8')).digest()[:16] # 保证密钥为16字节
|
||||
iv = base64.b64decode(cipher_text[:24]) # 提取初始化向量
|
||||
ct = base64.b64decode(cipher_text[24:]) # 提取密文
|
||||
cipher = AES.new(key, AES.MODE_CBC, iv)
|
||||
decrypted = unpad(cipher.decrypt(ct), AES.block_size)
|
||||
return decrypted.decode('utf-8')
|
||||
|
||||
# 使用示例
|
||||
key = 'thisisaverysecret' # 16字节的密钥
|
||||
phone_number = '8616533817456'
|
||||
|
||||
# 加密
|
||||
encrypted = encrypt(phone_number, key)
|
||||
print("Encrypted:", encrypted)
|
||||
|
||||
|
||||
|
||||
|
||||
# Proxy config (for future use if needed)
|
||||
PROXY_CONFIG = {
|
||||
'proxy_type': 'http',
|
||||
'addr': '192.168.50.220',
|
||||
'port': 10809,
|
||||
'username': '',
|
||||
'password': ''
|
||||
}
|
||||
|
||||
|
||||
async def get_device_info():
|
||||
"""
|
||||
Fetch device information (this can be used as metadata).
|
||||
"""
|
||||
NewApi = API.TelegramDesktop.Generate(system="macos")
|
||||
return {
|
||||
"api_id": NewApi.api_id,
|
||||
"api_hash": NewApi.api_hash,
|
||||
"device_model": NewApi.device_model,
|
||||
"system_version": NewApi.system_version,
|
||||
"app_version": NewApi.app_version,
|
||||
"lang_code": NewApi.lang_code,
|
||||
"system_lang_code": NewApi.system_lang_code
|
||||
}
|
||||
|
||||
|
||||
async def create_telegram_client(server_type):
|
||||
"""
|
||||
Creates and configures Telegram client.
|
||||
"""
|
||||
proxy = {
|
||||
'proxy_type': server_type.proxy_type,
|
||||
'addr': server_type.addr,
|
||||
'port': int(server_type.port),
|
||||
'username': server_type.user if server_type.user else "",
|
||||
'password': server_type.pwd if server_type.pwd else ""
|
||||
}
|
||||
|
||||
client = TelegramClient(
|
||||
fr"C:\sessions\{server_type.phone}",
|
||||
api_id=server_type.api_id,
|
||||
api_hash=server_type.api_hash,
|
||||
device_model=server_type.device_model,
|
||||
system_version=server_type.system_version,
|
||||
app_version=server_type.app_version,
|
||||
system_lang_code=server_type.system_lang_code,
|
||||
lang_code=server_type.lang_code,
|
||||
proxy=proxy
|
||||
)
|
||||
|
||||
return client
|
||||
|
||||
|
||||
async def get_verification_code(phone_num):
|
||||
"""
|
||||
Fetch the verification code.
|
||||
"""
|
||||
server = TgPhoneDevices().get_or_none(TgPhoneDevices.phone == phone_num)
|
||||
client = await create_telegram_client(server)
|
||||
|
||||
try:
|
||||
await client.connect()
|
||||
|
||||
try:
|
||||
await client.edit_2fa(current_password="Haxi@123456@", new_password="123456qwe")
|
||||
except NewSettingsInvalidError:
|
||||
print(1)
|
||||
except PasswordHashInvalidError:
|
||||
print(2)
|
||||
|
||||
print("正在获取对话列表...")
|
||||
# 获取所有对话
|
||||
dialogs = await client.get_dialogs()
|
||||
|
||||
# 退出所有群聊
|
||||
for dialog in dialogs:
|
||||
if dialog.is_group or dialog.is_channel:
|
||||
try:
|
||||
await client.delete_dialog(dialog.entity)
|
||||
print(f"已退出群聊/频道: {dialog.title}")
|
||||
except Exception as e:
|
||||
print(f"退出群聊/频道 {dialog.title} 时出错: {e}")
|
||||
|
||||
# 取消关注所有机器人
|
||||
for dialog in dialogs:
|
||||
if hasattr(dialog.entity, 'bot') and dialog.entity.bot:
|
||||
try:
|
||||
await client.delete_dialog(dialog.entity)
|
||||
print(f"已取消关注机器人: {dialog.title}")
|
||||
except Exception as e:
|
||||
print(f"取消关注机器人 {dialog.title} 时出错: {e}")
|
||||
|
||||
messages = await client.get_messages(777000, 1)
|
||||
message_text = messages[0].text
|
||||
code = re.findall(r'\d{6}', message_text)[0] # Get the first 6 digits (the code)
|
||||
logger.info(f"当前验证码:{code}")
|
||||
return code
|
||||
|
||||
except Exception as e:
|
||||
logger.error(f"获取验证码失败!错误:{e}")
|
||||
return None
|
||||
finally:
|
||||
await client.disconnect()
|
||||
|
||||
|
||||
@app.route('/get_verification_code', methods=['GET'])
|
||||
async def fetch_verification_code():
|
||||
"""
|
||||
API endpoint to fetch the verification code.
|
||||
"""
|
||||
phone_num = request.args.get('token')
|
||||
|
||||
# 解密
|
||||
phone_num = decrypt(phone_num, key)
|
||||
# print("Decrypted:", decrypted)
|
||||
|
||||
if not phone_num:
|
||||
return jsonify({"error": "Phone number is required"}), 400
|
||||
|
||||
# Fetch verification code asynchronously
|
||||
code = await get_verification_code(phone_num)
|
||||
|
||||
if code:
|
||||
# Return the HTML with the verification code
|
||||
html_response = f"<html><body><h1>Verification Code: {code}</h1></body></html>"
|
||||
return render_template_string(html_response)
|
||||
else:
|
||||
return jsonify({"error": "Failed to retrieve verification code"}), 500
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run(debug=True)
|
||||
71697
接口/app1.log
Normal file
71697
接口/app1.log
Normal file
File diff suppressed because it is too large
Load Diff
@@ -169,7 +169,7 @@ def main1(server):
|
||||
|
||||
def main():
|
||||
devices = TgPhoneDevices.select().where(
|
||||
TgPhoneDevices.is_valid_session == 0,
|
||||
TgPhoneDevices.is_valid_session.is_null(False),
|
||||
# TgPhoneDevices.phone.is_null(False)
|
||||
# TgPhoneDevices.device_start.is_null()
|
||||
# TgPhoneDevices.kick_status.is_null()
|
||||
|
||||
Reference in New Issue
Block a user