Script to send content of clipboard to 0x0 service

This commit is contained in:
gardouille 2020-03-10 21:30:41 +01:00
parent 66fb40fc98
commit 3709262d0c
Signed by: gardouille
GPG Key ID: E759BAA22501AF32
1 changed files with 42 additions and 0 deletions

42
send.txtto0x0.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/sh
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# This script will try to:
## Send the content of the clipboard to a remote file hosting.
## Get the url to access to this content and put it in the clipboard
## in place of the previous content.
# Vars [[[
debug="0"
## Colors [[[
c_redb='\033[1;31m'
c_magentab='\033[1;35m'
c_reset='\033[0m'
## ]]]
txt_to_send=$(xclip -out)
null_url="https://null.101010.fr"
content_url=""
# ]]]
if [ -n "${txt_to_send}" ]; then
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: xclip to send to ${null_url}: ${txt_to_send}."
## Send the text to null pointer service
content_url=$(echo "${txt_to_send}" | curl -F'file=@-;' "${null_url}")
## If content was successfully send
if [ -n "${content_url}" ]; then
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: Null pointer to see the content: ${content_url}"
### Put it on the clipboard
echo "${content_url}" | xclip -rmlastnl -selection clipboard
fi
else
[ "${debug}" -eq "0" ] && printf "${c_magentab}%-6b${c_reset}\n" "DEBUG: xclip looks empty: ${txt_to_send}."
exit 1
fi
exit 0