summaryrefslogtreecommitdiff
path: root/pairing.py
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2018-11-14 22:47:04 +0900
committerjaseg <git@jaseg.net>2018-11-14 22:47:04 +0900
commiteb481f1cda0a6eae1aa0486acb637f985cddcc2f (patch)
treec6082d8d5e8809e7d590b4f5d0e9d2de2700451b /pairing.py
parent66f9e82c5ca313fb90edff6a9d1956c02c973934 (diff)
downloadsecure-hid-eb481f1cda0a6eae1aa0486acb637f985cddcc2f.tar.gz
secure-hid-eb481f1cda0a6eae1aa0486acb637f985cddcc2f.tar.bz2
secure-hid-eb481f1cda0a6eae1aa0486acb637f985cddcc2f.zip
known device/sram data persistence working
Diffstat (limited to 'pairing.py')
-rwxr-xr-xpairing.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pairing.py b/pairing.py
index 840e0bc..ce50081 100755
--- a/pairing.py
+++ b/pairing.py
@@ -3,6 +3,7 @@ import threading
import binascii
import re
import os
+import time
import serial
import gi
@@ -136,11 +137,11 @@ def run_pairing_gui(port, baudrate, debug=False):
raise SystemError('Unknown noise error')
with open(known_devices_file, 'a') as f:
- f.write(noise.remote_fingerprint)
+ f.write(f'{noise.remote_fingerprint} # added {time.ctime()}\n')
else:
with open(known_devices_file) as f:
- known_devices = [ l.strip() for l in f.readlines() if not l[0] == '#' ]
+ known_devices = [ l.strip().partition('#')[0].strip() for l in f.readlines() if not l[0] == '#' ]
if noise.remote_fingerprint not in known_devices:
raise ValueError('Remote host is untrusted but seems to trust us.')