def tools_binskim():
 binskim_nuget = CONFIG['binskim']['nuget']
 mobsf_subdir_tools = CONFIG['MobSF']['tools']
 nuget = (mobsf_subdir_tools + CONFIG['nuget']['file'])
 print '[*] Downloading and installing Binskim...'
 output = subprocess.check_output([nuget, 'install', binskim_nuget, '-Pre', '-o', mobsf_subdir_tools])
 folder = re.search('Microsoft\\.CodeAnalysis\\.BinSkim\\..*(\'|") ', output)
 try:
  if (sys.version_info.major == 3):
   folder = str(folder.group(0)[:(-2)])[2:(-1)]
  else:
   folder = folder.group(0)[:(-2)]
 except AttributeError:
  print '[!] Unable to parse folder from binskim nuget installation.'
  sys.exit()
 binaries = _find_exe((mobsf_subdir_tools + folder), [])
 if (len(binaries) != 2):
  print '[!] Found more than 2 exes for binskim, panic!'
  sys.exit()
 if ('x86' in binaries[0]):
  CONFIG['binskim']['file_x86'] = binaries[0]
  CONFIG['binskim']['file_x64'] = binaries[1]
 else:
  CONFIG['binskim']['file_x86'] = binaries[1]
  CONFIG['binskim']['file_x64'] = binaries[0]
 with open(os.path.join(CONFIG_PATH, CONFIG_FILE), 'w') as configfile:
  CONFIG.write(configfile)

def tools_binskim ( ) : binskim_nuget = CONFIG [ 'binskim' ] [ 'nuget' ] mobsf_subdir_tools = CONFIG [ 'MobSF' ] [ 'tools' ] nuget = ( mobsf_subdir_tools + CONFIG [ 'nuget' ] [ 'file' ] ) print '[*] Downloading and installing Binskim...' output = subprocess . check_output ( [ nuget , 'install' , binskim_nuget , '-Pre' , '-o' , mobsf_subdir_tools ] ) folder = re . search ( 'Microsoft\\.CodeAnalysis\\.BinSkim\\..*(\'|") ' , output ) try : if ( sys . version_info . major == 3 ) : folder = str ( folder . group ( 0 ) [ : ( - 2 ) ] ) [ 2 : ( - 1 ) ] else : folder = folder . group ( 0 ) [ : ( - 2 ) ] except AttributeError : print '[!] Unable to parse folder from binskim nuget installation.' sys . exit ( ) binaries = _find_exe ( ( mobsf_subdir_tools + folder ) , [ ] ) if ( len ( binaries ) != 2 ) : print '[!] Found more than 2 exes for binskim, panic!' sys . exit ( ) if ( 'x86' in binaries [ 0 ] ) : CONFIG [ 'binskim' ] [ 'file_x86' ] = binaries [ 0 ] CONFIG [ 'binskim' ] [ 'file_x64' ] = binaries [ 1 ] else : CONFIG [ 'binskim' ] [ 'file_x86' ] = binaries [ 1 ] CONFIG [ 'binskim' ] [ 'file_x64' ] = binaries [ 0 ] with open ( os . path . join ( CONFIG_PATH , CONFIG_FILE ) , 'w' ) as configfile : CONFIG . write ( configfile )
download and extract binskim .