Shell Commands & Tools
find exposed ports:
netstat -lntu
ss -lntu
find process on port
lsof -nP -iTCP -sTCP:LISTEN | grep <port-number>
try to find error logs of some running process
#find PID
ps aux | grep httpd
#PID -> 1234
#then find open log files with lsof
lsof -p 1234 | grep log
apply command to several items
echo {1..4} | xargs -n1 -I{} ssh root@www{}.example.com hostname
recursive search in files
grep -r "searchterm"
# recursive search with maxdepth
find . -maxdepth 5 -type d | grep "searchterm"
OpenSSL
#generate private key
openssl genrsa -out key.pem 4096
#generate key and self-signed cert
openssl req -x509 -newkey rsa:4096 -keyout demo_ca_key.pem -out demo_ca_cert.pem -nodes -days 365
#generate key and certificate signing request
openssl req -x509 -newkey rsa:4096 -keyout demo_ca_key.pem -out demo_ca_cert.pem -nodes -days 365
#sign certificate
openssl x509 -req -in demo_csr.pem -CA demo_ca_cert.pem -CAkey demo_ca_key.pem -out demo_cert.pem -set_serial 01 -days 365
launchctl / brew bs
#If you somehow screw up starting nginx (example: port already in use)
#Then you have to manually reset launchctl
launchctl unload <whatever> # example: launchctl unload /usr/local/opt/nginx/homebrew.mxcl.nginx.plist
#Check that it isn't loaded
brew services info <service>
#If it isn't loaded, then start it
brew services start <service>
#If that didn't work, try
#brew services seem to run as the user that started them, so sudo is a separate instance of nginx
sudo brew services stop <service>
brew services start <service>
#If that didn't work, idk, check out below maybe?
#don't know if this is important: launchctl bootstrap gui/501 /usr/local/opt/nginx/homebrew.mxcl.nginx.plist
#don't know if this is important: launchctl start /Users/jeffrey.maier/Library/LaunchAgents/homebrew.mxcl.nginx.plist
APK (/jar) signatures
keytool -printcert -jarfile app-release.apk
$ANDROID_SDK/build-tools/$BUILD_TOOLS_VERSION/apksigner verify --print-certs -v $APK_FILE
No comments to display
No comments to display