PDA

View Full Version : Security issues


sside
06-24-2004, 07:45 AM
I'm working with ams5 on how to secure the (content) CD/DVD or files and i came up with this code.
------------------------------------------------------------------------
expire_date = "24/07/2004"
actual_date = System.GetDate(DATE_FMT_EUROPE);

if (actual_date > expire_date) then
result = Dialog.Message("Notice", "Expired, application will exit now.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
Application.Exit();
else
result = Dialog.Message("Notice", "Welcome", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
-------------------------------------------------------------------------
Although this might be a good way to secure somehow the CD/DVD it will not secure the content of CD/DVD. Now here come my questions,

1-Does anybody know some better way (code) to secure the contents of CD/DVD?
2-Can ams5 produce compressed executable with the size of CD/DVD knowing that this way the contents will somehow be protected.

Thank you

Philo
06-24-2004, 08:53 AM
Although I havn't done this myself perhaps you could purchase the encryption plugin and use that to secure you data. You could store the password in your AMS code and so you could control access to the files.

Would probably slow down any applications though especially video

I would be interested to here the results if you did try this.

TJ_Tigger
06-24-2004, 09:15 AM
Here (http://www.indigorose.com/forums/showthread.php?t=7758&highlight=bruce) is a post that Bruce put up that will check on the date and expire after 365 days, it will also check to see if the system clock has been modified and exit the program as well. Maybe Bruce will post the completed code from his project.

Tigg

Bruce
06-25-2004, 06:54 PM
Hey Sside-
Here ya go! Again Tigg is being very gracious. This was a collaboration between Tigg and myself on a difficult project that needed some measure of security. Keep in mind, nothing is for sure when it comes to your CDs security.

I’m sure there are other ways around this so… keep plugging at it buddy and good luck!

OH! B.T.W… You will need the crypto-plug-in to use this.

I think it's all here, let me know if it's not. ;)



----------On preload FIRST PAGE (or what ever page)-----------
start_date = System.GetDate(DATE_FMT_JULIAN);

--Gets end users MAC address and places it in the Registry
laninfo = System.GetLANInfo()
--Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\741993\\Data", "system", laninfo.NIC, REG_SZ);


--Takes the MAC address and writes a text file to the temp folder
TextFile.WriteFromString(_TempFolder.."\\1.txt", laninfo.NIC, false);

--Encrypts the text above
encryptedtxt1 = Crypto.Base64EncodeToString(_TempFolder.."\\1.txt");
--The next two lines encrypt the code again
TextFile.WriteFromString(_TempFolder.."\\1.txt", encryptedtxt1, false);
encryptedtxt = Crypto.Base64EncodeToString(_TempFolder.."\\1.txt");



--and stores it into the Registry for later use and then deletes the text file
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\741993\\Data", "edata", encryptedtxt, REG_SZ);


--cdname = TextFile.ReadToString("AutoPlay\\Docs\\Data.trz");



--Deleates the now encrypted 1.txt file
File.Delete(_TempFolder.."\\1.txt", false, false, false, nil);


TextFile.WriteFromString(_TempFolder.."\\cert.txt", start_date, false);
encoded = Crypto.Base64EncodeToString(_TempFolder.."\\cert.txt");
File.Delete(_TempFolder.."\\cert.txt", false, false, false, nil);



--the starting date of install (Start Julian)
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\741993\\Data", "sj", encoded, REG_SZ);
--The date that will be updated every time the program is used (Update Julian)
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\741993\\Data", "cj", encoded, REG_SZ);


----------On preload SHOW PAGE-----------
--checks to see if the registration was ever done
if Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "Software\\741993\\Data") then

todays_date = String.ToNumber(System.GetDate(DATE_FMT_JULIAN));
Crypto.Base64DecodeFromString(Registry.GetValue(HK EY_LOCAL_MACHINE, "Software\\741993\\Data", "cj", false), _TempFolder.."741993.tmp");
current_cj = String.ToNumber(TextFile.ReadToString(_TempFolder. ."741993.tmp"));
File.Delete(_TempFolder.."741993.tmp",false, true,false,nil);
if (todays_date < current_cj) then
--System clock has been turned back before the initial install date
result = Dialog.Message("ERROR", "There has been an error with your systems clock. This program will now exit.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
--File.Run("AutoPlay\\Docs\\1993ICU2.dll", "", "", SW_SHOWNORMAL, true);
Application.Exit();
end
current_cj = String.ToNumber(System.GetDate(DATE_FMT_JULIAN));
TextFile.WriteFromString(_TempFolder.."741993.tmp", current_cj , false);
encdate = Crypto.Base64EncodeToString(_TempFolder.."741993.tmp", 0);
File.Delete(_TempFolder.."741993.tmp",false, true,false,nil);
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\741993\\Data", "cj",encdate, REG_SZ);


Crypto.Base64DecodeFromString(Registry.GetValue(HK EY_LOCAL_MACHINE, "Software\\741993\\Data", "sj", false), _TempFolder.."741993.tmp");
start_sj = String.ToNumber(TextFile.ReadToString(_TempFolder. ."741993.tmp"));
File.Delete(_TempFolder.."741993.tmp",false, true,false,nil);

if (current_cj >= (start_sj + 365)) then
-- product has expired
result = Dialog.Message("Notice", "Your installation of this product has expired. This program will now exit.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
--File.Run("AutoPlay\\Docs\\1993ICU2.dll", "", "", SW_SHOWNORMAL, true);
Application.Exit();
end
else
if File.DoesExist(_SystemFolder .. "\\741993.log") then
encdate = Crypto.Base64EncodeToString(_SystemFolder.."\\741993.log", 0);
Registry.CreateKey(HKEY_LOCAL_MACHINE,"Software\\741993\\Data");
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\741993\\Data", "sj",encdate, REG_SZ);

TextFile.WriteFromString(_TempFolder.."741993.tmp", System.GetDate(DATE_FMT_JULIAN), false);
encdate = Crypto.Base64EncodeToString(_TempFolder.."741993.tmp", 0);
File.Delete(_TempFolder.."741993.tmp",false, true,false,nil);
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\741993\\Data", "cj",encdate, REG_SZ);
else
TextFile.WriteFromString(_SystemFolder.."\\741993.log", System.GetDate(DATE_FMT_JULIAN), false);
encdate = Crypto.Base64EncodeToString(_SystemFolder.."\\741993.log", 0);
Registry.CreateKey(HKEY_LOCAL_MACHINE,"Software\\741993\\Data");
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\741993\\Data", "sj",encdate, REG_SZ);
Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\741993\\Data", "cj",encdate, REG_SZ);
end
end

sside
06-26-2004, 04:53 AM
Hello everybody
First of all i want to thank everybody for their ideas/help. I appreciate it. Thank you.
From ideas that you gave me (system date could be modified etc) i came up also with a code (simple one) to avoid this. Although it does no changes to registry etc and need some more work could be useful.
The idea is that when the trial periode has expired and the trial page shows up to notify the user about that, it stores a file somewhere in users computer. Let we call it expire file. Everytime the user start the app (project actions - on startup) it will check for that expire file. To user will be given the possibility to insert a unlock code and if the code is right will delete the expire file and will store a validation file for wich the app will check too when it loads. The idea is that if the user changes the date (trial date < actual date) it doesn't matter because the app still will check for the expire file and when this exist will not proceed further then trial page leting user know that is time to unlock the app.
The expire file and validation file can be hidden files in win dir etc. The code need more work. Another possibility is also at the time the app expires letting user know about that, it will store that time (that moment) in a file. Everytime the app start it will check for that file (time) and if the user changes time and that time will be < then the time when app expired it will notify the user about that.
What do you think??
-------------------------------------------------------------------------
expire_date = "24/05/2004"
actual_date = System.GetDate(DATE_FMT_EUROPE);
unlock_code = "1234"
expire_file = File.DoesExist(_DesktopFolder.."\\Nieuw - Tekstdocument.txt");
validation_file = File.DoesExist(_DesktopFolder.."\\Nieuw - Tekstdocument (2).txt");

if validation_file == true then
Page.Jump("Page1");
else
if (search_file == true) or (expire_date < actual_date) then
File.Copy("AutoPlay\\Docs\\Nieuw - Tekstdocument.txt", _DesktopFolder, true, true, false, true, nil);
Page.Jump("Page2");

end
end
--------------
The idea is that if the trial has expired the user will be directed to the trial page to insert unlock code
this is the code
--------------
password_user = Input.GetText("Input2");

if password_user == unlock_code then
TextFile.WriteFromString(_DesktopFolder.."\\Nieuwe map (4)\\Nieuw - Tekstdocument.txt", password_user, false);
Page.Jump("Page1");
end
----------------------------------------------------------------------
Thanks to everybody