Advertisement
opexxx

httpcat.sh

Jan 21st, 2015
313
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.30 KB | None | 0 0
  1.  #!/bin/sh
  2.  
  3. PORT="$1"
  4. FILE="$2"
  5. SIZE=`/usr/bin/wc -c "$FILE" | /usr/bin/awk '{print$1}'`
  6.  
  7. (
  8. /bin/cat <<EoF
  9. HTTP/1.1 200 OK
  10. Content-Type: application/octet-stream
  11. Content-Disposition: attachment; filename="$FILE"
  12. Content-Length: $SIZE
  13. Connection: close
  14. EoF
  15. /bin/cat "$FILE"
  16. ) | /bin/nc -lp $PORT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement