Commit 1dc7a54e authored by Ivana Krumlova's avatar Ivana Krumlova Committed by Petr Špaček

tools: scripts for sorting tests

dealing with signatures using dnspython,
symlink from deckard/tools to deckard/pydnstest to import modules
consistent output format
parent f992ad98
...@@ -25,7 +25,7 @@ for TEST in "$SOURCE/"*.rpl ...@@ -25,7 +25,7 @@ for TEST in "$SOURCE/"*.rpl
do do
if ! python3 parse.py "$TEST" >/dev/null 2>/dev/null if ! python3 parse.py "$TEST" >/dev/null 2>/dev/null
then then
echo -e '\t' "$TEST" echo -e '\t' $(basename "$TEST")
mv "$TEST" "$SOURCE/parsefail" mv "$TEST" "$SOURCE/parsefail"
fi fi
done done
...@@ -34,37 +34,37 @@ done ...@@ -34,37 +34,37 @@ done
# Invalid DSA signatures (common in old testbound tests) # Invalid DSA signatures (common in old testbound tests)
echo Invalid DSA signatures: echo Invalid DSA signatures:
mkdir -p "$SOURCE/invaliddsa" mkdir -p "$SOURCE/invaliddsa"
for TEST in "$SOURCE"/*.rpl for TEST in "$SOURCE/"*.rpl
do do
if ! python3 invalid_dsa.py "$TEST" >/dev/null 2>/dev/null if ! python3 invalid_dsa.py "$TEST" >/dev/null 2>/dev/null
then then
echo -e '\t' "$TEST" echo -e '\t' $(basename "$TEST")
mv "$TEST" "$SOURCE/invaliddsa" mv "$TEST" "$SOURCE/invaliddsa"
fi fi
done done
# Working on kresd in deckard # Working on kresd in deckard
echo Working: echo Working:
mkdir -p "$SOURCE/working" mkdir -p "$SOURCE/working"
for TEST in "$SOURCE/"*.rpl for TEST in "$SOURCE/"*.rpl
do do
PATH=$(readlink -m "$TEST") if TESTS="$(readlink -m $TEST)" ./../kresd_run.sh >/dev/null 2>/dev/null
if $TESTS="$PATH" ./../kresd_run.sh >/dev/null 2>/dev/null
then then
echo -e '\t' "$TEST" echo -e '\t' $(basename "$TEST")
mv "$TEST" "$SOURCE/working" mv "$TEST" "$SOURCE/working"
fi fi
done done
# Others
# Others TODO: sem nic nepadá a to je divný, asi chyba, neviem
echo Others: echo Others:
mkdir -p "$SOURCE/others" mkdir -p "$SOURCE/others"
for test in "$SOURCE/*.rpl" for TEST in "$SOURCE/"*.rpl
do do
echo -e '\t' "$TEST" echo -e '\t' $(basename "$TEST")
mv "$TEST" "$SOURCE/others" mv "$TEST" "$SOURCE/others"
done done
...@@ -4,9 +4,8 @@ ...@@ -4,9 +4,8 @@
import os import os
import sys import sys
import base64
import argparse import argparse
# sys.path.insert(0, '..') import dns
import pydnstest import pydnstest
import pydnstest.scenario import pydnstest.scenario
import pydnstest.augwrap import pydnstest.augwrap
...@@ -57,9 +56,11 @@ def check_rrsig(node, dsakeys): ...@@ -57,9 +56,11 @@ def check_rrsig(node, dsakeys):
for record in records: for record in records:
if record["/type"].value == "RRSIG": if record["/type"].value == "RRSIG":
rrsig_data = record["/data"].value.split() rrset = dns.rrset.from_text(record["/domain"].value, 300,
if rrsig_data[6] == key: 1, dns.rdatatype.RRSIG,
if len(base64.b64decode(rrsig_data[8])) != 41: record["/data"].value)
if rrset.items[0].key_tag == int(key):
if len(rrset.items[0].signature) != 41:
return True return True
return False return False
...@@ -74,10 +75,8 @@ def main(): ...@@ -74,10 +75,8 @@ def main():
dsakeys = get_dsakeys(config, node) dsakeys = get_dsakeys(config, node)
bad_rrsig = check_rrsig(node, dsakeys) bad_rrsig = check_rrsig(node, dsakeys)
if bad_rrsig: if bad_rrsig:
print(1)
sys.exit(1) sys.exit(1)
else: else:
print(0)
sys.exit(0) sys.exit(0)
main() main()
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
import sys import sys
import os import os
import argparse import argparse
# sys.path.insert(0, '..')
import pydnstest import pydnstest
import pydnstest.scenario import pydnstest.scenario
......
/home/fitli/CZNIC/deckard/deckard/pydnstest/
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment