Shared: parrot-ugrade edit for Anonsurf users

There have been a few recent posts/telegram questions w/users unknowingly having Anonsurf/tor running during parrot-upgrade command. I put together a little bash edit of
parrot-upgrade to in order:

  • Check if anonsurf is running
  • If not running it skips to traditional parrot-upgrade
  • If anonsurf is running it first stops it
  • If it was running when parrot-upgrade was started, after upgrade completes it asks you if you would like to start up anonsurf again; exits

Most of the questions related to parrot-upgrade leading to 403 errors are related to this. And I figured since anonsurf comes with Parrot and this problem is quite common it could be useful to someone.

starting w/anonsurf/tor running in background: stopping anonsurf (does not stop tor-browser):

After shutting down anonsurf, starting anonsurf back up (personal info blurred)

parrotupgrRESTARTas

just replace /usr/bin/parrot-upgrade with:

#!/bin/bash
#
# Makes sure anonsurf isn't running during upgrade
# If it is, stops anonsurf, during upgrades
# offers to restart anonsurf after upgrade
#
# If not running upgrades as normal
#
# Edited parrot-upgrade command <righttoprivacy@tutanota.com>
#
# For Parrot OS
#

export WHITE='\e[1;37m'
export BLUE='\033[1;94m'
export GREEN='\033[1;92m'
export RED='\033[1;91m'
export RESETCOLOR='\033[1;00m'


cat << "EOF"
                                   
                           /\/|
                          / / /
                    ---. //  /
 /\_________.      / O _\    /
 \_______    \   /    _\/  /
   \_____   /  \/      | _/
      \_____ (         /
         \___ '._     )
            \_.\     ((((
                |  \/ ( (
                 \   \
                  \   (
                   \   '.
                    \ \ \\
                     "-~~"

EOF


# Upgrade function from original parrot-upgrade script
UPGRADE () { 

	DEBIAN_FRONTEND="noninteractive"
	DEBIAN_PRIORITY="critical"
	DEBCONF_NOWARNINGS="yes"
	export DEBIAN_FRONTEND DEBIAN_PRIORITY DEBCONF_NOWARNINGS
	apt update || echo failed to update index lists
	dpkg --configure -a || echo failed to fix interrupted upgrades
	apt --fix-broken --fix-missing install || echo failed to fix conflicts
	apt -y --allow-downgrades --fix-broken --fix-missing dist-upgrade
}


echo -e "\n$BLUE Checking for Anonsurf processes... $RESETCOLOR"

if service tor status >&/dev/null; then  
	echo -e "$BLUE Anonsurf appears running... Stopping Parrot Anonsurf $RESETCOLOR"
	anonsurf stop 
	sleep 5
	UPGRADE
	sleep .5
        echo -e "\n$BLUE parrot-upgrade complete.$RESETCOLOR\n"
        sleep .5
        echo -e "$BLUE Exiting.$RESETCOLOR"
	sleep .5
	echo -e "$BLUE Would you like to restart Parrot Anonsurf (y/n) ?: $RESETCOLOR"
	read restarta

	if [ $restarta == "y" ];then
		anonsurf start
	fi
else
	sleep .5
	echo -e "$BLUE Anonsurf not running. $RESETCOLOR" 
	sleep .5
	echo -e "$BLUE Continuing parrot-upgrade...$RESETCOLOR\n"
	sleep 5
	UPGRADE
	sleep .5
	echo -e "\n$BLUE parrot-upgrade complete.$RESETCOLOR"
	sleep .5
	echo -e "$BLUE Exiting.$RESETCOLOR\n"
	exit
fi
6 Likes