mirror of
https://github.com/mvt-project/mvt.git
synced 2024-06-28 15:18:55 +00:00
27 lines
636 B
Python
27 lines
636 B
Python
# Mobile Verification Toolkit (MVT)
|
|
# Copyright (c) 2021-2022 Claudio Guarnieri.
|
|
# Use of this software is governed by the MVT License 1.1 that can be found at
|
|
# https://license.mvt.re/1.1/
|
|
|
|
import re
|
|
|
|
|
|
def parse_getprop(output: str) -> dict:
|
|
results = {}
|
|
rxp = re.compile(r"\[(.+?)\]: \[(.+?)\]")
|
|
|
|
for line in output.splitlines():
|
|
line = line.strip()
|
|
if line == "":
|
|
continue
|
|
|
|
matches = re.findall(rxp, line)
|
|
if not matches or len(matches[0]) != 2:
|
|
continue
|
|
|
|
key = matches[0][0]
|
|
value = matches[0][1]
|
|
results[key] = value
|
|
|
|
return results
|