Running HyperDbg Script

Using command-line features

There are two ways to run batch-script like commands in HyperDbg.

First, we can save our command(s) in a file and then use the .script command, and the second way is to pass the --script argument to the hyperdbg-cli.exe.

For example, let's assume that we saved the following lines in c:\users\sina\desktop\script.txt.

.connect local
.logopen c:\users\sina\desktop\result.txt
load
!syscall script { print(@rax); }
sleep 100000
unload
.logclose
exit

Now, if we run HyperDbg, then we can .script command like this :

HyperDbg> .script c:\users\sina\desktop\script.txt

The second case is when we want to run our script from the command-line directly; then you can run the hyperdbg-cli.exe like this :

Microsoft Windows [Version 10.0.18362.900]
(c) 2019 Microsoft Corporation. All rights reserved.
‚Äč
C:\Users\sina\Desktop\HyperDbg>hyperdbg-cli.exe --script c:\users\sina\desktop\script.txt

With these two ways, we can automate our scripts in HyperDbg.