# Connecting To HyperDbg

This article only describes the **Debugger Mode** of the HyperDbg in the VMware Workstation Player (free for non-commercial use) and Pro.

You might want to :

* [Attach to a local machine](https://docs.hyperdbg.org/getting-started/attach-to-hyperdbg/local-debugging)
* [Connect to a physical machine](https://docs.hyperdbg.org/getting-started/attach-to-hyperdbg/debug#physical-machine)
* [Connect to VMI Mode](https://docs.hyperdbg.org/getting-started/attach-to-hyperdbg/debug#connect-to-debuggee-vmi-mode)

In order to run HyperDbg on a VMware Workstation machine, first, turn off your guest machine then, you need to enable **Nested Virtualization**. Open your virtual machine and click on Edit **virtual machine settings**.

![Editing VM Settings](https://1255335821-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2wWz6ePF27bvsJcWed%2Fuploads%2Fgit-blob-4f9335cb5439bfda0ff7287ee5e1e2be36a342ed%2Fvmware-debug1.png?alt=media)

After that, click on **Virtualize Intel VT-x/EPT or AMD-V/RVI** and **Virtualize IOMMU (IO memory management unit)**.

![Enabling Nested-Virtualization](https://1255335821-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2wWz6ePF27bvsJcWed%2Fuploads%2Fgit-blob-05177e2287549e4a43f2992accb064e4f72f02db%2Fvmware-debug2.png?alt=media)

Next, click on **Add...** then choose **Serial Port** and click on **Finish**.

![Adding a serial device](https://1255335821-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2wWz6ePF27bvsJcWed%2Fuploads%2Fgit-blob-f0b28c31711173d709a017c4e08efb980cf56977%2Fvmware-debug3.png?alt=media)

Now, click on **Use named pipe:** and add a name for your named pipe.

Your name should start with `\\.\pipe\` . For example, choose `\\.\pipe\HyperDbgDebug`.

Make sure to enable **Yield CPU on poll**.

![Change serial device configuration](https://1255335821-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2wWz6ePF27bvsJcWed%2Fuploads%2Fgit-blob-6a881926728d2c010d47900887d56f0311779c92%2Fvmware-debug4.png?alt=media)

Now it's time to create a kernel debug connection. First of all, run the following command on the host (debugger). You should change the named pipe address to whatever name you chose on the previous part.

```
HyperDbg> .debug remote namedpipe \\.\pipe\HyperDbgPipe
```

![Waiting for a remote connection (Host)](https://1255335821-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2wWz6ePF27bvsJcWed%2Fuploads%2Fgit-blob-5d4c822aacc1b64a61bee18d0c0b62c7cfbc01e1%2Fwait-on-namedpipe.png?alt=media)

After you tell the debugger to listen on a COM port or a named pipe, now you can run the following command in the debuggee (guest).

```
HyperDbg> .debug prepare serial 115200 com2
```

![Preparing to connect debugger (Guest)](https://1255335821-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2wWz6ePF27bvsJcWed%2Fuploads%2Fgit-blob-0ff98d8d727c825c42b5c0a86454e97af0e4a79d%2Fprepare-to-connect-to-debugger.png?alt=media)

Most of the time, if the serial port is the only serial device that you add to the virtual machine, then the name of the connected port is `com2`. However, you can see the exact name of the COM port on the guest's device manager.

After running the above command in guest, now you should see that the debuggee is connected to the debugger.

{% hint style="info" %}
If you see an error for driver signature enforcement, please visit [here](https://docs.hyperdbg.org/using-hyperdbg/kernel-mode-debugging/examples/beginning/connecting-to-hyperdbg#driver-signature-enforcement-error).
{% endhint %}

You can press **CTRL+C** to pause the debuggee and step through the kernel codes using the ['p' command](https://docs.hyperdbg.org/commands/debugging-commands/p) and the ['t' command](https://docs.hyperdbg.org/commands/debugging-commands/t), and if you want to continue the normal execution of the debuggee, you can use the ['g' command](https://docs.hyperdbg.org/commands/debugging-commands/g).

![Step and Continue Debuggee](https://1255335821-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2wWz6ePF27bvsJcWed%2Fuploads%2Fgit-blob-d43d2447f54a44b0e69764425bb613a4c39195cb%2Fconnected-to-debuggee.png?alt=media)

## Driver Signature Enforcement Error

If you are using an unsigned version of HyperDbg driver, you should turn off the **Driver Signature Enforcement**.

![Driver Signature Enforcement Error](https://1255335821-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M2wWz6ePF27bvsJcWed%2Fuploads%2Fgit-blob-d9da50ad7440ca5be4ea6adb62ebfa06ba272e37%2Fdriver-signature-enforcement-error.png?alt=media)

For disabling Driver Signature Enforcement, you can visit [here](https://docs.hyperdbg.org/getting-started/build-and-install#disable-driver-signature-enforcement).
