def dex_2_smali(app_dir, tools_dir):
 try:
  print '[INFO] DEX -> SMALI'
  dex_path = (app_dir + 'classes.dex')
  if ((len(settings.BACKSMALI_BINARY) > 0) and isFileExists(settings.BACKSMALI_BINARY)):
   bs_path = settings.BACKSMALI_BINARY
  else:
   bs_path = os.path.join(tools_dir, 'baksmali.jar')
  output = os.path.join(app_dir, 'smali_source/')
  args = [(settings.JAVA_PATH + 'java'), '-jar', bs_path, dex_path, '-o', output]
  subprocess.call(args)
 except:
  PrintException('[ERROR] Converting DEX to SMALI')

def dex_2_smali ( app_dir , tools_dir ) : try : print '[INFO] DEX -> SMALI' dex_path = ( app_dir + 'classes.dex' ) if ( ( len ( settings . BACKSMALI_BINARY ) > 0 ) and isFileExists ( settings . BACKSMALI_BINARY ) ) : bs_path = settings . BACKSMALI_BINARY else : bs_path = os . path . join ( tools_dir , 'baksmali.jar' ) output = os . path . join ( app_dir , 'smali_source/' ) args = [ ( settings . JAVA_PATH + 'java' ) , '-jar' , bs_path , dex_path , '-o' , output ] subprocess . call ( args ) except : PrintException ( '[ERROR] Converting DEX to SMALI' )
run dex2smali .