Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 7th July 2010, 05:58   #1
khesrow
Junior Member
 
Join Date: Jul 2010
Posts: 13
securing, encrypting or hiding of file uploaded in NSIS script

salam guyz!

i already create an NSIS script and i upload many files of my application into it, now i want to secure, encrypt or hide those files and make just single .exe output file for installing my application. i mean i just want to pack all my files but generating one .exe file.
plz help me thanks alot.
khesrow is offline   Reply With Quote
Old 7th July 2010, 09:12   #2
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
What do you mean by uploading many files into your NSIS script? The script is a text file! If you mean compressing the files into your installer then that is the default behaviour if you use File (rather than CopyFiles say).

Stu
Afrow UK is offline   Reply With Quote
Old 7th July 2010, 09:53   #3
khesrow
Junior Member
 
Join Date: Jul 2010
Posts: 13
look dear!

i have an application and it has four files, and for making that setup.exe i create an NSIS script and i embed/introduce/compress those file into the script, now when ever i am compiling the script it extract four of four files which i dont want, i just want to extract just one file (setup.exe) nothing else THANKS!!
khesrow is offline   Reply With Quote
Old 7th July 2010, 15:07   #4
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
......wtf?
MSG is offline   Reply With Quote
Old 7th July 2010, 16:07   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Yes I am still confused as well. When you build an NSIS script you only get one file (the file named with OutFile). You must be confusing something. Check out the examples in NSIS\Examples.

Stu
Afrow UK is offline   Reply With Quote
Old 7th July 2010, 17:09   #6
underline
Junior Member
 
Join Date: Apr 2009
Location: RO
Posts: 37
Seems that "khesrow" try to say that he need a way to avoid extraction of files compiled inside his Setup.exe file

As I can understand when he try to extract the content of his Setup.exe he get 4 files and he is not confortable with that so he need to avoid extraction...
underline is offline   Reply With Quote
Old 7th July 2010, 17:19   #7
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
No I don't think he means that but if he does the only proper way to do this is to rebuild NSIS.

Stu
Afrow UK is offline   Reply With Quote
Old 7th July 2010, 17:20   #8
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
If he wants the script to extract fewer files, he can put them into different sections and let the user select the section(s) to extract. He could - no, I should say - one can add logic to determine what files to extract based upon existing files, other programs, registry values, or user input.

If he wants to prevent people from extracting those 4 files with an independent utility, he will have to modify the NSIS package and recompile makensis.exe. 7-zip and other utilities can extract the files because they can process the setup.exe almost as if it were a zip file.
demiller9 is offline   Reply With Quote
Old 8th July 2010, 05:10   #9
khesrow
Junior Member
 
Join Date: Jul 2010
Posts: 13
guyz my English is not good and i apologize for that, and very very thanks for helping me.

but my application has four files and when i make that through NSIS installable application, i mean i introduce the four file to the NSIS script file due File statement, now when i compiling the script file it gives me my four of four files in a path which i dont want , i just want from it to give me just one file (setup.exe) and the other file should be not readable or should be hide.

thanks again from yours help!
khesrow is offline   Reply With Quote
Old 8th July 2010, 05:33   #10
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
I think you are mistaken. The NSIS compiler always will generate only ONE file, and that is the installer (called setup.exe if you specified that with the OutFile command). The other files you're seeing probably belong to something else.
MSG is offline   Reply With Quote
Old 8th July 2010, 06:04   #11
khesrow
Junior Member
 
Join Date: Jul 2010
Posts: 13
then please shoe me in example (use my application that has four files) thanks
khesrow is offline   Reply With Quote
Old 8th July 2010, 06:13   #12
khesrow
Junior Member
 
Join Date: Jul 2010
Posts: 13
and this is what i did:



Name "Example1"

OutFile "example1.exe"


InstallDir $PROGRAMFILES\Example1

DirText "This will install My Cool Program on your computer. Choose a directory"

;--------------------------------

; The stuff to install
Section "" ;No components page, name is not important

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File formone.exe
File myfolder\test.txt
File test.nsi

SectionEnd ; end the section

after the compiling this script it gives me all those file (formone.exe, test.txt, text.nsi) in c:\program file\Example1 folder, then where is one .exe file i cant see, now what u say
khesrow is offline   Reply With Quote
Old 8th July 2010, 06:20   #13
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Am I understanding you correctly that you only want formone.exe to be installed? And that you want to store test.txt and test.nsi inside the installer, but you don't want them to be installed? In that case, use this:

File formone.exe
goto +3
File myfolder\test.txt
File test.nsi
MSG is offline   Reply With Quote
Old 8th July 2010, 06:46   #14
khesrow
Junior Member
 
Join Date: Jul 2010
Posts: 13
ok thanks but because the other files are the resources for formone.exe so can it use its resources which are test.txt,test2.doc,... ,...
i mean that formone.exe should be able to use those file but as u said i dont want to show them in install directory.
as u said this will ignore other files so formone.exe will not reach to its resources .
thanks a lot now u got what i want (generating a single.exe file).

Last edited by khesrow; 8th July 2010 at 07:19.
khesrow is offline   Reply With Quote
Old 8th July 2010, 07:19   #15
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Aha, I see. Well, there are various things you can do. First, you can set the Hidden file attribute to those files (use the SetFileAttributes command), but then the user can still see them if he has "show hidden files" enabled in his Explorer. You can also extract the files to a directory that the user is not very likely to see, for example $LOCALAPPDATA\YourApp. But still, the user will be able to find it.

If you really want to prevent the user from reading the file, you'll need to encrypt its contents. There are many file encryption methods out there, and I don't know any of them personally. But I don't think that encryption software is very on-topic in these NSIS forums.
MSG is offline   Reply With Quote
Old 8th July 2010, 07:42   #16
khesrow
Junior Member
 
Join Date: Jul 2010
Posts: 13
ok dear but it was done by one of my friends, he made from several file on single .exe file as i explained, now i dont know where is he to ask him, but i am sure it has a solution with encrypting, well again thank you very much.
khesrow is offline   Reply With Quote
Old 8th July 2010, 09:43   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
What I would do is add the two files you want to hide as resources inside formone.exe; that is assuming you have control over the code in formone.exe.

Stu
Afrow UK is offline   Reply With Quote
Old 8th July 2010, 11:01   #18
khesrow
Junior Member
 
Join Date: Jul 2010
Posts: 13
it is imposable to hide those file within formone.ext it is just a c# compiled file,the solution is just my question's answer that there should be a way for merging file into one file.

thanks
khesrow is offline   Reply With Quote
Old 8th July 2010, 11:40   #19
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
Quote:
there should be a way for merging file into one file.
There is. Afrow UK told you: those files could be made resources and would be stored inside your c# exe.

You will have to make your c# program will find the new hidden files - you must be able to recompile it, right? If you can compile it, you can add resources to it. And you'll add the code to use those new resources.
demiller9 is offline   Reply With Quote
Old 8th July 2010, 12:09   #20
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,433
Yes, resources are added using Visual Studio. They need to be added to Properties\Resources.resx for the project and then accessed using [ProjectNamespace].Properties.Resources.[ResourceName] which will be of type byte[] for files I believe. You can load it into a MemoryStream rather than using a FileStream.

Stu
Afrow UK is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump