Changeset View
Changeset View
Standalone View
Standalone View
contrib/devtools/security-check.py
Show First 20 Lines • Show All 126 Lines • ▼ Show 20 Lines | |||||
def get_PE_dll_characteristics(executable): | def get_PE_dll_characteristics(executable): | ||||
''' | ''' | ||||
Get PE DllCharacteristics bits. | Get PE DllCharacteristics bits. | ||||
Returns a tuple (arch,bits) where arch is 'i386:x86-64' or 'i386' | Returns a tuple (arch,bits) where arch is 'i386:x86-64' or 'i386' | ||||
and bits is the DllCharacteristics value. | and bits is the DllCharacteristics value. | ||||
''' | ''' | ||||
p = subprocess.Popen([OBJDUMP_CMD, '-x', executable], stdout=subprocess.PIPE, | p = subprocess.Popen([OBJDUMP_CMD, '-x', executable], stdout=subprocess.PIPE, | ||||
stderr=subprocess.PIPE, stdin=subprocess.PIPE, universal_newlines=True) | stderr=subprocess.PIPE, stdin=subprocess.PIPE, universal_newlines=True) | ||||
(stdout, stderr) = p.communicate() | (stdout, stderr) = p.communicate() | ||||
if p.returncode: | if p.returncode: | ||||
raise IOError('Error opening file') | raise IOError('Error opening file') | ||||
arch = '' | arch = '' | ||||
bits = 0 | bits = 0 | ||||
for line in stdout.splitlines(): | for line in stdout.splitlines(): | ||||
tokens = line.split() | tokens = line.split() | ||||
▲ Show 20 Lines • Show All 91 Lines • Show Last 20 Lines |