Skip to content

Commit b308998

Browse files
authored
Merge pull request #33 from x676f64/master
Fixes parsing issue with multi-line values
2 parents bde3ce2 + a988d04 commit b308998

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

enum4linux-ng.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,18 +1851,26 @@ def get_details_from_rid(self, rid, name):
18511851
match = re.search("([^\n]*User Name.*logon_hrs[^\n]*)", result.retmsg, re.DOTALL)
18521852
if match:
18531853
user_info = match.group(1)
1854-
user_info = user_info.replace("\t", "")
1854+
1855+
regexMatch = r'^\t[A-Za-z][A-Za-z\s_\.0-9]*(:|\[[0-9\.]+\]\.\.\.)(\t|\s)?'
18551856

18561857
for line in filter(None, user_info.split('\n')):
1857-
if ':' in line:
1858-
(key, value) = line.split(":", 1)
1859-
key = key.rstrip()
1860-
# Skip user and full name, we have this information already
1858+
if re.match(regexMatch, line):
1859+
if ":" in line:
1860+
key, value = line.split(":", 1)
1861+
if "..." in line:
1862+
key, value = line.split("...", 1)
1863+
18611864
if "User Name" in key or "Full Name" in key:
18621865
continue
1866+
key = key.strip()
1867+
value = value.strip()
18631868
details[key] = value
18641869
else:
1865-
details[line] = ""
1870+
if key not in details:
1871+
details[key] = line
1872+
else:
1873+
details[key] += "\n" + line
18661874

18671875
if "acb_info" in details and valid_hex(details["acb_info"]):
18681876
for key in ACB_DICT:

0 commit comments

Comments
 (0)