Guest User

Untitled

a guest
Jun 10th, 2016
33
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.34 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. function createscreenconfig() {
  4. echo "Please enter your FTP credentials."
  5. read -ep "Username: " ftpuser
  6. read -ep "Password: " -s ftppass
  7. echo
  8. read -ep "Server (e.g. yourdomain.com): " ftpserver
  9. read -ep "Document root (e.g. public_html): " ftpdocroot
  10. read -ep "Share root (e.g. http://yourdomain.com/screenshots): " shareroot
  11. cat > "$scriptDir/.screenconfig" <<EOL
  12. ftpuser="$ftpuser"
  13. ftppass="$ftppass"
  14. ftpserver="$ftpserver"
  15. ftpdocroot="$ftpdocroot"
  16. shareroot="$shareroot"
  17. EOL
  18. err=-1
  19. }
  20.  
  21. clear
  22.  
  23. logo=" ____ _ ___ _____
  24. / ___| ___ _ __ ___ ___ _ __ (_) ___ / _ \ |___ /
  25. \___ \ / __| '__/ _ \/ _ \ '_ \| |/ _ \ | | | | |_ \
  26. ___) | (__| | | __/ __/ | | | | __/ | |_| | ___) |
  27. |____/ \___|_| \___|\___|_| |_|_|\___| \___(_)____/
  28.  
  29. a toolkit production
  30. "
  31.  
  32. echo "$logo"
  33.  
  34. scriptDir="$(cd "$( dirname "$0" )" && pwd)"
  35.  
  36. [[ ! -f "$scriptDir/.screenconfig" ]] && echo -e "It appears this is your first time using this tool. Be cautious in taking any\nscreenshots of sensitive information. You'll need an FTP account for this to\nwork, so if you haven't yet, go ahead and create that, then let's go ahead and\nget you set up.\n\nNote: input is stored in a file called .screenconfig in the same directory the\nscript is in.\n" && createscreenconfig
  37. . "$scriptDir/.screenconfig"
  38.  
  39. tmpDir=~/tmpscreen
  40. mkdir -p $tmpDir
  41.  
  42. shotName="$(date -u +"%Y%m%d-%H%M%S")-$RANDOM.png"
  43.  
  44. echo "Take a screenshot."
  45.  
  46. #if [[ -n $(type -P xwd) ]]; then xwd | xwdtopnm | pnmtopng > $tmpDir/$shotName; echo xwd
  47. #if [[ -n $(type -P xfce4-screenshooter) ]]; then xfce4-screenshooter -ro cat>$tmpDir/$shotName; echo xfce4
  48. #elif [[ -n $(type -P import) ]]; then import $tmpDir/$shotName; echo import
  49. #else gnome-screenshot -a; echo gnome
  50. #fi
  51.  
  52. xfce4-screenshooter -ro cat>$tmpDir/$shotName
  53. success=$?
  54.  
  55. if [[ success==0 ]]; then
  56. while [[ $uploaded != 0 ]]; do
  57. clear
  58. echo "$logo"
  59. [[ -z "$ftpuser" || -z "$ftpserver" || -z "$shareroot" || $uploaded -gt 0 ]] && createscreenconfig || uploaded=$(curl -sS -T $tmpDir/$shotName -u "$ftpuser:$ftppass" ftp://$ftpserver/$ftpdocroot; echo $?)
  60. done
  61. echo "Uploaded..."
  62. google-chrome "$shareroot/$shotName" >/dev/null
  63. echo "Opened in Chrome..."
  64. rm "$tmpDir/$shotName"
  65. else
  66. echo "No screenshot taken!"
  67. fi
Add Comment
Please, Sign In to add comment