summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2024-11-03 17:26:18 +0100
committerErich Eckner <git@eckner.net>2024-11-03 17:26:18 +0100
commitee81290b554255c71f670c199aa07707e9fca0d8 (patch)
tree833bbf28ba0f1e3b85cb81646dc5b9dbc91a1e26
parent55f1535ade21a4f313ef39fd403025e1bc0f5178 (diff)
downloadykverify-ee81290b554255c71f670c199aa07707e9fca0d8.tar.xz
now with dynamic challenge
-rwxr-xr-xverify.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/verify.py b/verify.py
index d410f67..25e3c42 100755
--- a/verify.py
+++ b/verify.py
@@ -4,15 +4,20 @@ import binascii
import codecs
import hashlib
import hmac
+import random
+import string
import subprocess
import sys
ssh = b'840fedcacdb9e86f1ae1e6a0060de471d4f5fb35'
ss = codecs.decode(ssh, 'hex')
-actual = subprocess.check_output(['ykchalresp', '-2', 'deadbeef']).strip().decode()
+chh = ''.join(random.choice('0123456789abcdef') for i in range(126))
+ch = codecs.decode(chh, 'hex')
-expected = hmac.new(ss, b'deadbeef', hashlib.sha1).hexdigest()
+actual = subprocess.check_output(['ykchalresp', '-2', '-x', chh]).strip().decode()
+
+expected = hmac.new(ss, ch, hashlib.sha1).hexdigest()
if actual == expected:
sys.exit(0)