Replacing SafeSquid Logo With Own Logo

Post your questions here, if you are not sure where you should.
Note: your post may be moved to appropriate forum by moderators.
India samidha
Posts: 74
Joined: Wed Apr 24, 2019 6:57 am
Location: Mumbai

Replacing SafeSquid Logo With Own Logo

Post by samidha » Mon Jun 24, 2019 12:14 pm

Hello Ashish,
Need to change SafeSquid Logo wherever it is visible to InstaSafe logo. :roll:

India samidha
Posts: 74
Joined: Wed Apr 24, 2019 6:57 am
Location: Mumbai

Re: Replacing SafeSquid Logo With Own Logo

Post by samidha » Mon Jun 24, 2019 12:14 pm

To do so, you have to make few minor changes in SafeSquid HTML files.
You can easily replace SafeSquid Logo and set your own company's logo. :lol:

We have created a small script. You should get SafeSquidLogoReplacement.sh (Script) at the bottom
You must specify your own image as a parameter and an Optional Parameter.
Additional Parameter: If you also want to change ICON of SafeSquid Title you can do so by Specifying parameter: yes, next to Image File.
To use a Different Image in Title ICON Image you can specify Parameter: Image File, next to Parameter: yes
The below Screenshots will explain you each Case Individually.

Default SafeSquid-SWG Logo and Title ICON
image.png
image.png (114.69 KiB) Viewed 2200 times

India samidha
Posts: 74
Joined: Wed Apr 24, 2019 6:57 am
Location: Mumbai

Only Change SafeSquid-Logo

Post by samidha » Mon Jun 24, 2019 12:14 pm

OPTION 1: Only Change SafeSquid-Logo
COMMAND: bash safesquidLogoReplacement.sh
image.png
image.png (31.43 KiB) Viewed 2199 times
After this,
You can then do a CTRL+F5 on your Browser [Which will do a Cache Refresh i.e. It will not fetch the SafeSquid-SWG Logo from Browser Cache]
image.png
image.png (110.2 KiB) Viewed 2199 times

India samidha
Posts: 74
Joined: Wed Apr 24, 2019 6:57 am
Location: Mumbai

Change SafeSquid Title ICON

Post by samidha » Mon Jun 24, 2019 12:15 pm

OPTION 2: Change SafeSquid Title ICON
COMMAND: bash safesquidLogoReplacement.sh instasafe-icon.png yes
image.png
image.png (7.99 KiB) Viewed 2198 times
After this,
You can then do a CTRL+F5 on your Browser [Which will do a Cache Refresh i.e. It will not fetch the SafeSquid-SWG Logo from Browser Cache]
image.png
image.png (110.83 KiB) Viewed 2198 times
Also Changing SafeSquid Title ICON

India samidha
Posts: 74
Joined: Wed Apr 24, 2019 6:57 am
Location: Mumbai

Change SafeSquid Title ICON with a Different Image

Post by samidha » Mon Jun 24, 2019 12:17 pm

OPTION 3: Change SafeSquid Title ICON with a Different Image
COMMAND: bash safesquidLogoReplacement.sh instasafe-icon.png yes InstaSafeTitleLogo.PNG
image.png
image.png (44.82 KiB) Viewed 2197 times
After this,
You can then do a CTRL+F5 on your Browser [Which will do a Cache Refresh i.e. It will not fetch the SafeSquid-SWG Logo from Browser Cache]
image.png
image.png (110.46 KiB) Viewed 2197 times

India samidha
Posts: 74
Joined: Wed Apr 24, 2019 6:57 am
Location: Mumbai

SafeSquidLogoReplacement.sh (Script)

Post by samidha » Mon Jun 24, 2019 12:18 pm

#!/bin/bash

IMAGE_FILE=${1?Error: Please Specify an Image File}
CHANGE_ICON_IMAGE=${2:-NO}
TITLE_LOGO_IMAGE=${3:-same}

## Convert the Image to BASE64 in One Line
BASE64IMAGE=$(base64 --wrap=0 ${IMAGE_FILE})

## SafeSquid Main UI ROOT Sir where all SafeSquid UI Related files are present
SAFESQUID_UI_ROOT="/usr/local/safesquid/ui_root"

SAFESQUID_BLOCK_TEMPLATE="${SAFESQUID_UI_ROOT}/templates/block_bypass.html"
SAFESQUID_UI_CSS_FILE="${SAFESQUID_UI_ROOT}/css/safesquid.css"
SAFESQUID_UI_INDEX_IMAGE_FILE="${SAFESQUID_UI_ROOT}/img/safesquid.png"

## Using sed with -i Option will also create a Backup of the Original File

####################################################################################################
REPLACE SAFESQUID BLOCK_BYPASS TEMPLATE LOGO IMAGE WITH NEW IMAGE:-> DEFAULT; ENABLED
#####################################################################################################

FIND="<img border=\"0\" class=\"image\" src=\"data:image/png;base64,.*\">"
REPLACE="<img border=\"0\" class=\"image\" src=\"data:image/png;base64,${BASE64IMAGE}\">"

sed -i.bckp "s@${FIND}@${REPLACE}@g" ${SAFESQUID_BLOCK_TEMPLATE}

####################################################################################################
REPLACE SAFESQUID UI TEMPLATE LOGO IMAGE WITH NEW IMAGE:-> DEFAULT; ENABLED
####################################################################################################

FIND="background-image:url(data:image/png;base64,.*);"
REPLACE="background-image:url(data:image/png;base64,${BASE64IMAGE});"

sed -i.bckp "s@${FIND}@${REPLACE}@g" ${SAFESQUID_UI_CSS_FILE}
echo "[+] Image Replaced, Changes Done in SafeSquid's Main UI Index File: index.html [+]"


#############################################################################################################
## REPLACE SAFESQUID BLOCK_BYPASS TEMPLATE ICON IMAGE WITH NEW IMAGE:-> DEFAULT IT IS NOT REPLACED : ENABLE IT TO REPLACE IT
##############################################################################################################

##############################################################################################################
REPLACE SAFESQUID UI ICON IMAGE WITH NEW IMAGE:-> DEFAULT; DEFAULT IT IS NOT REPLACED : ENABLE IT TO REPLACE IT
##############################################################################################################

## CONVERT OT LOWER CASE : ${CHANGE_ICON_IMAGE,,}
if [[ ${CHANGE_ICON_IMAGE,,} == "yes" ]];
then

if [[ ${TITLE_LOGO_IMAGE,,} == "same" ]];
then
echo "[+] Using the Same Image for SafeSquid-SWG Title ICON [+]"
else
echo "[+] Using the NEW Image ${TITLE_LOGO_IMAGE} for SafeSquid-SWG Title ICON [+]"
BASE64IMAGE=$(base64 --wrap=0 ${TITLE_LOGO_IMAGE})
IMAGE_FILE=${TITLE_LOGO_IMAGE}
fi

## Change SafeSquid Block Template ICON Image
FIND="<link rel=\"icon\" type=\"image/png\" href=\"data:image/png;base64,.*\/>"
REPLACE="<link rel=\"icon\" type=\"image/png\" href=\"data:image/png;base64,${BASE64IMAGE}\" \/>"

sed -i.bckp "s@${FIND}@${REPLACE}@g" ${SAFESQUID_BLOCK_TEMPLATE}
echo "[+] Changes Done in SafeSquid's BlockTemplate: block_bypass.html [+]"

## Change SafeSquid UI ICON Image
## GET CURRENT TIME
DATE_NOW=$(date +"%y%m%d_%H_%M_%S")

## Take Backup of the Current Image
cp ${SAFESQUID_UI_INDEX_IMAGE_FILE} "${SAFESQUID_UI_INDEX_IMAGE_FILE}_${DATE_NOW}.png"

## Copy the New Image Data into Old SafeSquid Image : safesquid.png : as this is already connected in safesquid's index.html file
cp ${IMAGE_FILE} ${SAFESQUID_UI_INDEX_IMAGE_FILE}
else
echo "[+] Only Logo Images are Modified, To Change SafeSquid ICON Image as well Please Speciify the Second Parameter Next to file as: yes [+]"
fi

Post Reply