Simple highlight of the set-cookies header.

Next thing to do would be to annotate it with some human-readable
comment ("here personal ID is sent")  and an arrow, and allow to pick
any header
This commit is contained in:
Kuba Orlik 2022-03-06 22:37:08 +01:00
parent 1c17243856
commit c1a2ff6200
2 changed files with 25 additions and 14 deletions

7
get-text-position.py Normal file → Executable file
View File

@ -1,7 +1,10 @@
#!/usr/bin/python
import sys
import pytesseract
from pytesseract import Output
# from PIL import Image
img = 'cropped.png'
img = sys.argv[1]
d = pytesseract.image_to_data(img, output_type=Output.DICT)
# print(d)
@ -10,6 +13,6 @@ for i in range(n_boxes):
(x, y, w, h, text) = (d['left'][i], d['top'][i], d['width'][i], d['height'][i], d['text'][i])
if text=="":
continue
print(x, y, repr(text))
print(x, y, w, h, text)

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -x
source ./ephemeral-x.sh
@ -51,15 +51,23 @@ keycombo(){
annotate_header(){
header=$1
d=$(date "+%Y-%m-%d__%H_%M_%S")
filename="$d__$header.png"
cropped_filename="$filename__cropped.png"
filename="${d}__$header.png"
cropped_filename="${filename}__cropped.png"
left=2056
top=330
width=824
height=1260
scrot $filename
vips extract_area "$filename" "$cropped_filename" $left $top $width $height
echo "cropped image"
coords=$(python ./get-text-position.py "$cropped_filename" | grep set-cookie | awk '{print $1 " " $2 " " $3 " " $4}')
rect_x1=$(echo "$coords" | awk '{print $1}')
rect_y1=$(echo "$coords" | awk '{print $2}')
rect_w=$(echo "$coords" | awk '{print $3}')
rect_h=$(echo "$coords" | awk '{print $4}')
rect_x2=$((rect_x1 + rect_w))
rect_y2=$((rect_y1 + rect_h))
annotated_filename="${cropped_filename}__annotated.png"
convert "$cropped_filename" -fill transparent -stroke red -draw "rectangle $rect_x1,$rect_y1 $rect_x2,$rect_y2" "$annotated_filename"
}
@ -80,7 +88,7 @@ sleep 1
# click 1424 628
grab before maximize
# grab before maximize
click 1886 13 #maximize button
@ -92,29 +100,29 @@ sleep 1
#sleep 1
grab before escape
# grab before escape
xdotool key Escape
#xdotool key Escape
sleep 0.1
grab after escape
# grab after escape
keycombo Control_L Shift_L e
xdotool key Escape
#xdotool key Escape
keycombo Shift_L c F5 #profiler
keycombo Control_L Shift_L e
grab after control shift e before ctrl L
# grab after control shift e before ctrl L
keycombo Control_L l
grab after control L
# grab after control L
xdotool type "biedronka.pl"
xdotool key Return
grab after return
# grab after return
sleep 1