[英]C language program is detected as a virus
#include<stdio.h>
#include<conio.h>
union abc
{
int a;
int x;
float g;
};
struct pqr
{
int a;
int x;
float g;
} ;
void main()
{
union abc b;
struct pqr c;
clrscr();
b.a=10;
textbackground(2);
textcolor(6);
cprintf(" A = %d",b.a);
printf("\nUnion = %d",sizeof(b));
printf("\nStructure = %d",sizeof(c));
getch();
}
我已将该程序另存为virus.cpp。 我正在使用Turbo C编译器来编译此程序,并从Turbo C(Ctrl + F9)运行。
我正在使用Windows 7,并且已经安装了Avira AntiVir病毒系统。
当我尝试运行上述程序时,它会创建蠕虫(DOS / Candy)。 我相信程序没有错。
现在这里有一些特别的东西。 执行以下差异的相同程序。 这里唯一的区别是\\n
之间的空格:
#include<stdio.h>
#include<conio.h>
union abc
{
int a;
int x;
float g;
};
struct pqr
{
int a;
int x;
float g;
} ;
void main()
{
union abc b;
struct pqr c;
clrscr();
b.a=10;
textbackground(2);
textcolor(6);
cprintf(" A = %d",b.a);
printf("\n Union = %d",sizeof(b));
printf("\n Structure = %d",sizeof(c));
getch();
}
区别仅在于\\ n和空间。 我的问题是,为什么我的简单程序被检测为病毒?
这是本次C ++的另一个代码示例:
#include<iostream.h>
#include<conio.h>
class A
{
int a,b;
public:
A()
{
a=0;b=0;
}
A(int x)
{a=x;
b=0;
}
A(int x,int y)
{
a=x;
b=y;
}
~A()
{
cout<<"All things are deleted.";
}
void get()
{
cout<<"\nA = "<<a;
cout<<"\nB = "<<b;
}
};
void main()
{
A a1(5,10);
clrscr();
a1.get();
getch();
}
当我运行该程序时,它会显示“病毒警告”-即使它不是病毒。 现在,悲剧是当您删除析构函数时,它不会将其检测为病毒。
这是屏幕截图和类似的问题:
问题是如何以及为什么?
病毒扫描程序使用试探法和签名来检测漏洞。 误报是不可避免的。 您的程序似乎触发了启发式。 大概它的校验和,文件大小或其他特征与已知病毒匹配。 第二个事实是,只需进行少量更改即可解决问题。
编辑调用您的应用程序Virus.exe是一个非常不幸的选择,我认为它会迅速触发大多数病毒扫描程序(尽管它对于真正的病毒肯定不是一个完美的名字...)。
看起来像一个假阳性。 由于现代病毒使用多态性来隐藏反病毒程序,因此反病毒程序必须报告甚至部分匹配,并且显然,具有给定源代码的编译器会与该恶意软件产生部分匹配。
我认为您在某处存在真正的病毒,可能已修改了标准库:D或只是防病毒程序在可执行文件中检测到病毒码。
请参阅http://www.viruslist.com/en/viruses/encyclopedia?virusid=1857 。
我的猜测是,Antivir会扫描DOS / Candy包含的文本字符串,并且由于第二段代码中的代码就像它要查找的代码一样,Antivir会将已编译的可执行文件检测为病毒。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.