?
Solved

Executable Compressor

Posted on 2003-03-22
6
Medium Priority
?
871 Views
Last Modified: 2007-12-19
hi,

I want to know how to make an executable compressor, like aspack...

can anyone help, with examples please . . .
0
Comment
Question by:D-Master
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 6

Expert Comment

by:MannSoft
ID: 8186655
I think that's probably a pretty complicated subject that'll require a bit of studying.

It's not written in Delphi, but UPX (http://upx.sf.net) is opensource.  You might be able to get some of the logic behind it from there.
0
 
LVL 5

Expert Comment

by:Gwena
ID: 8189053
Firstly... FORGET about doing this sort of thing in Delphi..


Your delphi stub that would be placed in front of the compressed exe to decompress it and place it into ram would be way too big... what's the point of compressing an exe to 1/3 original size but then sticking a big Delphi exe in front of it :-(

Do this in C or asm.... Delphi is not suitable for something that must be very tiny...


The hardest part will be figuring out how to place a decompressed exe into ram and then trick windoze into running it just as though it had been loaded from disk.

UPX is great.. and free.. so why re-invent the wheel?

There is also the free Pepack.exe which does a great job of compressing an exe... and it is sooo tiny at 14,848 bytes.

 http://groups.yahoo.com/group/BCX/files/Cool_Tools/Pepack.Exe

Pepack is so small you can just tuck it away inside a delphi exe and pop it out to windows/temp to compress an exe...

Odd thing about pepack is that the first 3 bytes of the exe are 'MZP'  just like a delphi app ???  ...maybe borland used the same signature for it's C compilers.
0
 
LVL 3

Author Comment

by:D-Master
ID: 8189691
Dear Gwena
I am not looking for the compression that aspack or upx do,
but when you compress a program in aspack you make it difficult for crackers , but aspack have a decompressor thats why I want to make my own software to make it difficult for crackers (non-professionals) to crack and open...

did you get the point (I want to make a software the crackers didn't yet have its decompressor)

Thanks
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Expert Comment

by:Munim
ID: 8189820
The main part of cracking is to debug. So here is the source for turn off the debugging function at runtime... You may not need to write a compressor...


procedure HaltDebug; assembler;
asm
  push ds
  xor ax, ax
  mov ds, ax
  mov ah, [046Ch]
@@TimerWait:
  mov al, [046Ch]
  cmp al, ah
  je @@TimerWait
  pop ds
end;

procedure AntiOn;
begin
  Port[$21] := Port[$21] or $02;
  Cli;
  Int03 := IntXX;
  Int01 := IntXX;
  Sti;
end;

procedure AntiOff;
begin
  Port[$21] := Port[$21] and $fd;
  Cli;
  Int01 := SaveInt01;
  Int03 := SaveInt03;
  Sti;
end;

begin // copy this code to your project's entry point
  HaltDebug;
  SaveInt01 := Int01;
  SaveInt03 := Int03;
end.
0
 
LVL 6

Expert Comment

by:MannSoft
ID: 8189855
When you dont use the VCL, Delphi will make tiny executables.  And since you wouldnt need the VCL for something like this, you wouldnt have to worry about a 300k EXE.
0
 
LVL 5

Accepted Solution

by:
Gwena earned 750 total points
ID: 8190610
Hi D-Master :-)

  A cracker can very easily grab the image of the decompressed exe right out of the ram... and with a tiny bit of fixup that image will run..so using a compression scheme to keep them away from the exe won't work. A cracker need not ever use the various decompressors.

  You can't provide protection by trying to keep your exe away from them....they will find it :-/

  Other than key-disks, dongles, or control of the hardware there is no good way to protect your exe.

  You can make life more difficult for crackers but if your work is worth the trouble they will get at it...

p.s. If you delete the UPX markers from the beginning of a compressed exe the built in UPX decompressor won't work any more... basically just use a file editor like FrHed.exe to overwrite these markers...just remove any mention of UPX and the file won't decompress any more.

Here is what you get when you try to decompress such an exe...

C:\WINDOWS\Desktop>upx -d portie.exe
                     Ultimate Packer for eXecutables
               Copyright (C) 1996, 1997, 1998, 1999, 2000
UPX v1.02        Markus F.X.J. Oberhumer & Laszlo Molnar        Sep 13th 2000

        File size        Ratio      Format      Name
   -------------------   ------   -----------   -----------
upx: portie.exe: CantUnpackException: file is modified/hacked/protected; take ca
re!!!

Unpacked 0 files.


If you not only remove the markers but also insert bogus markers for some other compressor then you might cause a few minutes of grief for the casual cracker :-)

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question