How to change a date inside an EXE file?

-3

0

I have come to a conclusion that every time this program goes beyond a date it gives me problem. So I would like to hack the exe and modify that date to avoid that problem. How to do that?

It's a windows .exe. When the problem occurs I receive a message. I can find the text of that message inside the .exe file using a simple search program. But I can't find that trigger date.

Perhaps because there's plenty of ways of recording a date in a program, I mean 18_09 17.10 17/09/2013, ...

FernandoSBS

Posted 2013-12-10T17:58:37.183

Reputation: 1 541

1strings in a exe remain just encoded text, but date formats are binary types, and will not appear in any kind of text search. what you are asking for will be quite tricky for someone without knowledge of debugging and the binary patching of files. – Frank Thomas – 2013-12-10T18:04:26.157

Maybe the best courses of action are the following: 1. Go back a couple of years in your own computer date. 2. Actually explain what is your concrete problem, with what software. Trying to hack (let's say disassemble) executables is time consuming and near fruitless. For the record, I do have software that behaves like that and usually I just regress the PC's date. – Doktoro Reichard – 2013-12-10T18:13:00.717

@DoktoroReichard do you know any simple program (so I can avoid having to write one myself) that would change the date to a good one, start the app, and just after it perceives program started it changes the date back? – FernandoSBS – 2013-12-10T18:42:56.313

@FrankThomas is there any program you know which would convert a date I give to the binary format so I can search the file for that? it's quite simple. Also, what program do I need to overwrite that binary code with the new date binary code? – FernandoSBS – 2013-12-10T18:49:03.400

I'd say parsing the existing date is prerequisite to writing it back, but basically, you would read in the program binary, determine the length and offset you need to overwrite at, generate your new date, replace from offset for length, and write the file back out again. – Frank Thomas – 2013-12-10T19:12:38.673

@FrankThomas ok but how to find the date in the exe code? I have used an hex editor but how should I convert the date to one that the program can searches? For ex, 2013/12/07 ? – FernandoSBS – 2013-12-10T19:15:24.530

1questions like these are the reason we as a group are trying to convince you to give up, or take another tact. as it standas without knowing the runtime and compiler used in compiling your application, there is no way to even begin looking. – Frank Thomas – 2013-12-10T20:33:43.793

1@FernandoSBS If this is to avoid a license which expired (you didn't specify "your problem") then you probably won't find a 'hard' date (binary or otherwise) in the code. (I'm a programmer and i wouldn't make it that easy ;). Even so, SU is not a place to ask for advise to hack a program like that (too technical and slightly unethical) You might haves some luck creating a batch-file with saving the date from date /t, setting it to date 01-01-2013, starting your program and setting the date back to date %saved_date%. – Rik – 2013-12-10T20:38:03.203

Answers

3

I take the chance to write this answer to advise you against messing with the executable itself. As for why, here are the reasons stated in the comments and some of mine:

  • As Rik said, most likely the developer of said program didn't hardcode the actual expiration date (as that would entail building another program as soon as a year passed). That would mean higher maintenance and support costs for said developer.
  • Even if he did hardcode the date, there is no consensus on how to store it. If the expiration date is a string, you might have some luck because as Frank said, most strings are stored as is inside an executable. This isn't a rule, however, and the string might be encrypted or, depending on how the compiler optimized the code, it might be buried inside binary text you can't easily understand.
  • Assuming you could disassemble the program, you would then need to understand the thousands of lines of code that went into the program and detect where the expiration date is stored or called from. However, and depending on country and legislation, this activity is either frowned upon or illegal.

Advices aside, I'm piggybacking on what Rik said, and expanding it a little.

You can create a batch file (as you said .exe files, I'm assuming Windows) using the following commands:

SET CUR_DATE=%DATE%
DATE <insert your pretended date here>
<start your program here>
DATE %CUR_DATE%

Although I haven't tested it, this supposedly does the following:

  1. Stores the current date, as given by %DATE%.
  2. Sets the PC's date to the one you want, using the DATE command.
  3. Runs the program you want.
  4. Resets the date to the current one, as soon as your program exits.

You can store this batch inside the program's directory, as such you only need to write the program's name, rather than the full path. Be consistent, however, on the date you input, as it needs to be in the same format as what your system expects. See the link about the DATE command for more info; alternatively just do echo %date% to see what format your computer expects the date you input to be.

Doktoro Reichard

Posted 2013-12-10T17:58:37.183

Reputation: 4 896

Yeah. This is one of those cases where if you have the skill to do it you have the knowledge to know how to go about it. In the old days it actually wasn't that hard if the stuff wasn't hidden (Each new version of Dos I would go through and patch command.com to change the default environment size) but as we move to higher level languages you get more and more crud in the way and it gets much harder to find what you're looking for. – Loren Pechtel – 2013-12-10T22:36:11.530

Problem is, I would like the date to come back to %DATE% as soons as the programs open up. Not after it closes. – FernandoSBS – 2013-12-10T23:50:34.350

2

If so, add start (http://ss64.com/nt/start.html) before the program name/path. But are you sure the program will run afterwards?

– Doktoro Reichard – 2013-12-10T23:52:15.430

yes, it works. I had to use netstat waiting for 1000 ms to make it work, since it seems there's no pause or wait command in BAT? – FernandoSBS – 2013-12-11T16:37:49.257

1@FernandoSBS netstat will work too. ping 1.1.1.1 -n 1 -w 3000 > nul is another way (it will sleep for 3 seconds, or adjust the 3000 for the milliseconds). – Rik – 2013-12-11T16:59:13.027

yeah netstat is what I've used. – FernandoSBS – 2013-12-11T17:04:44.193

@FernandoSBS Ooo, and have we forgotten about timeout 1 ?? ;) So the batchfile doesn't really have a native way but we already have 3 alternatives. – Rik – 2013-12-11T17:08:07.233

0

Resource Hacker (http://www.angusj.com/resourcehacker/) is a freeware tool that can be used to open and change code and other stuff inside exe files.

Matthew

Posted 2013-12-10T17:58:37.183

Reputation: 253