Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import string
- import random
- # generate alhpanumeric char
- def alphanumeric():
- for i in string.printable[:62]:
- yield i
- # chest diinisiasi, key nya random.
- # hintnya alphanumeric dan ngasih tauin jumlah benar jika key yg dimasukin benar
- class chest:
- def __init__(self):
- self.raw_key = list('V3r1t4Spr0b1t4SJust1t14')
- random.shuffle(self.raw_key)
- self.right_key = ''.join(self.raw_key)
- print(self.right_key)
- def open(self, key):
- # padding, fill key to same lenght as self.right_key
- key = key.ljust(len(self.right_key), '@')
- assert len(key) == len(self.right_key)
- right = 0
- for r, rk in zip(key, self.right_key):
- if r == rk:
- right += 1
- # right -= 1
- # bisa ditambah challange kurangin kalo salah wkkk
- if right == len(self.right_key):
- return 'Chest terbuka!'
- return ('Chest masih tertutup, ayo coba lagi sebelum giliran berikutnya! benar:', right)
- def bruteforcer(chest, key, right_counted):
- buka = chest.open(key)
- if 'terbuka' in buka:
- return 'Done'
- if buka[1] > right_counted:
- return 'Process'
- def main():
- # hint key: alphanumeric.
- # tiap kali chest di-inisiasi alias pergiliran, akan dirandom keynya.
- some_interesting_chest = chest()
- # bisa diterapin di pwn.
- print([x for x in alphanumeric()])
- key_bruteforced = ''
- right_counted = 0
- run = True
- while run:
- for i in alphanumeric():
- right_counted = len(key_bruteforced)
- check = key_bruteforced + i
- status = bruteforcer(
- some_interesting_chest, check, right_counted)
- if status is not None:
- key_bruteforced += i
- print(key_bruteforced)
- if status is 'Process':
- break
- elif status is 'Done':
- run = False
- break
- print(key_bruteforced)
- if __name__ == '__main__':
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement