当前位置: 首页>>代码示例>>Python>>正文


Python DeviceManagerADB.runCmd方法代码示例

本文整理汇总了Python中mozdevice.DeviceManagerADB.runCmd方法的典型用法代码示例。如果您正苦于以下问题:Python DeviceManagerADB.runCmd方法的具体用法?Python DeviceManagerADB.runCmd怎么用?Python DeviceManagerADB.runCmd使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mozdevice.DeviceManagerADB的用法示例。


在下文中一共展示了DeviceManagerADB.runCmd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from mozdevice import DeviceManagerADB [as 别名]
# 或者: from mozdevice.DeviceManagerADB import runCmd [as 别名]

#.........这里部分代码省略.........
    
    # Try to install addon if requested by configuration
    if self.config.addon != None:
      self.ensureExtensionInstalled(self.config.addon)
    
    print "Successfully resetted profile."

  def remoteInit(self):
    if (self.remoteInitialized != None):
      return

    self.dm = DeviceManagerADB(self.config.remoteAddr, 5555)
    self.appName = self.dm.packageName
    self.appRoot = self.dm.getAppRoot(self.appName)
    self.profileBase = self.appRoot + "/files/mozilla"
    self.profiles = self.getProfiles()

    # Install a signal handler that shuts down our external programs on SIGINT
    signal.signal(signal.SIGINT, self.signal_handler)

    if (len(self.profiles) == 0):
      print "Failed to detect any valid profile, aborting..."
      return 1

    self.defaultProfile = self.profiles[0]

    if (len(self.profiles) > 1):
      print "Multiple profiles detected, using the first: " + self.defaultProfile
      
    
    # Workaround for bug 754575. Avoid using DeviceManagerADB's "removeDir" because
    # that calls "rm" on every single entry which takes a lot of additional time.
    print "Purging possible cache leftover directories..."
    self.dm.runCmd(['shell', 'rm', '-r', self.profileBase + "/" + self.defaultProfile + "/Cache.Trash*"]).communicate()

    self.remoteInitialized = True

  def signal_handler(self, signal, frame):
    self.cleanupProcesses()
    sys.exit(0)

  def cleanupProcesses(self):
    self.stopFennec()
    if (self.HTTPProcess != None):
      try:
        self.HTTPProcess.terminate()
      except:
        pass
    if (self.logProcesses != None):
      try:
        self.stopLoggers()
      except:
        pass

  def loopFuzz(self, maxIterations=None):
    try:
      iterations = 0
      while (maxIterations == None or maxIterations >= iterations):
        self.runFuzzer()
        iterations += 1
    except:
      self.cleanupProcesses()
      raise

  def runFuzzer(self):
    self.remoteInit()
开发者ID:0xr0ot,项目名称:ADBFuzz,代码行数:70,代码来源:adbfuzz.py


注:本文中的mozdevice.DeviceManagerADB.runCmd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。