events: Add an unused function to parse message strings from source
This commit is contained in:
parent
db774e2f73
commit
8eb4d2035e
14
events.py
14
events.py
@ -1,11 +1,23 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
from xml.etree import ElementTree as ET
|
from xml.etree import ElementTree as ET
|
||||||
|
import re
|
||||||
|
import requests
|
||||||
|
|
||||||
from common import *
|
from common import *
|
||||||
|
|
||||||
TARGET_IP = '172.18.51.11'
|
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 = {
|
eventStrings = {
|
||||||
1022: 'Denied Access{6} Card Not Found {3}',
|
1022: 'Denied Access{6} Card Not Found {3}',
|
||||||
1023: 'Denied Access{6} Access PIN Not Found {3}',
|
1023: 'Denied Access{6} Access PIN Not Found {3}',
|
||||||
|
Reference in New Issue
Block a user