Let's say you have access to a system where there are NO core utilities (atleast no cat, ls, you know, the basic stuff), due to a REALLY restricted shell, or even rm -rf /
Do you just cry yourself to bed?
Here's some cool stuff:
Same as cat file.txt
$ while read line; do echo $line; done < file.txt
Same as grep whatever file.txt
$ while read line; do if [[ $line == *whatever* ]]; then echo $line; fi; done < file.txt
Same as wc -l file.txt
$ i=0; while read line; do i=$((i+1)); done < file.txt; echo $i
"Same" as ls /bin
$ echo /bin/*
"Same" as uname -a
$ while read line; do echo $line; done < /proc/version
Same as id
$ echo uid=$UID gid=nobody fucking cares
"Same" as ps
$ for i in /proc/*; do if [ -f $i/comm ]; then while read line; do echo $line; done < $i/comm; fi; done
Same as ldd /bin/ls
$ LD_TRACE_LOADED_OBJECTS=1 /bin/ls
And the list goes on.
What can you come up with in these non-confy situations?
[link][19 comments]