Add firefox bloating (przedplamienie FF) #34
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"
|
||||
arek marked this conversation as resolved
Outdated
|
||||
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)"`
|
||||
|
||||
arek marked this conversation as resolved
Outdated
kuba
commented
filtrowanie domen, jak i decydowanie o tym, czy plamić firefoxa, czy nie, najlepiej przenieść do body funkcji filtrowanie domen, jak i decydowanie o tym, czy plamić firefoxa, czy nie, najlepiej przenieść do body funkcji `bloat_firefox`. Wtedy główny skrypt będzie znacznie prostszy
|
||||
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
|
||||
bloat_firefox $INPUT
|
||||
kuba
commented
`$INPUT` to jest cały JSON z różnymi parametrami dla SS. Chyba chodziło tu o przekazanie `$DOMAINS`?
arek
commented
Yup i w
Yup i w `bloater.sh` robimy:
```
DOMAINS=`node filter-requested-domains.js "$(echo $1 | jq .third_party_domains)"`
```
kuba
commented
W istocie - rzecz polega na tym, że w bloater.sh patrzymy tylko w
a w kodzie bloat_firefox:
Zmniejszymy w ten sposób ilość wołanych binarek W istocie - rzecz polega na tym, że w bloater.sh patrzymy tylko w `.third_party_domains` i odrzucamy całą resztę JSON-a. Więc możemy przekazać do tej funkcji już wyciągnięte domeny, które tworzymy sobie w linijsce 15 w `run-analysis.sh`. I wtedy wystarczy zrobić przy wywołaniu:
```sh
bloat_firefox "$DOMAINS"
```
a w kodzie bloat_firefox:
```sh
DOMAINS=`node filter-requested-domains.js "$1"`
```
Zmniejszymy w ten sposób ilość wołanych binarek
|
||||
grab bloat_firefox
|
||||
fi
|
||||
|
||||
click 1270 217 # the "trash" icon, so requests from plamienie don't appear in the screenshots
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user
(typo) blot -> bloat