| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | # Starting the script with "#!/bin/bash -r" |
| 4 | #+ runs entire script in restricted mode. |
| 5 | |
| 6 | echoscip-shell system . . echo. |
| 7 | |
| 8 | echoscip-shell system . . echo. "Changing directory." |
| 9 | cd /usr/localscip-shell filesystem . . `/usr/local`. |
| 10 | echoscip-shell system . . echo. "Now in `pwdscip-shell system . . pwd.`" |
| 11 | echoscip-shell system . . echo. "Coming back home." |
| 12 | cd |
| 13 | echoscip-shell system . . echo. "Now in `pwdscip-shell system . . pwd.`" |
| 14 | echoscip-shell system . . echo. |
| 15 | |
| 16 | # Everything up to here in normal, unrestricted mode. |
| 17 | |
| 18 | set -r |
| 19 | # set --restricted has same effect. |
| 20 | echoscip-shell system . . echo. "==> Now in restricted mode. <==" |
| 21 | |
| 22 | echoscip-shell system . . echo. |
| 23 | echoscip-shell system . . echo. |
| 24 | |
| 25 | echoscip-shell system . . echo. "Attempting directory change in restricted mode." |
| 26 | cd .. |
| 27 | echoscip-shell system . . echo. "Still in `pwdscip-shell system . . pwd.`" |
| 28 | |
| 29 | echoscip-shell system . . echo. |
| 30 | echoscip-shell system . . echo. |
| 31 | |
| 32 | echoscip-shell system . . echo. "\$SHELL = $SHELL" |
| 33 | echoscip-shell system . . echo. "Attempting to change shell in restricted mode." |
| 34 | SHELL="/bin/ashscip-shell filesystem . . `/bin/ash`." |
| 35 | echoscip-shell system . . echo. |
| 36 | echoscip-shell system . . echo. "\$SHELL= $SHELL" |
| 37 | |
| 38 | echoscip-shell system . . echo. |
| 39 | echoscip-shell system . . echo. |
| 40 | |
| 41 | echoscip-shell system . . echo. "Attempting to redirect output in restricted mode." |
| 42 | lsscip-shell system . . ls. -l /usr/binscip-shell filesystem . . `/usr/bin`. > bin.files |
| 43 | lsscip-shell system . . ls. -l bin.files # Try to list attempted file creation effort. |
| 44 | |
| 45 | echoscip-shell system . . echo. |
| 46 | |
| 47 | exit 0 |