Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi an Exe Packer (https://www.delphipraxis.net/102791-exe-packer.html)

micha2330 5. Nov 2007 00:49


an Exe Packer
 
Hi every body .
i really want to create an Exe Packer , is there any help .
or could someone point me to an Open source Exe Packer developped in Delphi .
I really need your help .

many thanks

Micha

Nuclear-Ping 5. Nov 2007 02:22

Re: an Exe Packer
 
Afaik is UPX open source, but written in C++ and Asm.

There was a question here shortly containing a PEEncrypt program written in Delphi along with its source. This could also be a good study object (-> http://www.delphipraxis.net/internal...t.php?t=119110).

But dude, no offense, asking such a question automatically somehow disqualifies you from completing such a task. This subject is quite delicate and nothing for neophytes. It's like asking "I want to write an operating system in Delphi. Are there any example sources?" - hope you got what I mean.

Phoenix 5. Nov 2007 07:23

Re: an Exe Packer
 
/me slaps Nuclear-Ping around a bit with a large trout.
You can't write an OS in Delphi. (yes, I know you know that. Simply could not resist :mrgreen: )

Nuclear-Ping 5. Nov 2007 08:10

Re: an Exe Packer
 
Yes - And so you can't write an Exe Packer in Delphi. Or at least not the unpacker. ;)

hathor 5. Nov 2007 11:04

Re: an Exe Packer
 
http://www.petricek.net/bca_olds.tar.bz2

Delphi-Quellcode:
{this program strips any unnecessary info from exe header and add exe-filesize
info to win32 programs (need for win32 sfx to work)}
uses b_crypt;
const
 sec:array[1..3] of longint=($1f8,$220,$248);
 UPX=$21585055;
 UPX1=$30585055;
 UPX2=$31585055;
 UPX3=$32585055;
 shitty:string[255]=
 #10#0'$Info: This file is packed with the UPX executable packer [url]http://upx.tsx.org[/url] $'#10+
 #0'$Id: UPX 0.94 Copyright (C) 1996-1999 Laszlo Molnar & Markus Oberhumer $'#10+
 #0'$Id: NRV 0.61 Copyright (C) 1996-1999 Markus F.X.J. Oberhumer $'#10;
 shitty2:string[255]=
 #0'$License: NRV for UPX is distributed under special license $'#10+
 #0'UPX!';
var
 f:file;
 i,s,t:longint;
 ss:string;
begin
 ss:=shitty;
 writeln('UPX header strip v0.1 by Bilbo');
 writeln('Usage: UPXS <file.exe>');
 if paramcount<1 then halt;
 assign(f,paramstr(1));
 reset(f,1);
 Writeln('Trying DOS UPX...');
 seek(f,$55);
 blockread(f,s,4);
 if s=UPX then begin
  s:=0;
  seek(f,$55);
  blockwrite(f,s,4);
  writeln('DOS: UPX signature removed.');
  close(f);
  halt;
 end else writeln('Error: Not DOS upx exe (',hexl(s),'<>',hexl(UPX),')');
 Writeln('Trying WIN32 UPX...');
 seek(f,60);
 blockread(f,s,4);
 seek(f,s);
 blockread(f,t,4);
 if t=$00004550 then begin
  seek(f,s-4);
  t:=filesize(f);
  blockwrite(f,t,4);
  Writeln('WIN32: Exe filesize written');
  seek(f,$2c5);
  ss[0]:=shitty[0];
  blockread(f,ss[1],ord(ss[0]));
  if ss=shitty then begin
   seek(f,$2c5);
   fillchar(ss[1],ord(ss[0]),0);
   blockwrite(f,ss[1],ord(ss[0]));
   Writeln('WIN32: UPX Comment1 removed');
  end else Writeln('WIN32: UPX Comment1 not found');
  if ioresult<>0 then writeln('WIN32: IO Error.');
  seek(f,$2c5+ord(shitty[0]));
  ss[0]:=shitty2[0];
  blockread(f,ss[1],ord(ss[0]));
  if ss=shitty2 then begin
   seek(f,$2c5+ord(shitty[0]));
   fillchar(ss[1],ord(ss[0]),0);
   blockwrite(f,ss[1],ord(ss[0]));
   Writeln('WIN32: UPX Comment2 removed');
  end else Writeln('WIN32: UPX Comment2 not found');
  if ioresult<>0 then writeln('WIN32: IO Error.');
  {Section rename}
  for i:=1 to sizeof(sec) div 4 do begin
   seek(f,sec[i]);
   blockread(f,s,4);
   if (s=UPX1) or (s=UPX2) or (s=UPX3) then begin
    s:=0;
    seek(f,sec[i]);
    blockwrite(f,s,4);
    writeln('UPX section renamed (',i,').');
   end else writeln('Error: Not UPX section(',hexl(s),')');
  end;
  if ioresult<>0 then writeln('WIN32: IO Error.');
 end else writeln('Error: Not WIN32 PE executable');
 close(f);
end.

shmia 5. Nov 2007 16:06

Re: an Exe Packer
 
It is possible to compress only the DFM-Resources but not the code itself.
This task can be done with delphi. But it isn't easy.
I've seen this sharware tool on the Delphi Additional CD-ROM.


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:35 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz