# -*- coding: utf-8 -*- import xml.etree.ElementTree as ET import re import sys path = sys.argv[1] if len(sys.argv) > 1 else r"reverse/dumps/ui_login_now.xml" root = ET.parse(path).getroot() for n in root.iter("node"): rid = n.attrib.get("resource-id", "") text = n.attrib.get("text", "") desc = n.attrib.get("content-desc", "") click = n.attrib.get("clickable") bounds = n.attrib.get("bounds") blob = (rid + " " + text + " " + desc).lower() if any(k in blob for k in ("country", "ll_country", "+60", "calling", "flag")): print("HIT", rid, repr(text), repr(desc), click, bounds) if text and (("+" in text[:3]) or text.strip() in ("PIN",) or "Malaysia" in text): print("TEXT", repr(text), bounds, click, rid) # print clickable centers for ll_country for n in root.iter("node"): rid = n.attrib.get("resource-id", "") if "ll_country" in rid and n.attrib.get("clickable") == "true": m = re.match(r"\[(\d+),(\d+)\]\[(\d+),(\d+)\]", n.attrib.get("bounds", "")) if m: x1, y1, x2, y2 = map(int, m.groups()) print("TAP", (x1 + x2) // 2, (y1 + y2) // 2, rid)