From Obese Moth, 3 Weeks ago, written in Plain Text.
  1. #!/bin/bash
  2.  
  3. # Fuck coinbots. Everthing is broken. Internet is shit.
  4. # Since there are no sane pastebins that accept anything but text,
  5. # The only reasonable method is base64 like its 1992.
  6.  
  7. # This script b̶a̶s̶e̶6̶4̶base32 encodes an input file, and outputs a shell script that
  8. # When run decodes and overwrites itself with the decoded data.
  9. # Everyone uses a different paste script, so data is written to stdout, and is
  10. # Meant to be piped to a paste utility.
  11.  
  12. # If you want file/mimetype support, place the following 4 indented lines
  13. # (minus leading # and whitespace) in a file named `~/.magic`.
  14. #   # Misc Net B32 - binary data base64 encoded (B is R, modern acronyms)
  15. #   0 string #!/bin/sh
  16. #   >11 lequad 0x343607524e4d1616 MNR (Misc Net B32) - POSIX Shell Base64 Exec Transport Format
  17. #   !:mime data/x-mnr32
  18. # You can also run `file -C -m ./.magic` to compile to binary format.
  19. # See file(1) and magic(5) for more info.
  20.  
  21. # As far as usable and decent sites. The list is forlornedly short...
  22. # 1.0) Bpaste is nice, the script is:
  23. #        #!/bin/sh
  24. #        test -t 0 && c="`cat "$1"`" || c="`cat <&0`"
  25. #        curl -s -L --d "expiry=1day&lexer=text" --data-urlencode "code=$c" https://bpaste.net/ \
  26. #          | grep "View <a href=" \
  27. #          | cut -d'"' -f2 \
  28. #          | while read -r url; do
  29. #              printf -- "https://bpaste.net%s" "$url"
  30. #            done
  31. # 1.1) Or a short form:
  32. #        curl -s -L -d  "code=`cat ./x`&expiry=1day&lexer=text" https://bpaste.net/
  33. #
  34. # 2.0) The ##linux community on freenode operates https://paste.linux.community,
  35. #      The script is:
  36. #        #!/bin/sh
  37. #        test -t 0 && c="`cat "$1"`" || c="`cat <&0`"
  38. #        curl -s -d "expiry=30" --data-urlencode "text=$c" https://paste.linux.community/api/create \
  39. #          | cut -d/ -f5 \
  40. #          | while read -r id; do
  41. #              printf -- "https://paste.linux.community/view/raw/%s" "$id"
  42. #            done
  43. # 3.0) Debian pastebin. Yay XMLRPC
  44. #      The script is:
  45. #        TODO: Write script
  46.  
  47.  
  48. declare -a head vec
  49. mapfile  head < <(cat <<EOF
  50. #!/bin/sh
  51. `printf -- "%s\n" $'\x23\x16\x01MNR\x0732 A small script to base32decode file contents. Run \`chmod 700 x; x\`'`
  52. `printf -- "%s\n" $'tmp=\x22./\$\$-\`date \$\x27\\\\x2b\x27%s\`.tmp\x22'`
  53. `printf -- "%s\n" $'tail -n\$\x27\\\\x2b\x276 <\x22\$0\x22 | base32 -d > \x22\$tmp\x22'`
  54. `printf -- "%s" $'mv \x22\$tmp\x22 \x22\$0\x22; exit'`
  55. EOF
  56. )
  57.  
  58.  
  59. #[[ -t 0 ]] && mapfile -t vec < <(basenc --base64url <"$1") || mapfile -t vec < <(basenc --base64url <&0)
  60. [[ -t 0 ]] && mapfile -t vec < <(base32 <"$1") || mapfile -t vec < <(base32 <&0)
  61.  
  62. printf -- "%s%s" "${head[@]}" "${vec[@]}" # | curl -F
  63.  
captcha