Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Password on exe or file


  • Please log in to reply
1 reply to this topic
Xatmo97
  • Members
  • 39 posts
  • Last active: May 25 2015 08:10 AM
  • Joined: 11 Dec 2008
Heres a small script i made cupple months back. It just takes the file or exe and compiles it with a password. its not very clean but it works. if anyone has a better way i would be thankful lol.

#NoTrayIcon
Gui, Add, Edit, vFile1 x16 y47 w130 h20 , 
Gui, Add, GroupBox, x6 y7 w150 h120 , Exe/File Password Injection
Gui, Add, Edit, vPassy x16 y67 w130 h20 , Password
Gui, Add, Button, x16 y27 w130 h20 , Broswe
Gui, Add, Button, x16 y87 w130 h30 , Protect
Gui, Add, Text, x46 y127 w410 h200 , By Grimfate
Gui, Show, w164 h139, Grim Protect
return

%::
MsgBox, Cant use `% signs in the password
return

ButtonBroswe:
FileSelectFile, InpFile,
GuiControl,, File1, %inpFile%
Return

ButtonProtect:
If InpFile =
{
ExitApp
}
else
{

FileCopy, %InpFile%, C:\, 1
SplitPath, InpFile, Path
GuiControlGet, pass,, Passy
FileAppend,
(
#NoTrayIcon
InputBox, password, Enter Password, This file is protected., hide 
if password = %pass%  
{ 
Fileinstall, %Path%, %Path%, 1
ExitApp
}
else 
    MsgBox, Password Incorrect!
Exitapp
Return
), C:\enc.ahk
Fileinstall, Ahk2Exe.exe, C:\Ahk2Exe.exe, 1
Fileinstall, AutoHotkeySC.bin, C:\AutoHotkeySC.bin, 1
InputBox, Name, Output, name of the file? exclude the .exe at the end.
Run %comspec% /c Ahk2Exe.exe /in "C:\enc.ahk" /out "%A_WorkingDir%\%Name%.exe" /bin "C:\AutoHotkeySC.bin",, Hide
Msgbox, Done!
FileDelete, C:\Ahk2Exe.exe
FileDelete, C:\AutoHotkeySC.bin
FileDelete, C:\enc.ahk
FileDelete, C:\%Path%

}
Return

GuiClose:
ExitApp

Make sure the ahk2exe and authhotkeysc.bin are in the dir as the source when you compile it

Sjc1000
  • Members
  • 572 posts
  • Last active: Mar 11 2017 11:41 AM
  • Joined: 06 Feb 2012
Cool little script you have here.

There is only thing i can add is the %:: label. This will completely remove the functionality for % while the script is active. Im sure this is intended but you can just have something like.

ButtonProtect:
If passy contains `%
{
     MsgBox, `% are not allowed
     Return
}
If InpFile =
{
etc..

Just so you don't remove the % button while the script is active.

Sjc1000 - Insert inspirational quote here!

PLEASE find me on the IRC if you have questions. I'm never on the forum anymore.