Guest User

thunder_c

a guest
Feb 16th, 2018
1,052
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. def hash_dll(x):
  2.     if type(x) is str:
  3.         x = x.encode('ascii')
  4.     h = 0
  5.     for i in x:
  6.         h = ((h >> 0x0d) | (h << (32 - 0x0d))) & 0xffffffff
  7.         if i >= 0x61:
  8.             i -= 32
  9.         h = h + (i & 0xff)
  10.         h = h & 0xffffffff
  11.     return h
  12.  
  13. def hash(x):
  14.     if type(x) is str:
  15.         x = x.encode('ascii')
  16.     h = 0
  17.     for i in x:
  18.         h = ((h >> 0x0d) | (h << (32 - 0x0d))) & 0xffffffff
  19.         h = h + (i & 0xff)
  20.         h = h & 0xffffffff
  21.     return h
  22.  
  23. def uni(x):
  24.     return '\0'.join(x) + '\0'
  25.  
  26. dlls = [ 0x3CFA685D, 0x6A4ABC5B ]
  27.  
  28. for dll in open('dll_list.txt'):
  29.     dll = dll.strip()
  30.     h = hash_dll(uni(dll))
  31.     if h in dlls:
  32.         print(hex(h), dll)
  33.  
  34. hashes = [
  35.     0x0EC0E4E8E,
  36.     0x7C0DFCAA,
  37.     0x91AFCA54,
  38.     0x60E0CEEF,
  39.     0x534C0AB8,
  40.     0x0FF7F061A,
  41.     0xEC0E4E8E,
  42.     0x7C0DFCAA,
  43.     0x91AFCA54,
  44.     0x60E0CEEF
  45. ]
  46.  
  47. dll_funcs = set( line.split(' : ')[-1].strip() for line in open('thundercrypt_dll_funcs.txt') if 'Function Name' in line )
  48.  
  49. for name in dll_funcs:
  50.         h = hash(name)
  51.         if h in hashes:
  52.             print(hex(h), name)
  53.  
  54. """
  55. 6a4abc5b kernel32.dll
  56. 3cfa685d ntdll.dll
  57. ec0e4e8e LoadLibraryA
  58. 7c0dfcaa GetProcAddress
  59. 91afca54 VirtualAlloc
  60. 534c0ab8 NtFlushInstructionCache
  61. ff7f061a RtlExitUserThread
  62. 60e0ceef ExitThread
  63. """
Advertisement
Add Comment
Please, Sign In to add comment