diff --git a/events.py b/events.py index 35522aa..603c031 100755 --- a/events.py +++ b/events.py @@ -1,11 +1,23 @@ #!/usr/bin/env python3 from xml.etree import ElementTree as ET +import re +import requests from common import * TARGET_IP = '172.18.51.11' -# From /html/en_EN/en_EN.js localeStrings +def getStrings(): + """Parses out the message strings from source.""" + r = requests.get('https://' + TARGET_IP + '/html/en_EN/en_EN.js', + auth=requests.auth.HTTPDigestAuth(DOOR_USERNAME, DOOR_PASSWORD), + verify=False) + regex = re.compile(r'([0-9]+)="([^"]*)') + strings = [regex.search(s) for s in r.text.split(';') + if s.startswith('localeStrings.eventDetails')] + print({int(g.group(1)): g.group(2) for g in strings}) + +# hardcoded for less bandwidth usage eventStrings = { 1022: 'Denied Access{6} Card Not Found {3}', 1023: 'Denied Access{6} Access PIN Not Found {3}',