Sunday, 13 March 2016

Protecting animated E2B menus with passwords

I have found a way to password-protect menus on E2B and still have the animation playing in the background.


The DNA animation starts once the menu has been built by E2B and it then prompts you for a password with the animation still rotating on the display. A large 24-pixel high font has been used with the E2B default 800x600 background in this example.


I set up the MyE2B.cfg file for large fonts and used the 120-frame DNA animation (see DNA Animation download for the MyE2B.cfg file and animation file):

\_ISO\MyE2B.cfg

!BAT
set GMODE=800
# set 24-pixel high font
set FONTH=24
color highlight=white/black
set bdwidth=0 ;; set rstart=3 ;; set menuw=62
# topstart - heading then must start on line 3 or lower (or else spaces will overwrite top of menu)
set topstart=3 ;; set noitems=14
set /a tophelp=%topstart% + %noitems% > nul
set HBTM=2402
set CENTREHD=1
# ---- ADVANCED MENU SETTINGS ----- 
set ANIMFD3=/_ISO/DNA.ima
set P=(fd3)/DNA_orbit_animated_frame_0001.bmp
set trans=0x80 && set infinite=0x10  
set /A type=%infinite% + %trans% > nul
set delay=0x1 ;; set end=120 ;; set offx=550 ;; set offy=0
set ANIMATE=%type%=%delay%=%end%=%offx%=%offy% %P%
set trans= && set delay= && set type= && set end= && set offy= && set offx= && set P=

I then added a .mnu file to password-protect the MAINMENU:

\_ISO\MAINMENU\$$$$CONFIG\$.mnu

clear
echo
echo !BAT > (md)0x300+1
echo -e password %pwd% \|\| configfile (md)0xa000+0x50 >> (md)0x300+1
if not exist DONEPWD call (md)0x300+1
set DONEPWD=1

Because this is alphabetically enumerated before the other .mnu files, it runs before the Main menu loads. Any language and keyboard scan codes have already been set up in the MyE2B.cfg file.

You can suppress the 'Password:' prompt or the asterisks, and prompt in your own language.
It also supports MD5-encrypted passwords.

You can hide and protect the MyE2B.cfg file and the $.mnu file from prying eyes by dragging-and-dropping them onto the \_ISO\docs\E2B Utilities\Protect\Protect.cmd file. This will LZMA-compress them, set file attributes to hidden+system, and run cacls on them so that only the file's owner (the account that created the files) can access them (if the E2B drive is an NTFS drive). Note: Protect.cmd only works on files, not folders.

You can add a similar $.mnu file (but not quite the same!) to protect any menu folder ( e.g. \_ISO\ANTIVIRUS\$$$$CONFIG\$.mnu) .

You can use different passwords or use %pwd% or %menupwd% (set in MyE2B.cfg file).

If you set a menupwd value in MyE2B.cfg, and your ISO file ends in 'pwd'  (e.g. Ubuntu.isopwd or .imgPTNpwd), then the user will be prompted for the menupwd password before they can run it. If menupwd is not set, it will prompt for the E2B grub4dos password (pwd = 'easy2boot'). This does not apply to files in the \ISO\WINDOWS\xxxx folders however (they must end in .iso or .imgPTN, but there is a workaround if you want to password protect them too).

If you want to remove the animation after a successful password entry so that it is not displayed on the menu, just add the line:
splashimage --animated=0
to the end of the $.mnu file.

YaYa (a grub4dos developer) has added a feature where F2 starts or removes the animation (this may not be in the final version). If you define F2 as an E2B menu hotkey, then pressing F2 won't affect the animation, it will just run your F2 menu item.

For more details, see the Password page on the E2B website (which may change slightly before the release of v1.78!).

The most serious large-font bug in grub4dos 0.4.6a has now been fixed and I hope that I will be able to release v1.78 of E2B with animation and large font support + other tweaks soon!