diff --git a/Docker/annotate_header.sh b/Docker/annotate_header.sh index 383b942..e6f9b4e 100755 --- a/Docker/annotate_header.sh +++ b/Docker/annotate_header.sh @@ -12,7 +12,6 @@ get_width(){ annotate_header(){ - echo annotate $1 $2 $3 filename=$1 shift; domain=$1; @@ -85,7 +84,7 @@ annotate_header(){ convert "$filename" "$overlay_filename" -compose Darken -composite "${annotated_filename}.step.png" 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" - echo "SCREENSHOT: " + echo "{'new_file': \"${BASE_URL}/$(echo "$annotated_filename" | sed 's|/opt/||')\"}" } #annotate_header "set-cookie" "identyfikator internetowy z cookie" "Cookie" "identyfikator internetowy z cookie" diff --git a/Docker/script3.sh b/Docker/script3.sh index afb60fe..bd98b94 100755 --- a/Docker/script3.sh +++ b/Docker/script3.sh @@ -10,9 +10,11 @@ unquote(){ URL=$(unquote $(echo $INPUT | jq .url)) DOMAINS=`node array-to-lines.js "$(echo $INPUT | jq .third_party_domains)"` -source ./ephemeral-x.sh -source ./annotate_header.sh source ./utils.sh +source ./annotate_header.sh + +echo "{'current_action': 'Setting up X environment...'}" +source ./ephemeral-x.sh # (while true; do # grab_screen_to_public $ID @@ -20,6 +22,8 @@ source ./utils.sh # done) & # refresher_pid=$!; + +echo "{'current_action': 'Starting firefox...'}" start_firefox grab start_firefox prepare_firefox @@ -41,8 +45,7 @@ while IFS= read -r DOMAIN; do if [ "$DOMAIN" = "" ]; then continue fi - echo "============" - echo SCANNING DOMAIN $DOMAIN + echo "{'current_action': 'scanning for requests from $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 grab ni_search @@ -69,7 +72,7 @@ done <<< "$DOMAINS" # kill $refresher_pid; -echo "starting wait..." +echo "{'current_action': 'awaiting al background processes...'}" for PID in "${pids[@]}" do diff --git a/Docker/utils.sh b/Docker/utils.sh index 3e92da4..bdd884a 100644 --- a/Docker/utils.sh +++ b/Docker/utils.sh @@ -96,21 +96,21 @@ load_website(){ xdotool key Return grab enter sleep 1 - echo "waiting for $URL to load..." + echo "{'current_action': 'waiting for $URL to load...'}" 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 do sleep 0.5 - printf "." - scrot + #printf "." + #scrot times=$((times + 1)) if [ $times -eq 30 ] then - echo "Could not load website in time, trying anyway" + echo "{'current_action': 'website load timeout, proceeding anyway...'}" break; fi done - echo "website loaded!" + echo "{'current_action': 'website loaded'}" } open_network_inspector(){ @@ -145,3 +145,9 @@ network_inspector_next_entry(){ xdotool key Down sleep 0.2 } + +# last_message="_____" + +# measure(){ + +# } diff --git a/request.js b/request.js index 7181522..db6c79d 100644 --- a/request.js +++ b/request.js @@ -27,7 +27,9 @@ module.exports = class ScreenshotRequest { async getImages() { try { 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) { return []; }