Linux Shell

Add string to beginning of each line (before existing strings) and output to new file - Useful for custom password lists (see also, Crunch in Security Tools List using -- "crunch -s" to achieve similar results)

sed 's/^/InsertCharsHere/' file.txt  > new-file.txt

Find all SUID files in system

find / -perm -u=s -type f 2>/dev/null

Find all SUID binaries

find / -perm -4000 -type f -exec ls -la {} 2>/dev/null \;
find / -uid 0 -perm -4000 -type f 2>/dev/null

Search for binaries with capabilities set (similar to SUID) (1,2)

getcap -r / 2>/dev/null

Search for IPv4 address in a file

grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" filename

Find string within file(s)

grep -rnw '/path/to/somewhere/' -e 'pattern'
-r or -R is recursive,
-n is line number, and
-w stands for match the whole word.
-l (lower-case L) can be added to just give the file name of matching files.
-e is the pattern used during the search

Linux terminal control sequence commands

Look at sudo activity

Getting interactive shells after exploit

Last updated

Was this helpful?