Exemplo n.º 1
0
def Usable(entity_type, entity_ids_arr):
    """MS-Dos Batch processes"""

    # This tells if this is a Python process, by checking if this runs a python interpreter.
    # TODO: What id a plain C program starts a Python interpreter from inside ?
    # TODO: Should return an explanation message.
    is_windows = lib_util.UsableWindows(entity_type, entity_ids_arr)
    if not is_windows:
        return False

    pid_proc = entity_ids_arr[0]
    try:
        # Any error, no display.
        proc_obj = psutil.Process(int(pid_proc))
    except:
        return False

    # The command line can be something like:
    # C:\windows\system32\cmd.exe /c ""C:\Users\jsmith\Developpement\ReverseEngineeringApps\StartCgiServer.cmd" "
    # "cmd.exe" /s /k pushd "C:\Users\jsmith\Developpement\ReverseEngineeringApps\PythonStyle\Tests"
    # cmd  /help
    # "C:\windows\system32\cmd.exe"
    #

    # For all of these command lines, the path is always: "C:\Windows\System32\cmd.exe"
    proc_executable, error_message = CIM_Process.PsutilProcToExe(proc_obj)
    logging.debug("proc_executable:%s" % proc_executable)

    return proc_executable.endswith("cmd.exe")
Exemplo n.º 2
0
def Usable(entity_type, entity_ids_arr):
    """MS-Dos Batch processes"""

    isWindows = lib_util.UsableWindows(entity_type, entity_ids_arr)
    if not isWindows:
        return False

    pidProc = entity_ids_arr[0]
    try:
        # Any error, no display.
        proc_obj = CIM_Process.PsutilGetProcObjNoThrow(int(pidProc))
    except:
        return False

    # The command line can be something like:
    # C:\windows\system32\cmd.exe /c ""C:\Users\rchateau\Developpement\ReverseEngineeringApps\StartCgiServer.cmd" "
    # "cmd.exe" /s /k pushd "C:\Users\rchateau\Developpement\ReverseEngineeringApps\PythonStyle\Tests"
    # cmd  /help
    # "C:\windows\system32\cmd.exe"
    #
    # cmd_line = CIM_Process.PsutilProcToCmdline(proc_obj)
    # cmdlinSplit = cmd_line.split(" ")
    # execNam = cmdlinSplit[0]

    # For all of these command lines, the path is always: "C:\Windows\System32\cmd.exe"
    procName = CIM_Process.PsutilProcToName(proc_obj)

    return procName == "cmd.exe"
Exemplo n.º 3
0
def Usable(entity_type, entity_ids_arr):
    """Can run on a directory only, on Windows, in asynchronous mode"""
    if not lib_util.UsableWindows(entity_type, entity_ids_arr):
        return False
    if not lib_util.UsableAsynchronousSource(entity_type, entity_ids_arr):
        return False
    dirNam = entity_ids_arr[0]
    return os.path.isdir(dirNam)
Exemplo n.º 4
0
def Usable(entity_type, entity_ids_arr):
	if not lib_util.UsableWindows(entity_type, entity_ids_arr):
		return False

	pathNam = entity_ids_arr[0]

	if os.path.isdir(pathNam):
		return True

	filename, file_extension = os.path.splitext(pathNam)
	fileExt = file_extension[1:].lower()

	return fileExt in fileExtensionsDox
def Usable(entity_type, entity_ids_arr):
    """Can run on a directory only, on Windows."""
    if not lib_util.UsableWindows(entity_type, entity_ids_arr):
        return False
    dir_nam = entity_ids_arr[0]
    return os.path.isdir(dir_nam)