Information*/알면도움됨

Bruteforce

ch4rli3kop 2020. 8. 31. 04:09
반응형

Bruteforce

for ...

import string

def o(a, b) :
   if (a == 0) :
       return [0, 1];

   r = o(b % a, a);
   return [(r[1] - (((b // a) * r[0]))), r[0]]

ans = [0x271986B, 0xA64239C9, 0x271DED4B, 0x1186143, 0xC0FA229F, 0x690E10BF, 0x28DCA257, 0x16C699D1, 0x55A56FFD, 0x7EB870A1, 0xC5C9799F, 0x2F838E65]

res = [i for i in range(0,12)]
value = 0
printable = string.printable
for i in printable:
   for j in printable:
       for k in printable:
           for l in printable:
               value = ord(i) | ord(j) << 0x8 | ord(k) << 0x10 | ord(l) << 0x18
               value = o(value, 0x100000000)
               print('Trying : ' + l+k+j+i + ' | ' + str(res))
               if value in ans:
                   res[ans.index(value)] = l+k+j+i

permutation

import string
from itertools import *

def o(a, b) :
   if (a == 0) :
       return [0, 1];

   r = o(b % a, a);
   return [(r[1] - (((b // a) * r[0]))), r[0]]

ans = [0x271986B, 0xA64239C9, 0x271DED4B, 0x1186143, 0xC0FA229F, 0x690E10BF, 0x28DCA257, 0x16C699D1, 0x55A56FFD, 0x7EB870A1, 0xC5C9799F, 0x2F838E65]

res = [i for i in range(0,12)]
value = 0
printable = string.printable

permute = permutations(printable, 4)
temp = list(permute)
for i in temp:
   value = ord(i[0]) | ord(i[1]) << 0x8 | ord(i[2]) << 0x10 | ord(i[3]) << 0x18
   value = o(value, 0x100000000)[0]
   if value in ans:
       res[ans.index(value)] = ''.join(i)
   print('Trying : ' + ''.join(i) + ' | ' + str(res))


반응형