Restricted privileges command line 04-05-2016, 01:35 PM
#1
So, as usual, I'm finding ways to piss of my school's administrative staff. I found that even though they've blocked command line usage, it's possible to get said usage back by using batch files.
main code:
For defining your userpath, just delimit entries with a semicolon in a path.txt file in your config directory, leaving the last entry without a semicolon at the end
For example:
Finally, for user variables, do the same as you did with the path in a file called vars.txt, but in the following format:
Example:
Note: this is still pretty buggy, and I hate messing with batch, since error tracebacks are non-existent, so if anyone finds bug fixes, lmk
main code:
Code:
@echo off&setlocal
:: set path to user defined path
set cfgpath=C:\Users\Kagetane\Desktop\Code\~projects\cmd\config
:setup
:: collects userpath and sets to temporary variable
set /p usrp=<%cfgpath%\path.txt
:: loop to get user variables
set /p t=<%cfgpath%\vars.txt
:defloop
for /f "tokens=1* delims=;" %%a in ("%t%") do (
if defined ttl (
if defined host (
if defined root (
set user=%%a
) else set root=%%a
) else set host=%%a
) else set ttl=%%a
set t=%%b
)
if defined t goto defloop
path=%path%;%usrp% :: adds user's path to session path
cd %root% :: goes to defined root directory
:: main program loop
:loop
title %ttl% - %cd%
echo %cd% %user%@%host%~
set /p cmd=$
%cmd%
goto loopFor defining your userpath, just delimit entries with a semicolon in a path.txt file in your config directory, leaving the last entry without a semicolon at the end
For example:
Code:
H:\Programming\Source\Ruby22;H:\Programming\Source\Git;H:\Programming\Source\nodejs;H:\Programming\Source\Python;H:\Programming\Source\Python\ScriptsFinally, for user variables, do the same as you did with the path in a file called vars.txt, but in the following format:
Code:
title;hostname;root directory;userExample:
Code:
:: this config
command "console";no-access-to-anything;H:/Programming/Files;inori
:: produces this
H:/Programming/Files inori@no-access-to-anythings~
$Note: this is still pretty buggy, and I hate messing with batch, since error tracebacks are non-existent, so if anyone finds bug fixes, lmk
It's often the outcasts, the iconoclasts ... those who have the least to lose because they
don't have much in the first place, who feel the new currents and ride them the farthest.
don't have much in the first place, who feel the new currents and ride them the farthest.















![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)