aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2017-01-14 17:08:45 +0100
committerPetter Reinholdtsen <pere@hungry.com>2017-01-14 17:08:45 +0100
commitff476902f0209401d3cd530a8526d2c5a85c6141 (patch)
tree26531cc98725504a4e0f7041291526c677a583e4
parentb2b53a467e720cbf1f09c0dedc81afbed5389178 (diff)
Generate KML files when scanning web sites.
-rwxr-xr-xruncheck7
1 files changed, 6 insertions, 1 deletions
diff --git a/runcheck b/runcheck
index 2a8e2d9..d8095dd 100755
--- a/runcheck
+++ b/runcheck
@@ -11,18 +11,23 @@ if [ "$1" ] ; then
fi
if [ ! -d har-data ]; then mkdir har-data ; fi
+if [ ! -d kml-data ]; then mkdir kml-data ; fi
cat $file | while read url ; do
case "$url" in
http*)
# Save with URL as filename, replacing / with % and dropping trailing slash.
filename=$(echo "$url" | sed 's%/$%%' |tr / %)
harfile="har-data/$filename.har"
+ kmlfile="kml-data/$filename.kml"
if [ ! -e "$harfile" ] ; then
echo "testing $url"
if phantomjs --ssl-protocol any $basedir/netsniff.js "$url" > "$harfile.new" &&
- [ -s "$harfile.new" ]; then
+ [ -s "$harfile.new" ] &&
+ [ "$(jq -r '.log | .entries | map(.request) | map(.url) | join("\n")' $harfile.new)" ]; then
mv "$harfile.new" "$harfile"
+ $basedir/har2kml "$harfile" > $kmlfile
else
+ echo "error: unable to handle $url"
if ! rm "$harfile.new" ; then
echo "error: unable to remove $harfile.new"
fi