Diverses

Content den ich momentan noch nicht kategorisiert habe

Search for exploits

Use searchsploit to find exploits for a particular software version

searchsploit <name>

Kopiert den Exploit automatisch ins Working Directory

searcgsploit -m <name>

Find Befehl

SUID files

find / 2>&1 -perm /4000 -user root -ls | grep -v "Permission denied"

find / --> sucht im root verzeichnis 2>&1 --> Umleitung stderr nach stdout (sonst kann man nicht nach den Permission dedied greppen -perm /4000 --> sucht nach files mit dem SUID Bit gesetzt -user root --> der owner muss root sein -ls --> gibt mehr Informationen aus grep -v --> Invertierte suche, gibt alles aus, ausser den angegebenen String

Ähnlicher Befehl, andere Syntax

find / -perm -u+s -user root -ls 2>/dev/null

Find a file

Unix

find / 2>&1 -name "*flag*" | grep -v "Permission denied"
locate filename

Windows

dir flag* /s         #ab dem Directory wo man sich befindet

find 32 Character String

Sucht das ganze filesystem ab nach einem 32 Character grossen String

find / -xdev -type f -print0 2>/dev/null | xargs -0 grep -E '^[a-z0-9]{32}$' 2>/dev/null

Extract gzippted & tar file

tar -xzvf file.tar.gz

-x : Extract a tar ball. -v : Verbose output or show progress while extracting files. -f : Specify an archive or a tarball filename. -j : Decompress and extract the contents of the compressed archive created by bzip2 program (tar.bz2 extension). -z : Decompress and extract the contents of the compressed archive created by gzip program (tar.gz extension).

Filetransfer

Erstellt einen HTTP Server auf der Maschine

python -m SimpleHTTPServer 8000

oder

python3 -m http.server 

Mit "wget" kann das File vom HTTP Server heruntergeladen werden.

List all available shells

cat /etc/shells

List system-wide crontab

less /etc/crontab #system-wide
----------------------------------------
/etc/cron.hourly/
/etc/cron.daily/
/etc/cron.weekly/
/etc/cron.monthly/

Get Ubuntu Version

lsb_release -a

Delete Spaces and New-Line in file

tr -d ' ' < /home/flag > flag-nospace

tr -d '\n' < flag-nospace > flag-nospace-noline

Mysql usage

$ mysql -u <user> -p
mysql> show databases;

mysql> show tables;

mysql> show * from <tablename>;

Cat equivalent in Windows

type FILENAME

Command Help page in Windows

help <command>

smbclient

connect

smbclient //<ip>/<user>

download

smbget -R smb://<ip>/<user>

SSH Tunneling

you <-- client

ssh -L <attacker-localhost>:<attacker-localport>:<victim-localhost>:<victim-port> <victim-user>@<victim-ip>
example:
ssh -L localhost:8888:localhost:10000 victim@10.10.10.10

Beispiel: Auf dem Client gibt es den Port 10000, welcher nicht gegen aussen geöffnet ist. Mit dem Beispiel Befehl oben kann man den Port 10000 über ssh forwarden und diesen auf der eigenen Maschine auf Port 8888 zugänglich machen. Mit der Option "-R" ginge es in die andere Richtung (you --> client)

Investigate sockets

ss -tulpn

-t --> Display TCP sockets -u --> Display UDP sockets -l --> Displays only listening sockets -p --> Shows the process using the socket -n --> Doesn't resolve service names

Get unique lines from data

Duplicate entfernen aus einem txt file. Wichtig ist, dass das file zuerst sortiert wird, weil uniq nur auf Duplicate überpfüft welche benachbart sind zueinander. Besonders sinnvoll ist es zu machen, wenn man mit einem unbekannten file bruteforcen will.

cat file | sort | uniq > file-uniq

base64

echo -n 'string' | base64

Wichtig ist der -n parameter. Dieser verhindert das der newline charakter mit encoded wird.

revert hex to ascii

$ echo 54657374696e672031203220330 | xxd -r -p
Testing 1 2 3$

-r tells it to convert hex to ascii as opposed to its normal mode of doing the opposite -p tells it to use a plain format.

DNS Zonetransfer

dig @[DNS SERVER HERE] axfr [DOMAIN NAME HERE]

Last updated