Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- function createscreenconfig() {
- echo "Please enter your FTP credentials."
- read -ep "Username: " ftpuser
- read -ep "Password: " -s ftppass
- echo
- read -ep "Server (e.g. yourdomain.com): " ftpserver
- read -ep "Document root (e.g. public_html): " ftpdocroot
- read -ep "Share root (e.g. http://yourdomain.com/screenshots): " shareroot
- cat > "$scriptDir/.screenconfig" <<EOL
- ftpuser="$ftpuser"
- ftppass="$ftppass"
- ftpserver="$ftpserver"
- ftpdocroot="$ftpdocroot"
- shareroot="$shareroot"
- EOL
- err=-1
- }
- clear
- logo=" ____ _ ___ _____
- / ___| ___ _ __ ___ ___ _ __ (_) ___ / _ \ |___ /
- \___ \ / __| '__/ _ \/ _ \ '_ \| |/ _ \ | | | | |_ \
- ___) | (__| | | __/ __/ | | | | __/ | |_| | ___) |
- |____/ \___|_| \___|\___|_| |_|_|\___| \___(_)____/
- a toolkit production
- "
- echo "$logo"
- scriptDir="$(cd "$( dirname "$0" )" && pwd)"
- [[ ! -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
- . "$scriptDir/.screenconfig"
- tmpDir=~/tmpscreen
- mkdir -p $tmpDir
- shotName="$(date -u +"%Y%m%d-%H%M%S")-$RANDOM.png"
- echo "Take a screenshot."
- #if [[ -n $(type -P xwd) ]]; then xwd | xwdtopnm | pnmtopng > $tmpDir/$shotName; echo xwd
- #if [[ -n $(type -P xfce4-screenshooter) ]]; then xfce4-screenshooter -ro cat>$tmpDir/$shotName; echo xfce4
- #elif [[ -n $(type -P import) ]]; then import $tmpDir/$shotName; echo import
- #else gnome-screenshot -a; echo gnome
- #fi
- xfce4-screenshooter -ro cat>$tmpDir/$shotName
- success=$?
- if [[ success==0 ]]; then
- while [[ $uploaded != 0 ]]; do
- clear
- echo "$logo"
- [[ -z "$ftpuser" || -z "$ftpserver" || -z "$shareroot" || $uploaded -gt 0 ]] && createscreenconfig || uploaded=$(curl -sS -T $tmpDir/$shotName -u "$ftpuser:$ftppass" ftp://$ftpserver/$ftpdocroot; echo $?)
- done
- echo "Uploaded..."
- google-chrome "$shareroot/$shotName" >/dev/null
- echo "Opened in Chrome..."
- rm "$tmpDir/$shotName"
- else
- echo "No screenshot taken!"
- fi
Add Comment
Please, Sign In to add comment