Skip to content

Instantly share code, notes, and snippets.

@chriselgee
Last active June 7, 2024 17:47
Show Gist options
  • Save chriselgee/f40930d86adf6b73834ef602a077558a to your computer and use it in GitHub Desktop.
Save chriselgee/f40930d86adf6b73834ef602a077558a to your computer and use it in GitHub Desktop.
Useful One-Liners
# Find a Linux executable named python3 in the /usr/ directory (finds the python3 executable)
find /usr -name python3 -exec file {} \; | grep ELF
# Loop over a set of numbers (pings 192.168.1.1 through 192.168.1.255)
for i in {1..255}; do sudo /usr/bin/ping -c1 192.168.1.$i; done
# Loop over lines in a file; write to a file (resolves hostnames to IP addresses)
while read f; do dig A $f +short; done < hosts.txt > ips.txt
# Loop over files ending in txt in your current directory (counts lines in files)
for f in *txt; do wc -l $f; done
# Collect target subdomains from certificate transparency searches, remove the wildcards, sort uniquely
curl -s 'https://crt.sh/?q=counterhack.com&output=json' | jq -r '.[].name_value' | grep -v '*' | sort -u > domains.txt
# Loop over lines in a file; write to a file
while read f; do echo "https://$f" ; echo "http://$f" ; done < domains.txt > webhosts.txt
# take screenshots of those webhosts (if they exist) and serve them locally on TCP/7171
docker run --rm -v $(pwd):/data leonjza/gowitness gowitness file -f webhosts.txt
docker run --rm -v $(pwd):/data -p7171:7171 leonjza/gowitness gowitness server --address :7171
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment