# PDB PTR Downloader # # Can be adapted to work together with the built in PDB support to fetch UNC paths from debug server file.ptr files. Also a good example of how to access GlobalArea widgets. import binaryninjaui import os USER="myusername" PASS="mypassword" #change to an interactive popup for more security but be aware os.system may leave history DOMAIN="mydomain" globalArea=uicontext.context.globalArea() logWidget=globalArea.widget("Log") for child in logWidget.children(): if isinstance(child, binaryninjaui.LogListModel): if child.hasSelectedItems(): items = child.getSelectedItems() if items: lastLine = items[0].text lineSplit = lastLine.split(" -> ") if len(lineSplit) == 2: unc = lineSplit[0] pdbPath = lineSplit[1] unc = unc.replace("\\","\/") os.system(f"smbget -U {USER}%{PASS} -w {DOMAIN} -o {pdbPath} {unc}") else: log_warn("Invalid PTR log message.") else: log_info("No selected PTR log message.") else: log_info("No selected PTR log message.")