-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhasher.py
More file actions
41 lines (33 loc) · 905 Bytes
/
hasher.py
File metadata and controls
41 lines (33 loc) · 905 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
# encoding: utf-8
dlls = [
'ntdll.dll',
'KERNEL32.DLL',
'kernel32.dll',
'KERNELBASE.dll',
'msvcrt.dll',
'f3ahvoas.dll',
]
functions = [
'NtAllocateVirtualMemory',
'VirtualAlloc',
'CreateProcessA',
'NtCreateUserProcess',
'RtlRemoveVectoredExceptionHandler',
'RtlAddVectoredExceptionHandler'
]
def hash_djb2(s):
hash = 5381
for x in s:
hash = (( hash << 5) + hash) + ord(x)
return hash & 0xFFFFFFFF
def print_hash(s):
print("string: {}, hash: {}".format(s,hex(hash_djb2(s))))
def main():
for dll in dlls:
print_hash(dll)
print("====================")
for function in functions:
print_hash(function)
if __name__ == '__main__':
main()