david369
10-09-2001, 12:32 PM
As a security measure i want to add a check that my program has not been modified in anyway when it is run. An idea i had was to check the date/time modified of the file with the date/time it was compiled.
The best way would be if i could get the EXACT time it was compiled, ie to the second. Is their a way to do this out of interest?
If not then i can only do it to be accurate to the minute, as i can not set the exact second it will compile.
Thanks
sethindeed
10-09-2001, 12:41 PM
You may want to try something like this :
Dim fs As New FileSystemObject
Dim f As File
Set f = fs.GetFile(App.Path & "\MyProgram.exe")
TempField = f.DateLastModified
Banjo
10-09-2001, 12:44 PM
Bear in mind that anyone who's got the knowledge to modify an EXE will probably be to write a small program to change the time and date to whatever they want. All they'd have to do is note down the original time and date and then after they have made their mods, run their utility to reset the time and date to the original values.
charl
10-09-2001, 01:02 PM
Sometimes ago I write a litle program im C who did modify itself. I define a constant, for exemple:
static int variable[] = "modify me"
Them I search this string in exe file and write a other string of same size.
You can use the same method.
david369
10-09-2001, 01:27 PM
Thanks, i know its not totally hack proof but it will help against hex editing, and ill use it alongside a file size check, and encrpyt the date check too.
Charl, i dont see how this method helps protect the application? - Maybe i am missing somethin.
Thanks, and any other ideas for security would be appreciated.
david369
10-09-2001, 03:35 PM
I used file.datecreated and file.datelastmodified and all was well.... until i moved the file to another location.
The date created is the date that the file was created on the computer, i was previously under the impression it was the actual date that the file was made.
So i had a code
if datelastmodifed<>datecreated then msgbox "modified"
This works fine in the directory that it is made to, however when it is moved to another directory the "date created" becomes greater than the "date last modified" thus causing it to detect that the file has been modified!!! Annoying.
Any way at all to get the actual date and time the file was MADE, ie the EXE was compiled, not just the time it was put into that folder..
Volte
10-09-2001, 05:02 PM
You could have it check the filesize instead.
If at first, you don't succed, call it version 1.0.
Banjo
10-09-2001, 06:52 PM
The way it works is, if you are moving the file then the datestamp remains (because it's still the same file). As soon as you copy it, the copy is given the current datestamp because it is a new file.
Here's the rub; moving the file to another drive is effectively the same as copying it and then deleting the original so the datestamp is still changed.
So that basically means that if you want to use this method then you must keep the EXE on the same drive it was compiled on and you can not distribute it without manually changing the datestamp.