Fuller image URLs. JSON-based stdout for docker script

This commit is contained in:
Kuba Orlik 2022-05-25 20:10:44 +02:00
parent fd1373be9c
commit 25cee9bc8b
4 changed files with 23 additions and 13 deletions

View File

@ -12,7 +12,6 @@ get_width(){
annotate_header(){ annotate_header(){
echo annotate $1 $2 $3
filename=$1 filename=$1
shift; shift;
domain=$1; domain=$1;
@ -85,7 +84,7 @@ annotate_header(){
convert "$filename" "$overlay_filename" -compose Darken -composite "${annotated_filename}.step.png" convert "$filename" "$overlay_filename" -compose Darken -composite "${annotated_filename}.step.png"
convert "${annotated_filename}.step.png" "$hardoverlay_filename" -compose src-over -composite "$annotated_filename" convert "${annotated_filename}.step.png" "$hardoverlay_filename" -compose src-over -composite "$annotated_filename"
rm "$overlay_filename" "$annotated_filename.step.png" "$hardoverlay_filename" "$cropped_filename" "$filename" rm "$overlay_filename" "$annotated_filename.step.png" "$hardoverlay_filename" "$cropped_filename" "$filename"
echo "SCREENSHOT: <img width=\"720\" height=\"405\" src=\"${BASE_URL}/$(echo "$annotated_filename" | sed 's|/opt/||')\"/>" echo "{'new_file': \"${BASE_URL}/$(echo "$annotated_filename" | sed 's|/opt/||')\"}"
} }
#annotate_header "set-cookie" "identyfikator internetowy z cookie" "Cookie" "identyfikator internetowy z cookie" #annotate_header "set-cookie" "identyfikator internetowy z cookie" "Cookie" "identyfikator internetowy z cookie"

View File

@ -10,9 +10,11 @@ unquote(){
URL=$(unquote $(echo $INPUT | jq .url)) URL=$(unquote $(echo $INPUT | jq .url))
DOMAINS=`node array-to-lines.js "$(echo $INPUT | jq .third_party_domains)"` DOMAINS=`node array-to-lines.js "$(echo $INPUT | jq .third_party_domains)"`
source ./ephemeral-x.sh
source ./annotate_header.sh
source ./utils.sh source ./utils.sh
source ./annotate_header.sh
echo "{'current_action': 'Setting up X environment...'}"
source ./ephemeral-x.sh
# (while true; do # (while true; do
# grab_screen_to_public $ID # grab_screen_to_public $ID
@ -20,6 +22,8 @@ source ./utils.sh
# done) & # done) &
# refresher_pid=$!; # refresher_pid=$!;
echo "{'current_action': 'Starting firefox...'}"
start_firefox start_firefox
grab start_firefox grab start_firefox
prepare_firefox prepare_firefox
@ -41,8 +45,7 @@ while IFS= read -r DOMAIN; do
if [ "$DOMAIN" = "" ]; then if [ "$DOMAIN" = "" ]; then
continue continue
fi fi
echo "============" echo "{'current_action': 'scanning for requests from $DOMAIN...'}"
echo SCANNING DOMAIN $DOMAIN
network_inspector_search "domain:$DOMAIN" # can filter with more granularity: https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor/request_list#filtering_by_properties network_inspector_search "domain:$DOMAIN" # can filter with more granularity: https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor/request_list#filtering_by_properties
grab ni_search grab ni_search
@ -69,7 +72,7 @@ done <<< "$DOMAINS"
# kill $refresher_pid; # kill $refresher_pid;
echo "starting wait..." echo "{'current_action': 'awaiting al background processes...'}"
for PID in "${pids[@]}" for PID in "${pids[@]}"
do do

View File

@ -96,21 +96,21 @@ load_website(){
xdotool key Return xdotool key Return
grab enter grab enter
sleep 1 sleep 1
echo "waiting for $URL to load..." echo "{'current_action': 'waiting for $URL to load...'}"
times=0 times=0
while [ $(get_pixel_color 143 122) = "2E3436" ] # the center of the X icon that becomes a "refresh" icon once the website is finished loading while [ $(get_pixel_color 143 122) = "2E3436" ] # the center of the X icon that becomes a "refresh" icon once the website is finished loading
do do
sleep 0.5 sleep 0.5
printf "." #printf "."
scrot #scrot
times=$((times + 1)) times=$((times + 1))
if [ $times -eq 30 ] if [ $times -eq 30 ]
then then
echo "Could not load website in time, trying anyway" echo "{'current_action': 'website load timeout, proceeding anyway...'}"
break; break;
fi fi
done done
echo "website loaded!" echo "{'current_action': 'website loaded'}"
} }
open_network_inspector(){ open_network_inspector(){
@ -145,3 +145,9 @@ network_inspector_next_entry(){
xdotool key Down xdotool key Down
sleep 0.2 sleep 0.2
} }
# last_message="_____"
# measure(){
# }

View File

@ -27,7 +27,9 @@ module.exports = class ScreenshotRequest {
async getImages() { async getImages() {
try { try {
const files = await fs.readdir(resolve(__dirname, "./static/" + this.id)); const files = await fs.readdir(resolve(__dirname, "./static/" + this.id));
return files.filter((file) => file.match(/.final.png$/)); return files
.filter((file) => file.match(/.final.png$/))
.map((file) => `/static/${this.id}/${file}`);
} catch (e) { } catch (e) {
return []; return [];
} }