Thursday 17 March 2016

Make a 'Guest Mode' menu

Krishna asked me how to get E2B to display either the full E2B MAIN MAINMENU, or a single Guest Menu, with only the items in it that he wanted to allow a guest user to use.

After a lot of thought, I ended up with this and it is really quite cool!

So cool, I had to make a video!


Once you make the changes, if you boot E2B normally, it enumerates all files in the MAINMENU folder as usual (or if you have FASTLOAD enabled it will use the cached menu) and then it will always load the GUEST Menu by default. The Guest Menu can also have sub-menus if you create them.

The Guest Menu (you can change the folder name and heading) can load a different background if you like (or not).

Default Guest Menu (use whatever wallpaper you like or keep the default wallpaper)


If you press F8, the same Guest menu will just reload.

However, if you know the secret key, you can get the full MAINMENU and the full menu system to be displayed!

Walkthrough

For instance, as you boot E2B, you will see a 'Loading E2B...' message for 3 seconds (the message can be easily changed or even hidden)...


If you press the secret F4 key (in this example) then the full MAIN Menu will now appear as below:


If you don't press F4 within 3 seconds, then you get the 'Guest' menu.

Once you load the Guest Menu, the wallpaper is not changed - i.e. if you load the Main Menu by pressing F4 the Guest wallpaper will remain (but that can be changed if you wish).

If you load the Guest Menu by mistake, just press F8 and then press the secret key (F4) when prompted by the 'Loading E2B' message. You can shorten the message display time to 1 second if you like.

This means any naive user who uses your E2B drive will just see the Guest Menu.

Instructions

1. First create your new menu folder - e.g. \_ISO\GUEST

2. Next, use Notepad to create a new \_ISO\MAINMENU\$$$$CONFIG\$$$$GUEST.mnu file:

set ASK=Y
### show wallpaper
call Fn.70 3
clear
echo
echo -e -n Loading E2B...
### sleep for 3 seconds to give user chance to press a key
call Fn.73 3
### get secret keypress now
call Fn.20
set /A key=%@retval% > nul
# F1=0x3b00, F2=0x3c00, F3=0x3d00= F4=3e00.. F10=4400, ESC=0x011B, PrntSrc=0x372A, Home=0x4700
### uncomment next line if you want to display the key code for whatever key you press
#pause --wait=3 Press secret key... ;; echo key=%key% && pause --wait=3
# 0x3e00 = F4 - absorb keypress using Fn.19 if we found it
if %key%==0x3e00 set ASK= && call Fn.19 
echo
### stop any previous animation from playing
if /i "%ASK%"=="Y" splashimage --animated=0
# next line is optional
if /i "%ASK%"=="Y" graphicsmode -1 800 > nul
### next line is optional
if /i "%ASK%"=="Y" splashimage /_ISO/docs/Templates/Jolene/Jolene800.bmp.gz > nul
### load MAINMENU wallpaper (optional)
if /i not "%ASK%"=="Y" splashimage /_ISO/e2b/grub/background.bmp.gz > nul
clear
### prevent Guest from loading Main menu
#if /i "%ASK%"=="Y" set NOF8B=1
### set up sub-folder name
if /i "%ASK%"=="Y" set MFOLDER=/_ISO/GUEST
#HDG is the top heading for the new menu
if /i "%ASK%"=="Y" set HDG=GUEST MENU
if /i "%ASK%"=="Y" (bd)/%grub%/SubMenu.g4b

3. Put any ISOs and other payloads you want in the new \_ISO\GUEST folder. You can have sub-folders just the same as any other of the menu folders.

4. If you have payload files in the MAINMENU folder (or any other folder) and you want to have a menu entry for them in the GUEST folder, just create a .mnu file for each one using QRUN.g4b to run them (any file except Windows Installer files should work), e.g.

\_ISO\GUEST\kali.mnu
iftitle [if exist /_ISO/MAINMENU/kali-linux-1.1.0a-amd64.iso] kali-linux-1.1.0a-amd64.iso \n Run Kali
/%grub%/qrun.g4b /_ISO/MAINMENU/kali-linux-1.1.0a-amd64.iso
boot

Note: You can also force an ISO to be run without the 'E2B help tips' by using:
/%grub%/qrun.g4b force.isodefault /_ISO/MAINMENU/kali-linux-1.1.0a-amd64.iso

or simply change the file extension to .isodefault.

If you want to run a Windows Installer ISO file, you will need to copy the example .mnu files from the Sample mnu Files folder (see this page) into the \_ISO\GUEST folder and edit them.

Alternative Password Solution (v1.78+)

In this example, the user is always prompted for a password when first booted.
If the correct password is entered, we get the full menu system.
If an incorrect password is entered, we get the GUEST menu.
Once in the full menu system, pressing F8 to reload, will just reload the Main menu.
If in the Guest menu, if we press F8, we will be prompted for the password again.
If you want the user to be stuck in the Guest menu with no F8 option, uncomment the line in red.

set ASK=Y
### show wallpaper
call Fn.70 3
clear
echo
echo !BAT > (md)0x300+1
echo -e password %pwd% \&\& set ASK= >> (md)0x300+1
if not exist DONEPWD call (md)0x300+1
if exist DONEPWD set ASK=
echo
### stop any previous animation from playing
if /i "%ASK%"=="Y" splashimage --animated=0
# next line is optional
if /i "%ASK%"=="Y" graphicsmode -1 800 > nul
### next line is optional
if /i "%ASK%"=="Y" splashimage /_ISO/docs/Templates/Jolene/Jolene800.bmp.gz > nul
### load MAINMENU wallpaper (optional)
if /i not "%ASK%"=="Y" splashimage /_ISO/e2b/grub/background.bmp.gz > nul
clear
### prevent Guest from loading Main menu
#if /i "%ASK%"=="Y" set NOF8B=1
### set up sub-folder name
if /i "%ASK%"=="Y" set MFOLDER=/_ISO/GUEST
#HDG is the top heading for the new menu
if /i "%ASK%"=="Y" set HDG=GUEST MENU
if /i "%ASK%"=="Y" (bd)/%grub%/SubMenu.g4b
set DONEPWD=1

Alternative 2 - ESC + password (v1.78+)

#copy this file to \_ISO\MAINMENU\$$$$CONFIG folder
#create new \_ISO\GUEST folder
#see http://rmprepusb.blogspot.co.uk/2016/03/make-guest-mode-menu.html for more details
#user must press ESC, wait 3 seconds, then enter password to get to MAINMENU

set ASK=Y
### show wallpaper
call Fn.70 3
clear
echo
if not exist DONEPWD echo -e -n Loading E2B...
### sleep for 3 seconds to give user chance to press a key
if not exist DONEPWD call Fn.73 3
### get secret keypress now
call Fn.20
set /A key=%@retval% > nul
# F1=0x3b00, F2=0x3c00, F3=0x3d00= F4=3e00.. F10=4400, ESC=0x011B, PrntSrc=0x372A, Home=0x4700
### uncomment next line if you want to display the key code for whatever key you press
#pause --wait=3 Press secret key... ;; echo key=%key% && pause --wait=3
# 0x3e00 = F4 - absorb keypress using Fn.19 if we found it
if %key%==0x011B set key=1 && call Fn.19 
echo
echo !BAT > (md)0x300+1
if exist DONEPWD set ASK=
echo -e password %pwd% \&\& set ASK= >> (md)0x300+1
if not exist DONEPWD if "%key%"=="1" call (md)0x300+1

### stop any previous animation from playing
if /i "%ASK%"=="Y" splashimage --animated=0
# next line is optional
if /i "%ASK%"=="Y" graphicsmode -1 800 > nul
### next line is optional
if /i "%ASK%"=="Y" splashimage /_ISO/docs/Templates/Jolene/Jolene800.bmp.gz > nul
### load MAINMENU wallpaper (optional)
if /i not "%ASK%"=="Y" splashimage /_ISO/e2b/grub/background.bmp.gz > nul
clear
### prevent Guest from loading Main menu
#if /i "%ASK%"=="Y" set NOF8B=1
### set up sub-folder name
if /i "%ASK%"=="Y" set MFOLDER=/_ISO/GUEST
#HDG is the top heading for the new menu
if /i "%ASK%"=="Y" set HDG=GUEST MENU
if /i "%ASK%"=="Y" (bd)/%grub%/SubMenu.g4b
set DONEPWD=1



These .mnu files will be in the next version of 1.78o Beta (and released as v1.78), look in the \_ISO\docs\Sample mnu Files folder.

E2B Version numbering

Numbers only - e.g. 1.77 = Release of that version
Numbers+upper case letter - e.g. 1.77A = Very small change to full release version to fix small bugs that won't affect 99% of users. This sometimes happens if there was a small typo or error in the first release. If the bug was a large one, affecting more than 1% of users, I will release the new version as the next numerical version - e.g. 1.78, instead of 1.77A.
Numbers+lower case letter - e.g. 1.78n = Beta version for testing. May contain new features but also bugs! e.g. v1.77 is the released, stable version, v1.78n is the current Beta which when fully debugged and tested, will be released as v1.78.

The documentation on the E2B website is always updated to reflect any changes in the latest Beta. I use a version number in parentheses, like  'xxxxx (v1.76+)' to show that the release version of 1.76 and all later versions will have the feature xxxxx described.




No comments:

Post a Comment