代码拉取完成,页面将自动刷新
// VSThread.cpp
#include "vsthread.h"
#include <QDebug>
VSThread::VSThread(const QString& cmd, const QStringList& args) : command(cmd), arguments(args)
{
}
void VSThread::run()
{
qDebug() << "Running command: " << command << " with arguments: " << arguments.join(" ");
// Create a process to run ClamAV
QProcess clamavProcess;
clamavProcess.start(command, arguments);
if (!clamavProcess.waitForStarted())
{
qDebug() << "Error starting ClamAV process.";
return;
}
QString infectedFilePath; // Variable to store infected file path
while (clamavProcess.waitForReadyRead())
{
QString output = clamavProcess.readAllStandardOutput();
QStringList lines = output.split('\n', Qt::SkipEmptyParts);
for (const QString& line : lines)
{
// Print ClamAV scan details
qDebug() << line;
emit outputUpdated(line);
// Check if the line indicates a virus detection
if (line.contains("FOUND"))
{
// Extract the infected file path
QStringList parts = line.split(' ', Qt::SkipEmptyParts);
if (parts.size() >= 3) // Make sure there are enough parts
{
infectedFilePath = parts[parts.size() - 2] + ' ' + parts[parts.size() - 1];
qDebug() << "Infected file found: " << infectedFilePath;
// emit outputUpdated(infectedFilePath);
}
else
{
qDebug() << "Error parsing infected file path.";
}
}
}
}
if (clamavProcess.exitCode() == 0)
{
qDebug() << "Scan completed. No viruses found.";
}
else
{
qDebug() << "Scan completed with errors. Exit code: " << clamavProcess.exitCode();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。