Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - hakerdefo

Pages: [1] 2 3 ... 32
1
Bacon Kills!   ::)  I'm sure that bacon is what caused both my heart attacks!   ???

ROFL  :D  :D  :D

2
Okay here is something for those of you who hates internet ads and at the same time are not big fans of add-ons and  extensions.
This is a complete rewrite of one of my earlier ad-block script.

Save pmiab somewhere in your $PATH with 755 permission and run it with sudo permissions.

Code: [Select]
sudo pmiab

And select following from the menu,
Code: [Select]
Block Internet Adverts

You can easily disable ad-blocking (also read replace the original hosts) by selecting,
Code: [Select]
Unblock Internet Adverts

If a browser is open then clear its cache and restart it. Enjoy the internet on any and every browser without those irritating ads  8)

Code: [Select]
#!/usr/bin/env bash
########
function byye (){
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "One man's advertising is another man's malware"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  tput sgr0
  printf "\033c"
  exit 0
}
########
function pm_unblock (){
  pmcp=$(which cp)
  pmrm=$(which rm)
  if [ ! -f /etc/hosts-block ]; then
    printf "\033c"
    echo ""
    { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
    echo ""
    echo -e '\e[38;5;82m' "Ad-blocking hosts not in use! Nothing to unblock!"
    echo ""
    { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
    echo ""
    echo ""
    read -r -s -p $'Press Any Key To Return To Main Menu...\n' -n1
    starrt
  fi
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Replacing the original hosts file..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  "$pmcp" /etc/hosts-system /etc/hosts
  chmod 644 /etc/hosts
  "$pmrm" -f /etc/hosts-system
  "$pmrm" -f /etc/hosts-block
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "All done!!! Original system hosts file restored!!!"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo ""
  read -r -s -p $'Press Any Key To Return To Main Menu...\n' -n1
  starrt
}
########
function pm_block (){
  pmcp=$(which cp)
  hosts_cooking=$(mktemp)
  hosts_cooked=$(mktemp)
  datum=$(date +%d-%m-%Y:%H:%M:%S)
  pmrm=$(which rm)
  if [ ! -f /etc/hosts-system ]; then
    "$pmcp" /etc/hosts /etc/hosts-system
    chmod 444 /etc/hosts-system
  fi
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Downloading ad-blocking hosts files..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  wget -nv -O - "http://winhelp2002.mvps.org/hosts.txt" >> "$hosts_cooking" || { "$pmrm" -f "$hosts_cooking"; "$pmrm" -f "$hosts_cooked"; printf "\033c"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; echo -e '\e[38;5;82m' "OOPS!! Failed to download \"mvps\" hosts file!!"; echo -e '\e[38;5;82m' "Make sure your internet connection is active!"; echo -e '\e[38;5;82m' "If the problem persists you can report it at,"; echo -e '\e[38;5;82m' "GitHub repository of the project by creating,"; echo -e '\e[38;5;82m' "an issue there. Here is the link to the repo,"; echo ""; echo -e '\e[38;5;82m' "https://github.com/hakerdefo/pmiab"; echo ""; echo -e '\e[38;5;82m' "If you don't use GitHub you can report it by,"; echo -e '\e[38;5;82m' "emailing the author at the following address,"; echo ""; echo -e '\e[38;5;82m' "hakerdefo (at) gmail (dot) com"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; tput sgr0; exit 1; }
  wget -nv -O - "http://hosts-file.net/ad_servers.asp" >> "$hosts_cooking" || { "$pmrm" -f "$hosts_cooking"; "$pmrm" -f "$hosts_cooked"; printf "\033c"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; echo -e '\e[38;5;82m' "OOPS!! Failed to download \"hpHo\" hosts file!!"; echo -e '\e[38;5;82m' "Make sure your internet connection is active!"; echo -e '\e[38;5;82m' "If the problem persists you can report it at,"; echo -e '\e[38;5;82m' "GitHub repository of the project by creating,"; echo -e '\e[38;5;82m' "an issue there. Here is the link to the repo,"; echo ""; echo -e '\e[38;5;82m' "https://github.com/hakerdefo/pmiab"; echo ""; echo -e '\e[38;5;82m' "If you don't use GitHub you can report it by,"; echo -e '\e[38;5;82m' "emailing the author at the following address,"; echo ""; echo -e '\e[38;5;82m' "hakerdefo (at) gmail (dot) com"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; tput sgr0; exit 1; }
  wget -nv -O - "http://someonewhocares.org/hosts/hosts" >> "$hosts_cooking" || { "$pmrm" -f "$hosts_cooking"; "$pmrm" -f "$hosts_cooked"; printf "\033c"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; echo -e '\e[38;5;82m' "OOPS!! Failed to download \"sowc\" hosts file!!"; echo -e '\e[38;5;82m' "Make sure your internet connection is active!"; echo -e '\e[38;5;82m' "If the problem persists you can report it at,"; echo -e '\e[38;5;82m' "GitHub repository of the project by creating,"; echo -e '\e[38;5;82m' "an issue there. Here is the link to the repo,"; echo ""; echo -e '\e[38;5;82m' "https://github.com/hakerdefo/pmiab"; echo ""; echo -e '\e[38;5;82m' "If you don't use GitHub you can report it by,"; echo -e '\e[38;5;82m' "emailing the author at the following address,"; echo ""; echo -e '\e[38;5;82m' "hakerdefo (at) gmail (dot) com"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; tput sgr0; exit 1; }
  wget -nv -O - "http://pgl.yoyo.org/adservers/serverlist.php?hostformat=hosts&showintro=0&mimetype=plaintext" >> "$hosts_cooking" || { "$pmrm" -f "$hosts_cooking"; "$pmrm" -f "$hosts_cooked"; printf "\033c"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; echo -e '\e[38;5;82m' "OOPS!! Failed to download \"yoyo\" hosts file!!"; echo -e '\e[38;5;82m' "Make sure your internet connection is active!"; echo -e '\e[38;5;82m' "If the problem persists you can report it at,"; echo -e '\e[38;5;82m' "GitHub repository of the project by creating,"; echo -e '\e[38;5;82m' "an issue there. Here is the link to the repo,"; echo ""; echo -e '\e[38;5;82m' "https://github.com/hakerdefo/pmiab"; echo ""; echo -e '\e[38;5;82m' "If you don't use GitHub you can report it by,"; echo -e '\e[38;5;82m' "emailing the author at the following address,"; echo ""; echo -e '\e[38;5;82m' "hakerdefo (at) gmail (dot) com"; echo ""; for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; echo ""; tput sgr0; exit 1; }
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Parsing, Cleaning, De-Duplicating, Sorting..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  sed -e 's/\r//' -e '/^127.0.0.1/!d' -e '/localhost/d' -e 's/127.0.0.1/0.0.0.0/' -e 's/ \+/\t/' -e 's/#.*$//' -e 's/[ \t]*$//' < "$hosts_cooking" | sort -u > "$hosts_cooked"
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Merging ad-blocking hosts with original system hosts..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  echo -e "\n# Ad blocking list generated on $datum" | cat /etc/hosts-system - "$hosts_cooked" > /etc/hosts-block
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Doing some clean-up..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  "$pmrm" -f "$hosts_cooking"
  "$pmrm" -f "$hosts_cooked"
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "Installing pmiab generated hosts file..."
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  sleep 1
  "$pmcp" /etc/hosts-block /etc/hosts
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "All done!!! Enjoy the internet without those pesky adverts!!!"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo ""
  read -r -s -p $'Press Any Key To Return To Main Menu\n' -n1
  starrt
}
########
function pm_netchk (){
  wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "www.google.com" -O /dev/null
  RETVAL=$?
  case "$RETVAL" in
    0)
      pm_block
      ;;
    *)
      printf "\033c"
      echo ""
      { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
      echo ""
      echo -e '\e[38;5;82m' "No active internet connection available!!"
      echo -e '\e[38;5;82m' "Please check your internet connectivity!!"
      echo -e '\e[38;5;82m' "Active internet connection is required to"
      echo -e '\e[38;5;82m' "download necessary adblocking hosts files"
      echo ""
      echo ""
      read -r -s -p $'Press Any Key To Return To Main Menu\n' -n1
      starrt
      ;;
  esac
}
########
function starrt (){
  if [ "$EUID" -ne 0 ]; then
    printf "\033c"
    echo ""
    { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
    echo ""
    echo -e '\e[38;5;82m' "You must run \"pmiab\" script using \"sudo\" or as the root user."
    echo -e '\e[38;5;82m' "Hint : \"sudo pmiab\" or \"su -c 'pmiab'\""
    echo ""
    { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
    echo ""
    tput sgr0
    exit 1
  fi
  printf "\033c"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo -e '\e[38;5;82m' "pmiab - (Poor Man's Internet Ad Blocker) blocks ads system-wide"
  echo ""
  { for i in {16..51} {51..16}; do echo -en "\e[38;5;${i}m#\e[0m"; done; echo; }
  echo ""
  echo ""
  echo -e '\e[38;5;82m' "01 Block Internet Adverts"
  echo -e '\e[38;5;82m' "02 Unblock Internet Adverts"
  echo -e '\e[38;5;82m' "03 Quit pmiab"
  echo -e ""
  echo -e ""
  echo -e '\e[38;5;82m' "Enter Your Choice: "
  echo -e ""
  read -r Choice
  case $Choice in
    01 | 1)
      pm_netchk
      ;;
    02 | 2)
      pm_unblock
      ;;
    03 | 3)
      byye
      ;;
    *)
      printf "\033c"
      echo -e ""
      echo -e ""
      echo -e '\e[38;5;82m' "\"$Choice\" Is An Invalid Option!"
      echo -e ""
      echo -e '\e[38;5;82m' "Correct Options To Choose From Are 1-2-3"
      echo -e ""
      echo -e '\e[38;5;82m' "To block internet adverts press \"1\" & hit \"Enter\" key"
      echo -e '\e[38;5;82m' "To restore original hosts press \"2\" & hit \"Enter\" key"
      echo -e '\e[38;5;82m' "To exit from pmiab script press \"3\" & hit \"Enter\" key"
      echo -e '\e[38;5;82m' "Got It?!? Ready To Give It Another Go?!?"
      echo -e ""
      read -r -s -p $'Press Any Key To Try Again...\n' -n1
      starrt
      ;;
  esac
}
########
while :
do
  starrt
done


Cheers!!!

3
Very well summarized @VastOne  8)

Cheers!!!

4
Scripts / Re: pmpm - Making Password Management Easy & Secure (V2)
« on: March 21, 2017, 06:47:19 PM »
Okay the script is ready! The problem, It exceeds the attachment limit  :(
jedi, any chance of parking space at nixnut?!?

Cheers!!!

5
Do you have an account at 'the Linux forum with grill, bacon & barbecue'?
Are you planning to join 'the Linux forum with grill, bacon & barbecue'?

If no then you don't know how lucky you are  ;)

If yes then here is a tip that will prevent you from getting banned at 'the Linux forum with grill, bacon & barbecue',

Don't you ever point out a mistake made by the administrator of 'the Linux forum with grill, bacon & barbecue'!
Even if S/He has made an obvious mistake!


Sounds incredulous?!?
Sounds ridiculous?!?
Sounds unbelievable?!?
Want some credit for the above claim?

Okay, here is what transpired at 'the Linux forum with grill, bacon & barbecue' on 19-03-2017.
The leader and administrator of 'the Linux forum with grill, bacon & barbecue' posted a bash script to play internet radio streams.
The script had this variable,
Code: [Select]
PARAMS="-c -b $BUFFER"

The above parameters were for mpg123.
I pointed out that the "-c" option in mpg123 checks and reports instances of clipping. It does not enable terminal control keys. The correct option to enable terminal control keys in mpg123 is "-C".

The next day when I tried to log-in to my account at 'the Linux forum with grill, bacon & barbecue' I was greeted with the message that I was banned from 'the Linux forum with grill, bacon & barbecue'.

My whole conversation with The leader and administrator of 'the Linux forum with grill, bacon & barbecue'  in the above mentioned topic was deleted and the script there has since been edited and corrected.

And The leader and administrator of 'the Linux forum with grill, bacon & barbecue' also added the following farewell message in the script for me. It reads like this,
Code: [Select]
## for mr-know-all:
# BUFFER=3000
# PLAYER="mpg123" # you can try with streamripper, mplayer, vlc, ...
# PARAMS="--silent-whore --shut-the-fuck-up-smoothly --asshole-on-fire  -b $BUFFER" # depends on the $PLAYER, make *your* choices and stop fucking discussing what whoreface parameters you suggest

So if you are a member or you are planning to join 'the Linux forum with grill, bacon & barbecue',

YOU HAVE BEEN WARNED

Cheers!!!

6
I've Got a Life / Re: Ain't nothing like $HOME
« on: March 21, 2017, 06:02:20 PM »
No, it was my fault, all of it, the whole thing!  I take full responsibly...   :'(
Oh, you cruel man jedi  :D
How I hate you for this blatant crime  :D

Cheers!!!

7
Scripts / Re: pmss (Poor Man's Screenshooter)
« on: March 19, 2017, 09:40:59 PM »
V4 is here  8)

  • Now pmss can upload the screenshot to your imgur account. Of-course you can upload anonymously as well.
  • pmss now keeps a log of all the anonymously uploaded images so you can reuse the image links whenever you need them or remove the uploaded image using the delete link whenever the need be.
  • pmss code is a bit more easy to read  :D

Feedback welcome  8)

Code: [Select]
#!/usr/bin/env bash

function bye_bye (){
    printf "\033c"
    echo -e '\E[1;32;49m'"A Screenshot Is An Image Of The Display On A Computer Screen"
    echo -e '\E[1;32;49m'"But You Already Knew That So"
    echo -e '\E[1;32;49m'"Bye, Ciao, Adios"
    sleep 2
    printf "\033c"
    tput sgr0
    exit 0
}

function view_log (){
    test -f "${PMSS_LOG}" || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"PMSS Upload Log File Not Found"; echo -e '\E[1;32;49m'"Upload A Few Screenshots First"; echo -e ""; read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1; MenU; }
    test -s "${PMSS_LOG}" || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"PMSS Upload Log File Is Empty"; echo -e '\E[1;32;49m'"Upload Some Screenshots First"; echo -e ""; read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1; MenU; }
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"V\" To View The Upload Log File"
    echo -e '\E[1;32;49m'"Press \"W\" To Wipe The Upload Log File"
    echo -e '\E[1;32;49m'"Press \"N\" To Go Back To The Main Menu"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"V" | "v")
    if ! type less >/dev/null 2>&1; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Requires File Pager \"less\" To Display Upload Log"
echo -e '\E[1;32;49m'"Please Install Package \"less\" Via The Package Manager"
echo -e '\E[1;32;49m'"For Extra Information On \"less\" Please Visit Homepage"
echo -e '\E[1;32;49m'"http://www.greenwoodsoftware.com/less/"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    else
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Once You Are Done Viewing, Press \"Q\" To Close The File"
echo -e ""
read -r -s -p $'Press Any Key To View The File...\n' -n1
tput sgr0
less -RM "$PMSS_LOG"
MenU
    fi
    ;;
"W" | "w")
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"This Will Clear Entire Upload Log! Are You Sure?"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"Y\" To Wipe The Upload Log File"
    echo -e '\E[1;32;49m'"Press \"N\" To Go Back To The Main Menu"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"Y" | "y")
    if type truncate >/dev/null 2>&1; then
truncate --size 0 "$PMSS_LOG"
    else
: > "$PMSS_LOG"
    fi
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"The Upload Log File Has Been Cleared"
    echo -e ""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
    ;;
"N" | "n")
    MenU
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-N"
    echo -e ""
    echo -e '\E[1;32;49m'"To Wipe The Upload Log File, Press \"Y\""
    echo -e '\E[1;32;49m'"To Go Back To The Main Menu, Press \"N\""
    echo -e ""
    echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
    echo -e ""
    read -r -s -p $'Press Any Key To Continue..\n' -n1
    view_log
    ;;
    esac
    ;;
"N" | "n")
    MenU
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From V-W-N"
    echo -e ""
    echo -e '\E[1;32;49m'"To View The Upload Log File, Press \"V\""
    echo -e '\E[1;32;49m'"To Wipe The Upload Log File, Press \"W\""
    echo -e '\E[1;32;49m'"To Go Back To The Main Menu, Press \"N\""
    echo -e ""
    echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
    echo -e ""
    read -r -s -p $'Press Any Key To Continue..\n' -n1
    view_log
    ;;
    esac
}

function empty_dir (){
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"This Will Remove All Saved Screenshots! Are You Sure?"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"Y\" To Empty Screenshots Directory"
    echo -e '\E[1;32;49m'"Press \"N\" To Move Back To Main PMSS Menu"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"Y" | "y")
    if test -z "$(find "${DIR}" -maxdepth 1 -name '*.png' -print -quit)"; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Screenshots Directory Is Empty"
echo -e '\E[1;32;49m'"Nothing To Delete. Say Cheese!"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    else
PMSS_RM=$(which rm)
"$PMSS_RM" -f "${DIR}"/*.png
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Screenshots Directory Has Been Emptied"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    ;;
"N" | "n")
    MenU
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-N"
    echo -e ""
    echo -e '\E[1;32;49m'"To Empty Screenshots Directory, Press \"Y\""
    echo -e '\E[1;32;49m'"To Move Back To Main PMSS Menu, Press \"N\""
    echo -e ""
    echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
    echo -e ""
    read -r -s -p $'Press Any Key To Continue..\n' -n1
    empty_dir
    ;;
    esac
}

function purge_shot (){
    printf "\033c"
    PMSS_RM=$(which rm)
    "$PMSS_RM" -f "${NAME}"
    MenU
}

function imgur_upload_personal (){
    printf "\033c"
    while IFS=: read -r k v; do
codes_map["$k"]="$v"
    done < "${PMSS_CONFIG}"
    if ! wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "https://api.imgur.com" -O /dev/null; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Cannot Connect To \"imgur\""
echo -e '\E[1;32;49m'"Check Your Internet Connection"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    RESPONSE=$(curl -s --connect-timeout 30 --user-agent "Mozilla/5.0 Gecko/20100101" -X POST -H "Authorization: Bearer ${codes_map[access_token]}" -F "image=@$NAME" "https://api.imgur.com/3/image.xml" 2>/dev/null)
    if grep -q 'success="0"' <<<"$RESPONSE"; then
ERR_MSG2="${RESPONSE##*<error>}"
ERR_MSG="${ERR_MSG2%%</error>*}"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Something Went Wrong! Upload To imgur Failed!"
echo -e '\E[1;32;49m'"The Following Error Message Was Sent By imgur"
echo -e ""
echo -e '\E[1;32;49m'"\"$ERR_MSG\""
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    URL3="${RESPONSE##*<link>}"
    URL2="${URL3%%</link>*}"
    URL="${URL2//http:/https:}"
    BASE_URL="${URL%.*}"
    BASE_EXT="${URL##*.}"
    DEL_HASH2="${RESPONSE##*<deletehash>}"
    DEL_HASH="${DEL_HASH2%%</deletehash>*}"
    DEL_URL="https://imgur.com/delete/${DEL_HASH}"
    printf "\033c"
    echo -e '\E[1;32;49m'"DIRECT LINK"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"${URL}"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"${BASE_URL}m.${BASE_EXT}"
    echo -e ""
    echo -e '\E[1;32;49m'"BBCODE LINK (FORUMS, MESSAGE BOARDS)"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"[img]${URL}[/img]"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"[url=${BASE_URL}][img]${BASE_URL}m.${BASE_EXT}[/img][/url]"
    echo -e ""
    echo -e '\E[1;32;49m'"MARKDOWN LINK (REDDIT, GITHUB)"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"[${SHORT_NAME}](${URL})"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"[${SHORT_NAME}](${BASE_URL}m.${BASE_EXT})"
    echo -e ""
    echo -e '\E[1;32;49m'"HTML LINK (WEBSITES, BLOGS)"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"<a href=${BASE_URL}><img src=${URL} title=${SHORT_NAME} /></a>"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"<a href=${BASE_URL}><img src=${BASE_URL}m.${BASE_EXT} title=${SHORT_NAME} /></a>"
    echo -e ""
    echo -e '\E[1;32;49m'"DELETE LINK"
    echo -e '\E[1;32;49m'"Delete url: "'\E[0;32;49m'"${DEL_URL}"
    echo -e '\E[1;32;49m'""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
}

function imgur_token_test (){
    if ! type curl >/dev/null 2>&1; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Requires \"cURL\" To Upload To imgur"
echo -e '\E[1;32;49m'"Install \"curl\" Via Your Package-manager"
echo -e '\E[1;32;49m'"For extra info go to website of \"cURL\","
echo -e '\E[1;32;49m'"https://curl.haxx.se/"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    PERMS_CONFIG=$(stat -c "%a" "${PMSS_CONFIG}")
    printf "\033c"
    if ! [[ "${PERMS_CONFIG}" == 600 ]]; then
chmod 600 "${PMSS_CONFIG}"
    fi
    while IFS=: read -r k v; do
codes_map["$k"]="$v"
    done < "${PMSS_CONFIG}"
    TOKEN_TIME=$(find "${PMSS_CONFIG}" -mmin +40319)
    if test "$TOKEN_TIME"; then
if ! wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "https://api.imgur.com" -O /dev/null; then
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"PMSS Cannot Connect To \"imgur\""
    echo -e '\E[1;32;49m'"Check Your Internet Connection"
    echo -e ""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
fi
RESPONSE=$(curl -s --connect-timeout 30 --user-agent "Mozilla/5.0 Gecko/20100101" -X POST -H "Authorization: Bearer ${codes_map[access_token]}" -F "refresh_token=${codes_map[refresh_token]}" -F "client_id=${codes_map[client_id]}" -F "client_secret=${codes_map[client_secret]}" -F "grant_type=refresh_token" "https://api.imgur.com/oauth2/token" 2>/dev/null)
if grep -q 'success:false' <<<"$RESPONSE"; then
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"PMSS Failed To Refresh The Access Token"
    echo -e '\E[1;32;49m'"Please Retry The Process Sometime Later"
    echo -e ""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
fi
while IFS=\" read -rd \, _ k _ v; do
    if [[ "$k" = @(access_token|refresh_token) ]]; then
codes_map["$k"]="$v"
    fi
done <<< "$RESPONSE"
printf '%s:%s\n' access_token "${codes_map[access_token]}" refresh_token "${codes_map[refresh_token]}" client_id "${codes_map[client_id]}" client_secret "${codes_map[client_secret]}" > "${PMSS_CONFIG}"
imgur_upload_personal
    else
imgur_upload_personal
    fi
}

function setup_stage2 (){
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter The \"Access Token\" Acquired During The Setup Process"
    echo -e ""
    read -er access_token
    if [[ -z "$access_token" ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Nothing Was Entered!!!"
echo -e ""
sleep 2
setup_stage2
    fi
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter The \"Refresh Token\" Acquired During The Setup Process"
    echo -e ""
    read -er refresh_token
    if [[ -z "$refresh_token" ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Nothing Was Entered!!!"
echo -e ""
sleep 2
setup_stage2
    fi
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter The \"Client ID\" Acquired During The Setup Process"
    echo -e ""
    read -er client_id
    if [[ -z "$client_id" ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Nothing Was Entered!!!"
echo -e ""
sleep 2
setup_stage2
    fi
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter The \"Client Secret\" Acquired During The Setup Process"
    echo -e ""
    read -er client_secret
    if [[ -z "$client_secret" ]]; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Nothing Was Entered!!!"
echo -e ""
sleep 2
setup_stage2
    fi
    codes_map[access_token]="$access_token"
    codes_map[refresh_token]="$refresh_token"
    codes_map[client_id]="$client_id"
    codes_map[client_secret]="$client_secret"
    printf '%s:%s\n' access_token "${codes_map[access_token]}" refresh_token "${codes_map[refresh_token]}" client_id "${codes_map[client_id]}" client_secret "${codes_map[client_secret]}" > "$PMSS_CONFIG"
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"imgur \"OAuth 2\" Setup Is Now Complete"
    echo -e '\E[1;32;49m'"Enjoy Uploading To Your imgur Account"
    echo -e ""
    read -r -s -p $'Press Any Key To Continue..\n' -n1
    imgur_token_test
}

function setup_stage1 (){
    if test -f "${PMSS_CONFIG}"; then
imgur_token_test
    fi
    echo -e ""
    echo -e '\E[1;32;49m'"To Upload To Your imgur Account, \"OAuth 2\" Setup Needs To Be Completed"
    echo -e '\E[1;32;49m'"Start The \"OAuth 2\" Setup Process Now?"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter \"Y\" To Start The Setup"
    echo -e '\E[1;32;49m'"Enter \"N\" To Go Back To Menu"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"Y" | "y")
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"First You Need To Register A New Application At imgur"
    echo -e '\E[1;32;49m'"While Registering At imgur Do Select Following Option"
    echo -e ""
    echo -e '\E[0;32;49m'"\"OAuth 2 authorization without a callback URL\""
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"Open Following Link In A Browser To Register At imgur"
    echo -e ""
    echo -e '\E[0;32;49m'"https://api.imgur.com/oauth2/addclient"
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"You Would Now Have Your \"Client ID\" & \"Client Secret\""
    echo -e '\E[1;32;49m'"Save Them In A Text File As They'll Be Required Later"
    echo -e ""
    read -rsp $'Press Any Key To Continue The Setup Process..\n' -n1
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Next In The Following Link, Replace \"CLIENT_ID\" With,"
    echo -e '\E[1;32;49m'"Your \"Client ID\" Received After registration At imgur"
    echo -e '\E[1;32;49m'"And Open The URL In A Browser To Receive Personal \"PIN\""
    echo -e ""
    echo -e '\E[0;32;49m'"https://api.imgur.com/oauth2/authorize?client_id=CLIENT_ID&response_type=pin"
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"imgur webpage will display you the following message,"
    echo -e ""
    echo -e '\E[0;32;49m'"\"An application would like to connect to your account\""
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"On this imgur page simply click on the \"allow\" button"
    echo -e '\E[1;32;49m'"You Will Now Have \"Client ID\" \"Client Secret\" & \"PIN\""
    echo -e '\E[1;32;49m'"Save Them In A Text File As They'll Be Required Later"
    echo -e ""
    read -rsp $'Press Any Key To Continue The Setup Process..\n' -n1
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Replace \"CLIENT_ID\" \"CLIENT_SECRET\" & \"PIN\" With The,"
    echo -e '\E[1;32;49m'"\"Client ID\" \"Client Secret\" & \"PIN\" That You Have Got"
    echo -e '\E[1;32;49m'"From imgur And Run The Following Command In A Terminal"
    echo -e ""
    echo -e '\E[0;32;49m'"curl -X POST -F \"client_id=CLIENT_ID\" -F \"client_secret=CLIENT_SECRET\" -F \"pin=PIN\" -F \"grant_type=pin\" \"https://api.imgur.com/oauth2/token\""
    echo -e ""
    echo -e ""
    echo -e '\E[1;32;49m'"You Will Now Have \"Access Token\" And \"Refresh Token\""
    echo -e '\E[1;32;49m'"Save Them In A Text File As They'll Be Required Later"
    echo -e ""
    read -rsp $'Press Any Key To Continue The Setup Process..\n' -n1
    setup_stage2
    ;;
"N" | "n")
    MenU
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-N"
    echo -e ""
    echo -e '\E[1;32;49m'"To Start OAuth 2 Set-up, Enter \"Y\""
    echo -e '\E[1;32;49m'"To Go Back To Main Menu, Enter \"N\""
    echo -e ""
    echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
    echo -e ""
    read -r -s -p $'Press Any Key To Continue..\n' -n1
    setup_stage1
    ;;
    esac
}

function imgur_upload_anonymous (){
    if ! type curl >/dev/null 2>&1; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Requires \"cURL\" To Upload To imgur"
echo -e '\E[1;32;49m'"Install \"curl\" Via Your Package-manager"
echo -e '\E[1;32;49m'"For extra info go to website of \"cURL\","
echo -e '\E[1;32;49m'"https://curl.haxx.se/"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    if ! wget --spider --user-agent="Mozilla/5.0 Gecko/20100101" --timeout=30 -q "https://api.imgur.com" -O /dev/null; then
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"PMSS Cannot Connect To \"imgur\""
echo -e '\E[1;32;49m'"Check Your Internet Connection"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    RESPONSE=$(curl -s --connect-timeout 30 --user-agent "Mozilla/5.0 Gecko/20100101" -X POST -H "Authorization: Client-ID $ID_CLIENT" -F "image=@$NAME" "https://api.imgur.com/3/image.xml" 2>/dev/null)
    if grep -q 'success="0"' <<<"$RESPONSE"; then
ERR_MSG2="${RESPONSE##*<error>}"
ERR_MSG="${ERR_MSG2%%</error>*}"
printf "\033c"
echo -e ""
echo -e '\E[1;32;49m'"Something Went Wrong! Upload To imgur Failed!"
echo -e '\E[1;32;49m'"The Following Error Message Was Sent By imgur"
echo -e ""
echo -e '\E[1;32;49m'"\"$ERR_MSG\""
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    fi
    URL3="${RESPONSE##*<link>}"
    URL2="${URL3%%</link>*}"
    URL="${URL2//http:/https:}"
    BASE_URL="${URL%.*}"
    BASE_EXT="${URL##*.}"
    DEL_HASH2="${RESPONSE##*<deletehash>}"
    DEL_HASH="${DEL_HASH2%%</deletehash>*}"
    DEL_URL="https://imgur.com/delete/${DEL_HASH}"
    printf "\033c"
    echo -e "################################################################################" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "DATE-TIME : $(date +"%d-%m-%Y::%H:%M:%S")" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "DIRECT LINK" >> "${PMSS_LOG}"
    echo -e "Original  : ${URL}" >> "${PMSS_LOG}"
    echo -e "Thumbnail : ${BASE_URL}m.${BASE_EXT}" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "BBCODE LINK (FORUMS, MESSAGE BOARDS)" >> "${PMSS_LOG}"
    echo -e "Original  : [img]${URL}[/img]" >> "${PMSS_LOG}"
    echo -e "Thumbnail : [url=${BASE_URL}][img]${BASE_URL}m.${BASE_EXT}[/img][/url]" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "MARKDOWN LINK (REDDIT, GITHUB)" >> "${PMSS_LOG}"
    echo -e "Original  : [${SHORT_NAME}](${URL})" >> "${PMSS_LOG}"
    echo -e "Thumbnail : [${SHORT_NAME}](${BASE_URL}m.${BASE_EXT})" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "HTML LINK (WEBSITES, BLOGS)" >> "${PMSS_LOG}"
    echo -e "Original  : <a href=${BASE_URL}><img src=${URL} title=${SHORT_NAME} /></a>" >> "${PMSS_LOG}"
    echo -e "Thumbnail : <a href=${BASE_URL}><img src=${BASE_URL}m.${BASE_EXT} title=${SHORT_NAME} /></a>" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "DELETE LINK" >> "${PMSS_LOG}"
    echo -e "Delete url: ${DEL_URL}" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    echo -e "################################################################################" >> "${PMSS_LOG}"
    echo -e "" >> "${PMSS_LOG}"
    printf "\033c"
    echo -e '\E[1;32;49m'"DIRECT LINK"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"${URL}"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"${BASE_URL}m.${BASE_EXT}"
    echo -e ""
    echo -e '\E[1;32;49m'"BBCODE LINK (FORUMS, MESSAGE BOARDS)"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"[img]${URL}[/img]"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"[url=${BASE_URL}][img]${BASE_URL}m.${BASE_EXT}[/img][/url]"
    echo -e ""
    echo -e '\E[1;32;49m'"MARKDOWN LINK (REDDIT, GITHUB)"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"[${SHORT_NAME}](${URL})"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"[${SHORT_NAME}](${BASE_URL}m.${BASE_EXT})"
    echo -e ""
    echo -e '\E[1;32;49m'"HTML LINK (WEBSITES, BLOGS)"
    echo -e '\E[1;32;49m'"Original  : "'\E[0;32;49m'"<a href=${BASE_URL}><img src=${URL} title=${SHORT_NAME} /></a>"
    echo -e '\E[1;32;49m'"Thumbnail : "'\E[0;32;49m'"<a href=${BASE_URL}><img src=${BASE_URL}m.${BASE_EXT} title=${SHORT_NAME} /></a>"
    echo -e ""
    echo -e '\E[1;32;49m'"DELETE LINK"
    echo -e '\E[1;32;49m'"Delete url: "'\E[0;32;49m'"${DEL_URL}"
    echo -e '\E[1;32;49m'""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
}

function upload_check (){
    if type xdg-open >/dev/null 2>&1; then
xdg-open "${NAME}"
    else
echo -e ""
echo -e '\E[1;32;49m'"PMSS Is Unable To Open The Screenshot"
echo -e '\E[1;32;49m'"It Needs \"xdg-utils\" Package To Do So"
echo -e ""
    fi
    echo -e ""
    echo -e '\E[1;32;49m'"Do You Want To Upload The Screenshot?"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter \"Y\" To Upload The Shot To imgur"
    echo -e '\E[1;32;49m'"Enter \"D\" To Purge The Shot & Go Back"
    echo -e '\E[1;32;49m'"Enter \"N\" To Go Back To The Main Menu"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"Y" | "y")
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Select The Preferred Image Upload Mode"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter \"A\" For Anonymous Image Upload"
    echo -e '\E[1;32;49m'"Enter \"U\" To Upload Image To Account"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"A" | "a")
    printf "\033c"
    imgur_upload_anonymous
    ;;
"U" | "u")
    printf "\033c"
    setup_stage1
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From A-P"
    echo -e ""
    echo -e '\E[1;32;49m'"For Uploading Image Anonymously, Enter \"A\""
    echo -e '\E[1;32;49m'"To Upload Image To Your Account, Enter \"U\""
    echo -e ""
    echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
    echo -e ""
    read -r -s -p $'Press Any Key To Continue..\n' -n1
    MenU
    ;;
    esac
    ;;
"D" | "d")
    purge_shot
    ;;
"N" | "n")
    MenU
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Choice!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From Y-D-N"
    echo -e ""
    echo -e '\E[1;32;49m'"To Upload Image To imgur, Enter \"Y\""
    echo -e '\E[1;32;49m'"To Delete Captured Image, Enter \"D\""
    echo -e '\E[1;32;49m'"To Move Back To The Menu, Enter \"N\""
    echo -e ""
    echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
    echo -e ""
    read -rsp $'Press Any Key To Continue..\n' -n1
    MenU
    ;;
    esac
}

function area_mouse (){
    DATE="$(date +%d%m%y-%H%M%S)"
    SHORT_NAME="Shot-${DATE}.png"
    NAME="${DIR}/${SHORT_NAME}"
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Draw A Rectangle On The Screen By Click-Dragging Left Mouse Button"
    echo -e '\E[1;32;49m'"And Release The Mouse Button Once You Have Selected The Area To Be"
    echo -e '\E[1;32;49m'"Captured. Region Inside The Drawn Rectangle Will Be Shot By Script"
    echo -e ""
    echo -e '\E[1;32;49m'"Once The Screen Capture Mode Is Activated, Pressing Any Keys Will"
    echo -e '\E[1;32;49m'"Abort The Screenshot. So Keep The Keyboard Silent In Capture Mode"
    echo -e ""
    read -r -s -p $'Press Any Key To Activate Screen Capture Mode..\n' -n1
    PMSS_PID=$(xdotool getactivewindow)
    xdotool windowminimize "$PMSS_PID"
    sleep 1
    scrot -s "${NAME}"
    RETVAL=$?
    if [[ "$RETVAL" == 2 ]]; then
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[1;32;49m'"Keyboard Key Was Pressed. Screenshot Aborted"
echo -e ""
read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
MenU
    else
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
echo -e ""
upload_check
    fi
}

function window_focus (){
    DATE="$(date +%d%m%y-%H%M%S)"
    SHORT_NAME="Shot-${DATE}.png"
    NAME="${DIR}/${SHORT_NAME}"
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Select The Screenshot Mode"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"B\" To Capture The Window Open Below PMSS Window"
    echo -e '\E[1;32;49m'"Press \"C\" To Capture The Window Under The Mouse Cursor"
    echo -e '\E[1;32;49m'"Press \"M\" To Manually Select The Window To Be Captured"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"B" | "b")
    PMSS_PID=$(xdotool getactivewindow)
    xdotool windowminimize "$PMSS_PID"
    sleep 1
    scrot -u -b -c "${NAME}"
    RETVAL=$?
    if [[ "$RETVAL" == 2 ]]; then
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[1;32;49m'"No Open Window Found Below PMSS"
echo -e '\E[1;32;49m'"Hence No Screenshot Is Captured"
echo -e ""
read -r -s -p $'Press Any Key To Continue..\n' -n1
window_focus
    else
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
echo -e ""
upload_check
    fi
    ;;
"C" | "c")
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Position The Mouse Cursor Over The Window To Capture"
    echo -e '\E[1;32;49m'"Don't Click Just Position The Cursor Over The Window"
    echo -e ""
    read -r -s -p $'Press Any Key When You Are Ready..\n' -n1
    PMSS_PID=$(xdotool getactivewindow)
    xdotool windowminimize "$PMSS_PID"
    MAGIC_SED='s/.*=\(.*\)/\1/'
    WIN_BLW=$(xdotool getmouselocation --shell 2>/dev/null | grep WINDOW | sed "$MAGIC_SED")
    xdotool windowactivate "$WIN_BLW"
    sleep 1
    scrot -u -b -c "${NAME}"
    printf "\033c"
    sleep 1
    xdotool windowactivate "$PMSS_PID"
    echo -e ""
    echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
    echo -e ""
    upload_check
    ;;
"M" | "m")
    PMSS_PID=$(xdotool getactivewindow)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Minimize Terminal And Bring The Window To Be Captured In Focus.."
    echo -e ""
    scrot -u -d12 -b -c "${NAME}"
    RETVAL=$?
    if [[ "$RETVAL" == 2 ]]; then
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[1;32;49m'"Failed To Find A Focused Window"
echo -e '\E[1;32;49m'"Hence No Screenshot Is Captured"
echo -e ""
read -r -s -p $'Press Any Key To Continue..\n' -n1
window_focus
    else
printf "\033c"
sleep 1
xdotool windowactivate "$PMSS_PID"
echo -e ""
echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
echo -e ""
upload_check
    fi
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Option!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From B-C-M"
    echo -e ""
    echo -e '\E[1;32;49m'"To Capture The Window Open Below PMSS Window, Press \"B\""
    echo -e '\E[1;32;49m'"To Capture The Window Under The Mouse Cursor, Press \"C\""
    echo -e '\E[1;32;49m'"To Manually Select The Window To Be Captured, Press \"M\""
    echo -e ""
    echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
    echo -e ""
    read -r -s -p $'Press Any Key To Continue..\n' -n1
    window_focus
    ;;
    esac
}

function entire_area (){
    DATE="$(date +%d%m%y-%H%M%S)"
    SHORT_NAME="Shot-${DATE}.png"
    NAME="${DIR}/${SHORT_NAME}"
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Select The Screenshot Mode"
    echo -e ""
    echo -e '\E[1;32;49m'"Press \"C\" For Clean Mode"
    echo -e '\E[1;32;49m'"Press \"D\" For Dirty Mode"
    echo -e ""
    echo -e '\E[1;32;49m'"Enter Your Choice: "
    echo -e ""
    tput sgr0
    read -er Choice
    case "$Choice" in
"C" | "c")
    shopt -s nocaseglob
    shopt -s globstar
    shopt -s extglob
    DESK_TOP=$(xdotool get_desktop)
    PMSS_PID=$(xdotool getactivewindow)
    xdotool windowminimize "$PMSS_PID"
    CONKY_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*conky*")
    DZEN_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*dzen*")
    PANEL_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*panel*")
    TINT2_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*tint*")
    BAR_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*bar*")
    DOCK_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*dock*")
    AWN_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*awn*")
    PLANK_CHECK=$(xdotool search --desktop "$DESK_TOP" --onlyvisible ".*plank*")
    for i in $(xdotool search --onlyvisible --desktop "$DESK_TOP" ".*"); do xdotool windowminimize "$i"; done
    CONKY_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*conky*")
    DZEN_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*dzen*")
    PANEL_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*panel*")
    TINT2_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*tint*")
    BAR_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*bar*")
    DOCK_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*dock*")
    AWN_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*awn*")
    PLANK_CHECK2=$(xdotool search --desktop "$DESK_TOP" ".*plank*")
    if ! [[ "$CONKY_CHECK" == "$CONKY_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*conky*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$DZEN_CHECK" == "$DZEN_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*dzen*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$PANEL_CHECK" == "$PANEL_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*panel*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$TINT2_CHECK" == "$TINT2_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*tint*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$BAR_CHECK" == "$BAR_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*bar*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$DOCK_CHECK" == "$DOCK_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*dock*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$AWN_CHECK" == "$AWN_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*awn*"); do xdotool windowactivate "$i"; done
    fi
    if ! [[ "$PLANK_CHECK" == "$PLANK_CHECK2" ]]; then
for i in $(xdotool search --desktop "$DESK_TOP" ".*plank*"); do xdotool windowactivate "$i"; done
    fi
    shopt -u nocaseglob
    shopt -u globstar
    shopt -u extglob
    sleep 1
    scrot -c "${NAME}"
    printf "\033c"
    sleep 1
    xdotool windowactivate "$PMSS_PID"
    echo -e ""
    echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
    echo -e ""
    upload_check
    ;;
"D" | "d")
    PMSS_PID=$(xdotool getactivewindow)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"Minimize Terminal & Any Open Window You Don't Wish To Capture.."
    echo -e ""
    scrot -d12 -c "${NAME}"
    printf "\033c"
    sleep 1
    xdotool windowactivate "$PMSS_PID"
    echo -e ""
    echo -e '\E[0;32;49m'"${SHORT_NAME}"'\E[1;32;49m'" Saved In "'\E[0;32;49m'"${DIR}"
    echo -e ""
    upload_check
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Choice\" Is An Invalid Option!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From C-D"
    echo -e ""
    echo -e '\E[1;32;49m'"To Capture The Desktop Without Any Open Window, Press \"C\""
    echo -e '\E[1;32;49m'"To Capture The Desktop With Open-Active Window, Press \"D\""
    echo -e ""
    echo -e '\E[1;32;49m'"Got it? It Is Not That Hard You See"
    echo -e ""
    read -r -s -p $'Press Any Key To Continue..\n' -n1
    entire_area
    ;;
    esac
}

function MenU (){
    export LC_ALL=C
    type scrot >/dev/null 2>&1 || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"A required pmss dependency \"Scrot\" is not present."; echo -e '\e[1;32;49m'"\"Scrot\" is available for almost all linux distros."; echo -e '\e[1;32;49m'"Please install \"scrot\" using your package manager."; echo -e ""; tput sgr0; exit 1; }
    type xdotool >/dev/null 2>&1 || { printf "\033c"; echo -e ""; echo -e '\E[1;32;49m'"A required pmss dependency \"xdotool\" is not present."; echo -e '\e[1;32;49m'"\"xdotool\" is available for almost all linux distros."; echo -e '\e[1;32;49m'"Please install \"xdotool\" using your package manager."; echo -e '\e[1;32;49m'"For more info please visit the website of \"xdotool\","; echo -e '\e[1;32;49m'"http://semicomplete.com/projects/xdotool"; echo -e ""; tput sgr0; exit 1; }
    if type xdg-user-dir >/dev/null 2>&1; then
DIR_CHECK="$(xdg-user-dir PICTURES)"
if [ "${DIR_CHECK}" != "${HOME}" ]; then
    DIR="${DIR_CHECK}/Screenshots"
    test -d "${DIR}" || mkdir -p "${DIR}"
fi
    else
DIR="${HOME}/Pictures/Screenshots"
test -d "${DIR}" || mkdir -p "${DIR}"
    fi
    PMSS_LOG="${DIR}/pmss-upload.log"
    test -f "${PMSS_LOG}" || touch "${PMSS_LOG}"
    PMSS_CONFIG="${DIR}/.pmss.cfg"
    ID_CLIENT=$(tr '\!-~' 'P-~\!-O' <<<"27a7g_h3ff562a4")
    declare -A codes_map
    printf "\033c"
    echo -e '\E[1;32;49m'"** PMSS<>MENU *************************************************"
    echo -e ""
    echo -e '\E[1;32;49m'"** Select One Of The Following Options"
    echo -e ""
    echo -e '\E[1;32;49m'"** Enter \"E\" To Take The Screenshot Of The Entire Screen"
    echo -e '\E[1;32;49m'"** Enter \"W\" To Take The Screenshot Of Window In Focus"
    echo -e '\E[1;32;49m'"** Enter \"A\" To Take The Screenshot Of Area Selected By Mouse"
    echo -e '\E[1;32;49m'"** Enter \"D\" To Empty Screenshots Directory"
    echo -e '\E[1;32;49m'"** Enter \"L\" To Manage Upload Log"
    echo -e '\E[1;32;49m'"** Enter \"Q\" To Exit"
    echo -e ""
    echo -e '\E[1;32;49m'"***************************************************************"
    echo -e ""
    tput sgr0
    read -er Options
    case "$Options" in
"E" | "e")
    entire_area
    ;;
"W" | "w")
    window_focus
    ;;
"A" | "a")
    area_mouse
    ;;
"D" | "d")
    empty_dir
    ;;
"L" | "l")
    view_log
    ;;
"Q" | "q")
    bye_bye
    ;;
*)
    printf "\033c"
    echo -e ""
    echo -e '\E[1;32;49m'"\"$Options\" Is An Invalid Option!!!"
    echo -e ""
    echo -e '\E[1;32;49m'"Correct Options To Choose Are From E-W-A-D-Q"
    echo -e ""
    echo -e '\E[1;32;49m'"For Screenshot Of The Entire Screen, Press \"E\" & Hit \"Enter\" Key"
    echo -e '\E[1;32;49m'"For Screenshot Of The Window In Focus, Press \"W\" & Hit \"Enter\" Key"
    echo -e '\E[1;32;49m'"For Screenshot Of Area Selected By Mouse, Press \"A\" & Hit \"Enter\" Key"
    echo -e '\E[1;32;49m'"To Empty Screenshots Directory, Press \"D\" & Hit \"Enter\" Key"
    echo -e '\E[1;32;49m'"To Manage The Upload Log, Press \"L\" & Hit \"Enter\" Key"
    echo -e '\E[1;32;49m'"To Exit From PMSS, Press \"Q\" & Hit \"Enter\" Key"
    echo -e ""
    read -rsp $'Press Any Key To Return To PMSS MENU..\n' -n1
    MenU
    ;;
    esac
}
while :
do
    MenU
done


Cheers!!!

8
Scripts / Re: Poor Man's Youtube Downloader
« on: March 19, 2017, 09:04:13 PM »
If ever it stops working, all you need to do is, select

Code: [Select]
05 Check for updates

from pmytd menu and you'll be fine!!!

Cheers!!!

9
I've Got a Life / Re: Ain't nothing like $HOME
« on: March 19, 2017, 08:51:20 PM »
Friends don't apologize  :)
Don't insult our friendship by apologizing!

I overacted I guess! It never was your fault!

Cheers!!!

10
I've Got a Life / Ain't nothing like $HOME
« on: March 19, 2017, 07:51:19 PM »
Been away for over a month from the forums and how I missed it  :(
VSIDO members are like an extended family to me and in families, at times, there are disagreements. I took one of those disagreement to the heart and decided to stay away from here  :(
I joined another forum and it turned out to be a horrible experience to say the least  :(
And yesterday, that forum thankfully ended the horror-show by banning me  :D
I want to thank them for banning me cause otherwise it would have meant some extra time before coming back to THE HOME.
Ain't nothing like this place! It's true!

Cheers!!!

11
Scripts / Re: vsido-exit (systemd based logout script for VSIDO)
« on: February 10, 2017, 10:17:06 PM »
It now better handles inhibition locks. Avoid them when it can and ask when it can't.
It also handles multiuser scenario a bit better. root or superuser can reboot-shutdown evenif other users are logged in.
It can now reboot-shutdown system even without polkit.
Many improvements, wouldn't you agree?
Cheers!!!

12
Scripts / Re: vsido-exit (systemd based logout script for VSIDO)
« on: February 09, 2017, 08:29:29 PM »
It is released to the public  8)

It is now known as lepo-logout  ;D

Many things have been improved  :)

Here is the link to the GitHub repo,

lepo-logout on GitHub

Cheers!!!

13
I've Got a Life / Re: Current lava flow from Hawaii's Kilauea Volcano
« on: February 04, 2017, 05:29:35 PM »
24 years mining, construction, some research.

Two heart attacks forced me into retirement.
24 years in mining and construction!
That is a tough work, isn't it?

14
Scripts / Re: vsido-exit (systemd based logout script for VSIDO)
« on: February 04, 2017, 05:17:39 PM »
Thanks for the ideas PackRat. Assigning commands to variables can make editing the script easy. And I'm in the process of updating the script so these suggestions will be implemented in the new version.
Cheers!!!

15
I've Got a Life / Re: Current lava flow from Hawaii's Kilauea Volcano
« on: February 04, 2017, 04:49:32 PM »
That is awesome site!
@PackRat You used to work in Geology?

Pages: [1] 2 3 ... 32