Skip to content

Instantly share code, notes, and snippets.

@vient
Created May 22, 2020 21:20
Show Gist options
  • Save vient/3724d979e3d76016a34584471bd93fe4 to your computer and use it in GitHub Desktop.
Save vient/3724d979e3d76016a34584471bd93fe4 to your computer and use it in GitHub Desktop.
IDA FLAIR helper, pass a path to directory with (Boost) libs
import os
import sys
FLAIR_DIR = r'D:\work\ida\7.5\flair75\bin\win'
PCF = os.path.join(FLAIR_DIR, "pcf.exe")
SIGMAKE = os.path.join(FLAIR_DIR, "sigmake.exe")
def boost_lib_to_desc(lib):
assert 'mt-x' in lib, 'Only /MT libs'
tokens = lib.split('.')[0].split('-')
name = tokens[0]; name = name.replace('libboost_', '').replace('_', '.').title()
# compiler = tokens[1]
compiler = 'MSVC 14'
flags = '/MT'
bitness = tokens[3]
version = tokens[4]; version = version.replace('_', '.')
return f'Boost.{name} {version} {bitness} ({compiler}, {flags})'
def main():
os.chdir(sys.argv[1])
libs = [lib for lib in os.listdir() if lib.endswith('.lib')]
for lib in libs:
pat = lib.replace(".lib", ".pat")
sig = lib.replace(".lib", ".sig")
exc = lib.replace(".lib", ".exc")
description = boost_lib_to_desc(lib)
os.system(f'{PCF} {lib} {pat}')
os.system(f'{SIGMAKE} -n"{description}" {pat} {sig}')
if os.path.exists(exc):
with open(exc, 'r') as f:
lines = f.readlines()
while lines and lines[0].startswith(';'):
lines = lines[1:]
with open(exc, 'w') as f:
f.write(''.join(lines))
os.system(f'{SIGMAKE} -n"{description}" {pat} {sig}')
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment