src: https://www.stationx.net/nmap-cheat-sheet
| Switch | Example | Description |
import requests | |
import pathlib | |
with open("files.txt","r") as f: | |
urls = [ url.rstrip() for url in f.readlines()] | |
files_to_download = [] |
curl ifconfig.me |
# Run the last command as root | |
sudo !! | |
# Serve current directory tree at http://$HOSTNAME:8000/ | |
python -m SimpleHTTPServer | |
# Save a file you edited in vim without the needed permissions | |
:w !sudo tee % | |
# change to the previous working directory | |
cd - | |
# Runs previous command but replacing | |
^foo^bar |
.php | |
.html | |
.txt | |
.htm | |
.aspx | |
.asp | |
.js | |
.css | |
.pgsql.txt | |
.mysql.txt |
# add filenames to a file | |
$ while read -r line ;do find / -type f -name $line -ls 2>/dev/null ; done < ./filenames.txt | |
#ip address | |
$ while read -r line ;do find / -type f -name $line -exec grep -l -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}" {} \; 2>/dev/null ; done < ./filenames.txt | |
#sha1sum | |
$ while read -r line ;do find / -type f -name $line -exec sh -c "ls -l {} ;cat {} | sha1sum" \; 2>/dev/null ; done < ./filenames.txt |
#save encode.txt in a file | |
import base64 | |
s = open("encode.txt","r") | |
s = s.read() # read as strings check type(s) | |
for i in range(5): | |
s = base64.b16decode(s) | |
src: https://www.stationx.net/nmap-cheat-sheet
| Switch | Example | Description |
USE this | |
https://github.com/aws/aws-cli/issues/1079#issuecomment-541997810 | |
Hello Folks! aws | |
I installed aws cli from pip3 --user | |
I couldn't find Completion for Fish shell in aws cli web page |
import socket,re | |
with socket.socket(socket.AF_INET,socket.SOCK_STREAM) as s: | |
s.connect((host,dport)) | |
while( i < 500): | |
res = str(s.recv(1024).decode()) | |
print(res) | |
try: | |
item = re.findall('\d+ \+ \d+',res)[0] | |
buf = str(eval(item))+ '\r\n' |
# -*- encoding: utf-8 -*- | |
# requires a recent enough python with idna support in socket | |
# pyopenssl, cryptography and idna | |
from OpenSSL import SSL | |
from cryptography import x509 | |
from cryptography.x509.oid import NameOID | |
import idna | |
from socket import socket |