Update stabilize shell.md

This commit is contained in:
AbdullahRizwan101 2020-09-11 01:03:04 +05:00 committed by GitHub
parent 0a18888d4e
commit e7d568d1bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,43 +1,36 @@
---------------------------------
CTF
---------------------------------
# Stablilize Shell
1) ctrl+z
2) stty raw -echo
3) fg (press enter x2)
4) export TERM=xterm
1. ctrl+z
2. stty raw -echo
3. fg (press enter x2)
4. export TERM=xterm , for using `clear` command
# Spawn bash
1) /usr/bin/script -qc /bin/bash 1&>/dev/null
2) python -c 'import pty;pty.spawn("/bin/bash")'
3) python3 -c 'import pty;pty.spawn("/bin/bash")'
* /usr/bin/script -qc /bin/bash 1&>/dev/null
* python -c 'import pty;pty.spawn("/bin/bash")'
* python3 -c 'import pty;pty.spawn("/bin/bash")'
# Finding Binaries
1) find . - perm /4000 (user id uid)
2) find . -perm /2000 (group id guid)
----------------------------------
KoTH
----------------------------------
* find . - perm /4000 (user id uid)
* find . -perm /2000 (group id guid)
strace - debugging / tamper with processes
gbd - c/c++ debugger
script - records terminal activites
# King Of The Hill (KoTH)
w /who (check current pts ,terminal device)
ps -t ps/pts<number> (process monitoring)
script /dev/pts/<number>
* strace `debugging / tamper with processes`
* gbd `c/c++ debugger`
* script - records terminal activites
* w /who `check current pts ,terminal device`
* ps -t ps/pts<number> `process monitoring`
* script /dev/pts/<number> `montior terminal`
* cat /dev/urandom > /dev/pts/<number> 2>/dev/null `prints arbitary text on terminal`
cat /dev/urandom > /dev/pts/number
# Closing other shell
# Closing Shells/Sessions
pkill -9 -t pts/number
# Changing file attributes
chattr + i <filename> (making file immutable)
chattr -i <filename> (making file mutable)
lschattr <filename>
chattr + i <filename> `making file immutable`
chattr -i <filename> `making file mutable`
lschattr <filename> `Checking file attributes`