-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathauth_mem.py
36 lines (30 loc) · 924 Bytes
/
auth_mem.py
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
import pefile
from Result_DataFrame import *
import struct
#edit - Add new code mem auth
def authmem(file_path):
pe = pefile.PE(file_path)
for section in pe.sections:
print('[SECTION]',section.Name.decode('utf-8'))
cha = section.Characteristics
#section Characteristics
#code and data
cd = (cha & 0xFF) >> 4
if (cd & 0x2) == 0x2 :
print( 'contains code')
if (cd & 0x4) == 0x4 :
print('data_initialized')
if (cd & 0x8) == 0x8 :
print('data_uninitialized')
#memory
mem = (cha & 0xFFFFFFFF) >> 28
if (mem & 0x2) == 0x2 :
print('shared')
if (mem & 0x2) == 0x2 :
print('executeable')
if (mem & 0x4) == 0x4 :
print('readable')
if (mem & 0x8) == 0x8 :
print('writable')
print()
#help! - another options?