Skip to content
Snippets Groups Projects
Commit 04eacb98 authored by Peter van der Velde's avatar Peter van der Velde
Browse files

Added task 1a

parent 6885bccb
No related branches found
No related tags found
No related merge requests found
......@@ -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).
......
t1a.sh 0 → 100644
#!/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
......@@ -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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment