Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
创建一个副本并使用Python启动一个可执行文件,为进程提供一个随机名称_Python_Python 2.x - Fatal编程技术网

创建一个副本并使用Python启动一个可执行文件,为进程提供一个随机名称

创建一个副本并使用Python启动一个可执行文件,为进程提供一个随机名称,python,python-2.x,Python,Python 2.x,我想用Python启动一个可执行文件,但给它一个不同的进程名。举个例子说明为什么,的页面提到它现在由一个服务调用,该服务使用随机名称创建可执行文件的副本并运行它。这有助于跟踪在检测到Rootkit Revealer存在时不会运行的恶意软件。这是由 Rootkit展示器现在已经被放弃,但恶意软件仍然希望避免像Wireshark和process monitor这样的软件。在家里,我想到了以下几点: import psutil import subprocess import shutil rand

我想用Python启动一个可执行文件,但给它一个不同的进程名。举个例子说明为什么,的页面提到它现在由一个服务调用,该服务使用随机名称创建可执行文件的副本并运行它。这有助于跟踪在检测到Rootkit Revealer存在时不会运行的恶意软件。这是由

Rootkit展示器现在已经被放弃,但恶意软件仍然希望避免像Wireshark和process monitor这样的软件。在家里,我想到了以下几点:

import psutil
import subprocess
import shutil

randomString = "saf9dsfjkoopY.exe"
shutil.copy("C:\\Windows\System32\\notepad.exe",randomString)
p = subprocess.Popen(randomString)

# Look for process by name
for proc in psutil.process_iter():
    try:
        process_info = proc.as_dict(attrs=['pid','name'])
    except psutil.NoSuchProcess:
        pass
    else:
        if process_info['name'] == "TextPad.exe":
            print(process_info)
        if process_info['name'] == "notepad.exe":
            print(process_info)
你认为第一部分在重命名进程和规避恶意软件方面有效吗?让可执行文件作为服务而不是常规进程运行,会有什么好处?使用以下代码来避免使用某些安全工具:

std::vector<DWORD> SetOfPID;
        GetProcessID("Wireshark",SetOfPID);
        if (SetOfPID.empty())
        {
                // Nothing found running, Safe to execute bot.
        }
        else
        {
                // One of the process was found running, Exit install.
                // If you want to you could also make it kill connections or cut process. ~ h1t3m
        ExitProcess(0);
std::vector SetOfPID;
GetProcessID(“Wireshark”,SetOfPID);
if(SetOfPID.empty())
{
//未发现任何正在运行的内容,可以安全地执行bot。
}
其他的
{
//发现其中一个进程正在运行,请退出安装。
//如果你想,你也可以让它关闭连接或切断进程。~h1t3m
退出过程(0);

如果指定
Popen([randomString],executable='notepad.exe',会发生什么情况
?系统找不到指定的文件如果您提供
notepad.exe的完整路径,或者将其与
randomString
?交换,则会发生什么情况?感谢这些建议。使用该语句中的完整路径将在进程名“notepad.exe”下打开记事本。颠倒顺序将给出“SyntaxError:non-keyword arg after keyword arg”你的意思是在
Popen([randomString],executable=r'c:\full\path\notepad.exe')
call
psutil
finds
process\u info['name']=“notepad.exe”
而不是
randomString
之后,通过交换我的意思是:
Popen([r'c:\full\path\notepad.exe'],executable=randomString)
(应该失败)