PDA

View Full Version : Security Layer : EFIS Method


AMSWaves
08-13-2009, 06:44 PM
I have a way to protect files from stolen by crackers or others, My Way Is EFIS (Embedding Files In Sources), with this way we can change our files in the codes and put it between codes (On Global Function or any section or use it as local!)
i create a program to parse file to Codes that usable between your codes, then in runtime you copy file on memory from codes or copy it in hard disk (i write some function for these jobs)

File Parser.exe

use this application (great GUI thanks reteset) for Parsing files to codes, How ?

in 'Table Name' Field enter your file name or a variable name no difference just you must know this name for use it on app (Note :this name follow provision of variable name (Not srart with numbers, ...))

in 'File To Parse' field you must enter addresss of file that you want parsed to codes.

in 'Save To' field you must enter addresss of file that you want parsed codes saved to it.

in the end this app create a file like below that you must include it in your app :

Test = {"8606185513116067142","2335244402573734501","7299525919160618305","8461225900329037677"}
Test.Size = 36
Test.B1=103Test.B2=105Test.B3=110Test.B4=46
Test.Bytes = 4


Codes Helper :

Codes Helper are some function that help you back your files from those codes to memory or to a file and then use it

these functions are :


FileTable2Memory(File_Table, mem)

with this func you can copy your file from those codes to memory and use it with this way your file not created on hard disk.

first parameter is table name that before you choose it in above examp my table name is 'Test'

second parameter is a memory pointer that allocated with Test.Size bytes (size is important)

return nothing

for examp see this (i create apz of examp1, see attachments)


Test ={"8606185513116067142","2335244402573734501","7299525919160618305","8461225900329037677"}
Test.Size = 36
Test.B1=103Test.B2=105Test.B3=110Test.B4=46
Test.Bytes = 4

mem = Memory.Allocate(Test.Size) -- create memory with Test.Size
FileTable2Memory(Test, mem) -- Copy file from code to memory
Dialog.Message("", Memory.GetString(mem, -1, Ascii)) -- Print File bolt from memory
Memory.Free(mem) -- Kill memory of file




Memory2File(Mem, File_Name)

with this func you can create your file from memory (that created from those codes) on your hard disk and then use it.

first parameter is memory pointer (that created from those codes)

second parameter is the filename on your hard disk, if you set it ':temp:' function generate a file random in your temp then return address of it.

return name of file if you set second parameter ':temp:'.


for examp see this (i create apz of examp2, see attachments)


Test ={"8606185513116067142","2335244402573734501","7299525919160618305","8461225900329037677"}
Test.Size = 36
Test.B1=103Test.B2=105Test.B3=110Test.B4=46
Test.Bytes = 4

mem = Memory.Allocate(Test.Size) -- create memory with Test.Size
FileTable2Memory(Test, mem) -- Copy file from code to memory
filename = Memory2File(mem, ":temp:") -- create file from memory to hard disk
Dialog.Message("", TextFile.ReadToString(filename)) -- Print File from hard disk
File.Delete(filename, false, false, false, nil) -- Delete File
Memory.Free(mem) -- Kill memory of file




FileTable2File(File_Table, File_Name)

with this func you can create your file bolt from codes to file on hard disk and then use it.

first parameter is table name that before you choose it in above examp my table name is 'Test'

second parameter is the filename on your hard disk, if you set it ':temp:' function generate a file random in your temp then return address of it.

return name of file if you set second parameter ':temp:'.


for examp see this (i create apz of examp3, see attachments)


Test ={"8606185513116067142","2335244402573734501","7299525919160618305","8461225900329037677"}
Test.Size = 36
Test.B1=103Test.B2=105Test.B3=110Test.B4=46
Test.Bytes = 4

filename = FileTable2File(Test, ":temp:") -- create file bolt from codes to hard disk
Dialog.Message("", TextFile.ReadToString(filename)) -- Print File from hard disk
File.Delete(filename, false, false, false, nil) -- Delete File
Memory.Free(mem) -- Kill memory of file



with this method (EFIS) you can increase your security of files and program and prevent from stealing your files, this is a new layer.

with this your program is portable you can send one page codes to your friends that include many files or you can post your codes that include files.

I work on it for improve it and any help and info is familiar.
please post any bug, any question, any suggestion or anything you know.

this Method use Memory Plugin (http://indigorose.com/forums/showthread.php?t=27527) This is important every time use the latest Version of Memory plugin (http://indigorose.com/forums/showthread.php?t=27527).

i very work on it your reply create me happy.
Enjoy:)
beforehand thanks for your replys.
AMSWaves.

Imagine Programming
08-13-2009, 07:32 PM
Very nice method,

I had something just like this called LuaInclude (including files in lua)
but I discontinued this because including files to the plugins compiled in the AMS Action Plugin Compiler is now possible too.

I'm loving this, a nice extra piece of safety!

mystica
08-13-2009, 09:11 PM
Now this looks interesting ... downloading and installing now. Am keen to have a look at the potential of this. Great idea.

Centauri Soldier
08-14-2009, 12:12 AM
I had a chance to peruse your code. Very nice idea. This will come in handy as an additional security layer for sure.
It would be even cooler if you could include the code for file to table parsing as code instead of just a program so we could parse multiple files at once (or does it already do that and I missed it?).

Thanks for sharing.

Centauri Soldier
08-14-2009, 12:55 AM
I got an idea...why not just include all of these new functions for the security layer directly in your memory plugin? Now that would be convenient. :D

Also, the file parser program is only returning the Size and not the Bytes or the other info about the file (which causes errors in the helper code).

AMSWaves
08-14-2009, 04:31 AM
Very nice method,

I had something just like this called LuaInclude (including files in lua)
but I discontinued this because including files to the plugins compiled in the AMS Action Plugin Compiler is now possible too.

I'm loving this, a nice extra piece of safety!

thanks Imagine Programming,
i never see that (LuaInclude) but anyway i think this is a good way for files.

AMSWaves
08-14-2009, 04:41 AM
thanks mystica and Centauri Soldier,

It would be even cooler if you could include the code for file to table parsing as code instead of just a program so we could parse multiple files at once (or does it already do that and I missed it?).


your right i must add Multiply files to program but codes for parsing file, i think is better stay surreptitious for now, but if you want create a multiply file parser use FileParser.dll in the root of program and use it like this :

Application.LoadActionPlugin("FileParser.dll");
err = FileParser.DoJob(Source File Name, Output File Name, Table Name)
if err == 1 then
-- Job Done Successfully
elseif err == -1 then
-- Error in create file
elseif err == 0 then
-- Error in open file
end


I got an idea...why not just include all of these new functions for the security layer directly in your memory plugin? Now that would be convenient.


no i think this is better codes stay Open for all developer so all body can help me to improve this Method, but any way you can create a plugin for yourself or share it, but i recommended these Codes stay open and all advanced programmer can change it.

Also, the file parser program is only returning the Size and not the Bytes or the other info about the file (which causes errors in the helper code).


no file parser change your files to code to table that include size of file size of extra bytes and core of files, not just Size of files.
you get error on helper codes ? where line on what size of file please post if you get error.

Imagine Programming
08-14-2009, 07:25 AM
thanks Imagine Programming,
i never see that (LuaInclude) but anyway i think this is a good way for files.

Yeah because I discontinued it, this is safer. What I do is basicly include the files in a luafile and compile the luafile (The files are encrypted in lua). But I could write a plugin that is required for the decompiling though.

See attached

Centauri Soldier
08-14-2009, 02:22 PM
The error occurs because the file parser is not including the additional file info.

In your example2 the lines after the table are...
image.Size = 24455
image.B1=127image.B2=221image.B3=124image.B4=241im age.B5=87image.B6=255image.B7=217
image.Bytes = 7

In the output file made by the file parser, the lines after the table are...
image.Size = 145674

See how I'm missing the info about bytes and the other bit as well. If I plug code(the two missing lines of code that is) from your example into my project then it works but shouldn't those lines have been put in by the file parser?

Thanks for the parsing code by the way. That will open few more doors with this tool.:yes

AMSWaves
08-15-2009, 07:48 AM
The error occurs because the file parser is not including the additional file info.

In your example2 the lines after the table are...
image.Size = 24455
image.B1=127image.B2=221image.B3=124image.B4=241im age.B5=87image.B6=255image.B7=217
image.Bytes = 7

In the output file made by the file parser, the lines after the table are...
image.Size = 145674

See how I'm missing the info about bytes and the other bit as well. If I plug code(the two missing lines of code that is) from your example into my project then it works but shouldn't those lines have been put in by the file parser?



thanks, yea you are right this is a bug for files that have size with coefficient of 8 but your file size (145674) have two additional bytes if your file size is 145672 this bug comes.

one line in Codes Helper.lua is wrong (line 23) i change it and reupload it (see attachment).

in line 23 :
if File_Table.Bytes then
that must be
if File_Table.Bytes > 0 then

and new File Parser(1.1.0.0) now support multiple files and lua compiler for compile lua files. (See attachment)

(Every Time you can download latest File Parser and Codes Helper from this Thread and from My Site (http://www.amswaves.com/download/EFIS/))

Re test your file with these new files and again report sequel.

Thanks for report and reply.