diff --git a/README.md b/README.md index 08880f95baebc5ac3903f2c5b0727c29ca8be1cb..33fdc0d8d2bf10676de8885caff0fb0aeb869e0e 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ A few programs are needed before the installation and use of the python scripts. ``` 2. Install all required libraries ```sh - python3 -m pi3p install --user -r requirements.txt + python3 -m pip./ install --user -r requirements.txt ``` ### Run Program For more information run the program with the help flag (-h or --help). diff --git a/t1a.sh b/t1a.sh new file mode 100644 index 0000000000000000000000000000000000000000..bf10df61a9f6f9b6b3e89d10839ce2e8339a55f3 --- /dev/null +++ b/t1a.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +if [ $# != 2 ] +then + echo "./t1a.sh avrofile1 avrofile2" +fi + +# Gather the number of total domains per TLD +echo Gather the number of total domains per TLD +avrocat "$1" | jq -r '.query_name' | rev | cut -d '.' -f2 | rev | sort | uniq -c | awk '$1 >= 100 {print $1,$2}' > "${1##*/}"_TLD_total_domains +avrocat "$2" | jq -r '.query_name' | rev | cut -d '.' -f2 | rev | sort | uniq -c | awk '$1 >= 100 {print $1,$2}' > "${2##*/}"_TLD_total_domains + +cat "${1##*/}"_TLD_total_domains "${1##*/}"_TLD_total_domains > TLD_total_domains + + +# Get all signed domains +echo Get all signed domains +avrocat "$1" | jq -r 'select(.rrsig_signature != null) | .query_name' | sort | uniq > "${1##*/}"_signed_domains +avrocat "$2" | jq -r 'select(.rrsig_signature != null) | .query_name' | sort | uniq > "${2##*/}"_signed_domains + +echo Get all domains +avrocat "$1" | jq -r '.query_name' | sort | uniq -c | awk '{print $2,$1}' > "${1##*/}"_all_domains +avrocat "$2" | jq -r '.query_name' | sort | uniq -c | awk '{print $2,$1}' > "${2##*/}"_all_domains + +echo join all domains with the signed ones +join "${1##*/}"_all_domains "${1##*/}"_signed_domains > "${1##*/}"_all_signed_domains +join "${2##*/}"_all_domains "${2##*/}"_signed_domains > "${2##*/}"_all_signed_domains + +cat "${1##*/}"_all_signed_domains "${2##*/}"_all_signed_domains > all_signed_domains + + +echo "reduce to only the TLD" +rm TLD_total_signed_domains_u +touch TLD_total_signed_domains_u +while read -r key value; do + echo "$(echo $key | rev | cut -d '.' -f2 | rev) $value" >> TLD_total_signed_domains_u +done < all_signed_domains + +awk '{ seen[$1] += $2 } END { for (i in seen) print i, seen[i] }' TLD_total_signed_domains_u | sort > TLD_total_domains_signed +rm TLD_total_signed_domains_u +join TLD_total_domains TLD_total_domains_signed | awk 'OFS="," {print $1,($3/$2*100) }' | sort -r -t ',' -k 2 > TLD_signed_perc.csv + + diff --git a/week5-assignment-spki.py b/week5-assignment-spki.py index fe915a5497564bf90bcfa176d4987baa7245d31d..21229d2a4d55bb13e4be22a93c810f1d6f9bf984 100755 --- a/week5-assignment-spki.py +++ b/week5-assignment-spki.py @@ -16,3 +16,4 @@ cert.decode(der) tbsCertificate = DerSequence() tbsCertificate.decode(cert[0]) subjectPublicKeyInfo = tbsCertificate[6] +cat t.txt | rev | cut -d '.' -f2 | rev | sort | uniq -c | awk '$1 >= 100 {print$2}' | xargs