def __binskim(name, bin_an_dic, run_local=False, app_dir=None):
 print '[INFO] Running binskim.'
 if run_local:
  bin_path = os.path.join(app_dir, bin_an_dic['bin'])
  if platform.machine().endswith('64'):
   binskim_path = config['binskim']['file_x64']
  else:
   binskim_path = config['binskim']['file_x86']
  command = 'analyze'
  path = bin_path
  output_p = '-o'
  output_d = (bin_path + '_binskim')
  policy_p = '--config'
  policy_d = 'default'
  params = [binskim_path, command, path, output_p, output_d, policy_p, policy_d]
  pipe = subprocess.Popen(subprocess.list2cmdline(params))
  pipe.wait()
  out_file = open(output_d)
  output = json.loads(out_file.read())
 else:
  response = proxy.binskim(name, _get_token())
  output = json.loads(response)
 bin_an_dic = __parse_binskim(bin_an_dic, output)
 return bin_an_dic

def __binskim ( name , bin_an_dic , run_local = False , app_dir = None ) : print '[INFO] Running binskim.' if run_local : bin_path = os . path . join ( app_dir , bin_an_dic [ 'bin' ] ) if platform . machine ( ) . endswith ( '64' ) : binskim_path = config [ 'binskim' ] [ 'file_x64' ] else : binskim_path = config [ 'binskim' ] [ 'file_x86' ] command = 'analyze' path = bin_path output_p = '-o' output_d = ( bin_path + '_binskim' ) policy_p = '--config' policy_d = 'default' params = [ binskim_path , command , path , output_p , output_d , policy_p , policy_d ] pipe = subprocess . Popen ( subprocess . list2cmdline ( params ) ) pipe . wait ( ) out_file = open ( output_d ) output = json . loads ( out_file . read ( ) ) else : response = proxy . binskim ( name , _get_token ( ) ) output = json . loads ( response ) bin_an_dic = __parse_binskim ( bin_an_dic , output ) return bin_an_dic
run the binskim analysis .