コード例 #1
0
ファイル: commandHandler.py プロジェクト: netcriptus/LDLogger
def getOutput(command):
    """Executes a command in the prompt and returns its result. In case of an
  error it returns am empty string"""
    try:
        return subprocess.check_output(command, shell=True)
    except Exception as err:
        errorHandler.logError("getOutput of %s " % str(command), err)
        return ""
コード例 #2
0
ファイル: commandHandler.py プロジェクト: leoscorza/LDLogger
def getOutput(command):
  """Executes a command in the prompt and returns its result. In case of an
  error it returns am empty string"""
  try:
    return subprocess.check_output(command, shell=True)
  except Exception as err:
    errorHandler.logError("getOutput of %s " % str(command), err)
    return ""
コード例 #3
0
def getDrivers(whitelist):
  """Gather the drivers available in this machine. Returns a list with all
  services, or a list with an error message if there's an error"""
  
  drvs = commandHandler.getOutput("sc query type= driver")
  if drvs == "":
    errorHandler.logError("sc calling\nThis computer can't execute sc", err)
    return ["Este computador não executa o comando sc. Impossível descobrir drivers."]
  drvs = parseSC("DRV", drvs, whitelist)
  return drvs
コード例 #4
0
def getServices(whitelist):
  """Gather the services available in this machine. Returns a list with all
  services, or a list with an error message if there's an error"""
  
  serv = commandHandler.getOutput("sc query type= service")
  if serv == "":
    errorHandler.logError("sc calling\nThis computer can't execute sc", err)
    return ["Este computador não executa o comando sc. Impossível descobrir serviços."]
  serv = parseSC("SRV", serv, whitelist)
  return serv