CR
This commit is contained in:
parent
33de898d1d
commit
40b55dcac4
35
Docker/bloater.sh
Executable file
35
Docker/bloater.sh
Executable file
@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
BLOATING_DOMAINS=$(cat bloating-domains.txt)
|
||||
|
||||
bloat_firefox(){
|
||||
if [ "$#" = 0 ]; then
|
||||
echo "Bloating Firefox by bloating defined domain list..."
|
||||
DOMAINS=$(printf '%s\n' "${BLOATING_DOMAINS[@]}")
|
||||
else
|
||||
echo "Bloating Firefox by requested domain list..."
|
||||
DOMAINS=`node filter-requested-domains.js "$(echo $1 | jq .third_party_domains)"`
|
||||
echo "selected domains"
|
||||
echo $DOMAINS
|
||||
fi
|
||||
|
||||
if [ -n "$DOMAINS" ]; then
|
||||
while IFS= read -r DOMAIN; do
|
||||
# these domains return a 404 anyways, no need to waste time on them:
|
||||
if is_http_error "$DOMAIN"; then echo "skipping $DOMAIN"; continue; fi
|
||||
load_website "$DOMAIN?hl=pl" "$DOMAIN"
|
||||
sleep 1 # sometimes the consent popup needs a little time
|
||||
open_console
|
||||
grab "$DOMAIN before"
|
||||
(tr '\n' ' ' < click-accept-all.js) | xclip -sel clip
|
||||
keycombo Control_L v
|
||||
sleep 0.3
|
||||
xdotool key Return
|
||||
sleep 1.5
|
||||
grab "$DOMAIN after"
|
||||
done <<< "$DOMAINS"
|
||||
else
|
||||
echo "No need to blot"
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -1,32 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
BLOATING_DOMAINS=$(while IFS= read -r line; do echo "$line"
|
||||
done <bloating-domains.txt)
|
||||
|
||||
# $1 → 0 (mode bloating domains), → 1 (mode requested domains)
|
||||
bloat_firefox(){
|
||||
if [ "$1" = 0 ]; then
|
||||
echo "Bloating Firefox by bloating defined domain list..."
|
||||
DOMAINS=$(printf '%s\n' "${BLOATING_DOMAINS[@]}")
|
||||
else
|
||||
echo "Bloating Firefox by requested domain list..."
|
||||
DOMAINS=$FILTERED_DOMAINS
|
||||
fi
|
||||
|
||||
while IFS= read -r DOMAIN; do
|
||||
# these domains return a 404 anyways, no need to waste time on them:
|
||||
if is_http_error "$DOMAIN"; then echo "skipping $DOMAIN"; continue; fi
|
||||
load_website "$DOMAIN?hl=pl" "$DOMAIN"
|
||||
sleep 1 # sometimes the consent popup needs a little time
|
||||
open_console
|
||||
grab "$DOMAIN before"
|
||||
(tr '\n' ' ' < click-accept-all.js) | xclip -sel clip
|
||||
keycombo Control_L v
|
||||
sleep 0.3
|
||||
xdotool key Return
|
||||
sleep 1.5
|
||||
grab "$DOMAIN after"
|
||||
done <<< "$DOMAINS"
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
source ./ephemeral-x.sh
|
||||
source ./annotate_header.sh
|
||||
source ./utils.sh
|
||||
source ./bloatter.sh
|
||||
source ./bloater.sh
|
||||
|
||||
echo "{\"current_action\": \"Uruchamianie serwera X\"}"
|
||||
|
||||
@ -12,7 +12,7 @@ start_firefox
|
||||
grab start_firefox
|
||||
prepare_firefox
|
||||
grab prepare_firefox
|
||||
bloat_firefox 0
|
||||
bloat_firefox
|
||||
grab bloat_firefox
|
||||
|
||||
echo "{\"current_action\": \"Oczekiwanie na URL do analizy...\", \"code\": \"ready\"}"
|
||||
|
@ -13,10 +13,9 @@ echo $INPUT
|
||||
|
||||
URL=$(unquote $(echo $INPUT | jq .url))
|
||||
DOMAINS=`node array-to-lines.js "$(echo $INPUT | jq .third_party_domains)"`
|
||||
FILTERED_DOMAINS=`node filter-requested-domains.js "$(echo $INPUT | jq .third_party_domains)"`
|
||||
|
||||
source ./utils.sh
|
||||
source ./bloatter.sh
|
||||
source ./bloater.sh
|
||||
|
||||
PREVIEW="TRUE" # set to "TRUE" in order to enable automatic screenshots kept in preview.png
|
||||
|
||||
@ -31,13 +30,8 @@ fi
|
||||
|
||||
ORIGIN_DOMAIN=$(sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/' <<< "$URL")
|
||||
|
||||
if [ -z "$FILTERED_DOMAINS" ]
|
||||
then
|
||||
echo "No need to blot"
|
||||
else
|
||||
bloat_firefox 1
|
||||
grab bloat_firefox
|
||||
fi
|
||||
bloat_firefox $INPUT
|
||||
grab bloat_firefox
|
||||
|
||||
click 1270 217 # the "trash" icon, so requests from plamienie don't appear in the screenshots
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user