GUI Control
User interface control is partially implemented at this point. There exists the ability to trigger a refresh and populate a reference view.
Example: Populate a Reference View
"""
Example: Populate Reference View (32/64 bit)
"""
import sys
from x64dbg_automate import X64DbgClient
from x64dbg_automate.models import ReferenceViewRef
if len(sys.argv) != 2:
print("Usage: python sessions.py <x64dbg_path>")
quit(1)
client = X64DbgClient(x64dbg_path=sys.argv[1])
client.start_session(r'c:\Windows\system32\winver.exe')
print('[+] Creating a reference view')
client.gui_show_reference_view(
'Example Reference View', [
ReferenceViewRef(
address=client.eval_sync('cip')[0],
text='Example Reference 1: "Current Instruction Pointer"'
),
ReferenceViewRef(
address=client.eval_sync('IsDebuggerPresent')[0],
text='Example Reference 2: "IsDebuggerPresent"'
)
]
)
print('[+] Cleaning up')
client.detach_session()
API Method Reference
gui_refresh_views()
Refreshes the GUI views of x64dbg
Returns:
Type | Description |
---|---|
bool
|
Success |
Source code in x64dbg_automate/commands_xauto.py
def gui_refresh_views(self) -> bool:
"""
Refreshes the GUI views of x64dbg
Returns:
Success
"""
return self._send_request(XAutoCommand.XAUTO_REQ_GUI_REFRESH_VIEWS)
gui_show_reference_view(name, refs)
Shows a reference view populated with refs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
refs
|
list[ReferenceViewRef]
|
A list of addresses and text to display in the reference view |
required |
Returns:
Type | Description |
---|---|
bool
|
Success |
Source code in x64dbg_automate/hla_xauto.py
def gui_show_reference_view(self, name: str, refs: list[ReferenceViewRef]) -> bool:
"""
Shows a reference view populated with refs.
Args:
refs: A list of addresses and text to display in the reference view
Returns:
Success
"""
name = name.replace('"', '\\"')
if not self.cmd_sync(f'refinit "{name}"'):
return False
for ref in refs:
text = ref.text.replace('"', '\\"')
if not self.cmd_sync(f'refadd 0x{ref.address:x}, "{text}"'):
return False
API Model Reference
ReferenceViewRef
Source code in x64dbg_automate/models.py
class ReferenceViewRef(BaseModel):
address: int
text: str