lazyhacker 9 months ago

find command CheatSheet

Basic Examples:

# Search for files or directories with the exact name "example.txt" in the current directory (and its subdirectories).

find . -name "example.txt"   

# Find all directories in the "/home" directory.     

find /home -type d 

# Search for files owned by the user "john" in the "/data" directory.           

find /data -user john  

# Find all files with the extension ".txt" in the current directory and download them using `curl`.          

find . -type f -name "*.txt" -exec curl -O {} \; 

Intermediate Examples:

# Extract specific content from a webpage using `curl` and `sed`.

curl https://example.com/page.html | sed -n 's/<p>\(.*\)<\/p>/\1/p'  

# Find all directories in the "/home" directory and count the number of files in each using `find` and `wc`.

find /home -type d -exec sh -c 'echo -n "{}: "; find "{}" -type f | wc -l' \; 

# Find all files modified in the last 7 days and perform an HTTP POST request with their content using `find`, `curl`, and `xargs`.

find . -type f -mtime -7 -print0 | xargs -0 -I{} curl -X POST -d @{} https://api.example.com/upload 

# Search for files with the extension ".log" in the "/var/logs" directory, compress them, and store in a backup folder using `find`, `curl`, and `tar`.

find /var/logs -type f -name "*.log" -exec tar czvf /backup/logs_backup.tar.gz {} \;  

Advanced Examples:

# Find all files in the current directory larger than 10MB and delete them using `find` and `rm`.

find . -type f -size +10M -exec rm {} \; 


0
661
A very comprehensive penetration testing memo: including tools, techniques and techniques [worth collecting]

A very comprehensive penetration testing memo: including tools, techni...

defaultuser.png
lazyhacker
7 months ago
Installing Kali Linux on Android without Root

Installing Kali Linux on Android without Root

defaultuser.png
Admin
2 months ago

White box testing

https://lh3.googleusercontent.com/a/ACg8ocIkM8EGIx0gz9GUP_nM6_sMxivr6876Wp0e9MAp6mGc=s96-c
xone
2 weeks ago
Awkward HTB Writeup | HacktheBox

Awkward HTB Writeup | HacktheBox

https://lh3.googleusercontent.com/a/ACg8ocIkM8EGIx0gz9GUP_nM6_sMxivr6876Wp0e9MAp6mGc=s96-c
xone
1 month ago
Curl Command Cheat Sheet for Penetration Testing

Curl Command Cheat Sheet for Penetration Testing

defaultuser.png
lazyhacker
9 months ago