Skip to content

Instantly share code, notes, and snippets.

@BZHugs
Created December 18, 2019 07:38
Show Gist options
  • Save BZHugs/36cd878e234959508def59649ef0d38d to your computer and use it in GitHub Desktop.
Save BZHugs/36cd878e234959508def59649ef0d38d to your computer and use it in GitHub Desktop.
# coding: utf8
from pwn import *
'''
~ » nc 46.30.204.44 4000
,---,---,---,
| 1 | 2 | 3 |
'---,---,---'
| 4 | | |
'---,---,---'
| 7 | 8 | |
'---,---,---'
| * | | # |
'---'---'---'
Better be fast, you have 2 seconds.
Enter the 4 digit code :
'''
def search_used_digits(pad):
digit = []
for i in range(10):
if not str(i) in pad:
digit.append(i)
return digit
found = False
while found == False:
r = remote('46.30.204.44', 4000)
pad = r.recvuntil("Better ")
r.recvuntil("Enter the 4 digit code :")
# print pad
used_digits = search_used_digits(pad)
if len(used_digits) == 4:
r.sendline("".join([str(i) for i in used_digits]))
result = r.recvuntil("\n")
if not "Wrong" in result:
found = True
print result
r.interactive()
r.close()
@sancelisso
Copy link

What is the argument pad?

@BZHugs
Copy link
Author

BZHugs commented Dec 22, 2019

This is the digipad string scheme like this example:

             ,---,---,---,
             | 1 | 2 | 3 |
             '---,---,---'
             | 4 |   |   |
             '---,---,---'
             | 7 | 8 |   |
             '---,---,---'
             | * |   | # |
             '---'---'---'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment