Thread: Encode/Decode existing exe-file

  1. #1
    Registered User
    Join Date
    Dec 2014
    Posts
    25

    Encode/Decode existing exe-file

    Hello,

    Let's say I have an exe-file (for example computer game) and need to forbid to run it until certain date or time during the day. Any 'manipulations' with file are allowed. Could you, please, offer me a simple way of how to encode/decode such a file?


    Thanks!

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    Quote Originally Posted by atztek View Post
    Hello,

    Let's say I have an exe-file (for example computer game) and need to forbid to run it until certain date or time during the day. Any 'manipulations' with file are allowed. Could you, please, offer me a simple way of how to encode/decode such a file?


    Thanks!
    You have not specified which O/S (Operating System) you are using, Linux, Mac, Windows???

    Without the source to edit, the only way I know of would be a wrapper script or batch file. I will leave it to you to write the code.

    I would not recommend attempting to alter the compiled executable in any O/S.

  3. #3
    Registered User
    Join Date
    Dec 2014
    Posts
    25
    Windows O/S.
    What kind of 'encoder' can be used in this case?
    Would be great if it could work like a self-extracting archive, which will check the current date/time and compare it with what was set during encoding.

  4. #4
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,111
    Quote Originally Posted by atztek View Post
    Windows O/S.
    What kind of 'encoder' can be used in this case?
    Would be great if it could work like a self-extracting archive, which will check the current date/time and compare it with what was set during encoding.
    A Windows Installer app might be able to prevent the app from being installed before a certain date, but that could be fooled by changing the date of the computer.
    The only way I could think of would be the installer or app communicate with a server or site on the Internet to obtain an authorization to activate the installer or app. Again, this would be best done by altering the source code for the app, or configuring the installer. I have no experience with Windows installer apps, nor for programming Windows GUI's, only with CLI data processing apps.

  5. #5
    Registered User
    Join Date
    Nov 2014
    Location
    Centurion, Gauteng, South Africa
    Posts
    28
    Oooooh i love this!

    On windows you could use a visual basic script or even a batch file . Although using a batch file makes the console visible whereas with a vbs you can decide whether you want the application launched to be visible or not - I had a quick look see at start /? and I couldn't see anything that started your program hidden.

    On linux I'm pretty sure you can write a bash script to run in the background.

    Other than that. I don't think you can simply encode an exe file to run at a specific date. If you wrote this program or game or whatever getting it to only run on a certain date wouldn't be possible. The program/script has to run to determine the date and to see whether it should run no? ( My point being something has to run to check the date and launch your application / check the date and continue or close - depending on what you intend to do - )

    You can use time and date with flags to get the current time ( and date )

    Don't you usually write something like this for malware? I think I still have a Christmas bomb somewhere :/
    Last edited by RagingGrim; 12-28-2014 at 11:09 AM.

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Again, this thread has nothing to do with C programming. It is really a windows programming problem.

    Under windows, rather than modifying an executable, it is easier to convince the operating system not to run the program. The Local Group Policy Editor can be used under professional and server versions (not home). Although more error prone, it is also possible to use registry settings to prevent Explorer from starting particular executables.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  7. #7
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    If you want to distribute a program ahead of time but not allow it to run until a specified date, you need to encrypt it. Then, the program will contact a server you control to obtain the decryption key, and you will only make that key available on the release date and not before.

    Any other kind of checks (like querying the date and then using an if statement to enable/disable the program) can be easily hacked around. What's your true goal?
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  8. #8
    Registered User
    Join Date
    Nov 2013
    Posts
    107
    Quote Originally Posted by brewbuck View Post
    If you want to distribute a program ahead of time but not allow it to run until a specified date, you need to encrypt it. Then, the program will contact a server you control to obtain the decryption key, and you will only make that key available on the release date and not before.

    Any other kind of checks (like querying the date and then using an if statement to enable/disable the program) can be easily hacked around. What's your true goal?
    I will throw this in. There is no way to 100% make executable files unhackable, by probing memory or using hex editor or dissemblers a good hacker can always bypass checks such as DRM, passwords or date/time checks and also retrieve any resources in the file like images, sounds etc.

    Most people won't bother however but it can be done.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Base54 Encode/Decode
    By MartinR in forum C Programming
    Replies: 2
    Last Post: 01-25-2014, 06:08 AM
  2. encode/decode program woes
    By dangerous :P in forum C Programming
    Replies: 13
    Last Post: 11-19-2012, 04:56 AM
  3. Encode and Decode algorith for 2 to 7 bits
    By kingofpop in forum C Programming
    Replies: 2
    Last Post: 11-15-2008, 07:08 AM
  4. frustration on URL encode-decode
    By Lince in forum C Programming
    Replies: 22
    Last Post: 08-22-2007, 05:36 PM
  5. File I/O Encode & Decode with XOR
    By DarrenY in forum C# Programming
    Replies: 2
    Last Post: 04-12-2007, 04:31 AM