> For the complete documentation index, see [llms.txt](https://www.impacket.wiki/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.impacket.wiki/reference/common-syntax-and-flags.md).

# Common Syntax & Flags

Most of the exmaple scripts a small set of conventions. Once you learn the standard arguments then cheat sheets eventually become obselete.

## Target Syntax

The usual target form is:

```
[[domain/]username[:password]@]<target>
```

The target can be a hostname, FQDN, or IP address depending on the protocol and name-resolution requirements.

```bash
python examples/smbclient.py CONTOSO/alice:'Passw0rd!'@files01
python examples/rpcdump.py ncacn_np:files01[\pipe\epmapper]
python examples/mssqlclient.py CONTOSO.LOCAL/alice:'Passw0rd!'@sql01.contoso.local
```

When Kerberos is involved, prefer DNS names over raw IP addresses unless you know exactly how the SPN will be built. Kerberos tickets are issued for names, not generic sockets.

## Passwords, Hashes, and Keys

Most authentication-aware examples support one or more of these options:

| Option                          | Meaning                                                   | Typical use                                             |
| ------------------------------- | --------------------------------------------------------- | ------------------------------------------------------- |
| `password` in the target string | Plaintext password                                        | Interactive labs, known credentials                     |
| `-hashes LMHASH:NTHASH`         | NTLM authentication with hashes                           | Pass-the-hash workflows                                 |
| `-aesKey <hex>`                 | Kerberos authentication with an AES key                   | Key material from another tool or dump                  |
| `-k`                            | Use Kerberos                                              | Domain environments where tickets or keys are available |
| `-no-pass`                      | Do not prompt for a password                              | Kerberos cache, hashes, or unauthenticated checks       |
| `-dc-ip <ip>`                   | Contact a specific domain controller                      | Labs, split DNS, or controlled routing                  |
| `-target-ip <ip>`               | Connect to this IP while keeping the target name for auth | Kerberos/SPN-sensitive connections                      |

Examples:

```bash
python examples/psexec.py -hashes :8846f7eaee8fb117ad06bdd830b7586c CONTOSO/alice@files01
python examples/getTGT.py -aesKey 2b7e151628aed2a6abf7158809cf4f3c CONTOSO/alice
python examples/secretsdump.py -k -no-pass -dc-ip 10.10.10.10 CONTOSO.LOCAL/dc01$
```

## Kerberos Cache

Several scripts can read or write Kerberos credential cache files. A common flow is:

```powershell
python examples/getTGT.py CONTOSO/alice:'Passw0rd!'@DC.contoso.local -dc-ip $KDC_IP
$env:KRB5CCNAME = "alice.ccache"
python examples/smbclient.py -k -no-pass files01.contoso.local
```

On Linux or macOS, use `export` instead:

```bash
export KRB5CCNAME=alice.ccache
python examples/smbclient.py -k -no-pass files01.contoso.local
```

Use `-dc-ip` when DNS does not resolve the KDC reliably. Use the FQDN target when the script must build a Kerberos SPN.

## Debugging

Many scripts support `-debug`. This enables more verbose Impacket logging and usually prints tracebacks for protocol or authentication failures.

```bash
python examples/GetUserSPNs.py -debug CONTOSO/alice:'Passw0rd!' -dc-ip 10.10.10.10
```

Useful first checks:

* Confirm the target name resolves to the host you think it does.
* Confirm the domain name is the AD DNS name, not just a NetBIOS label.
* Try `-dc-ip` when LDAP or Kerberos fails because of name resolution.
* Try `-target-ip` when the service should be reached by IP but authentication should still use a hostname.

## Operational Notes

These example scripts are signitured to the moon. It isnt advisable to use them against production envmrioments or enviroments in which operational security is important to you.

In other sections of the documentation, I go over important elements of the project to allow you to build your own version of these example scripts.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://www.impacket.wiki/reference/common-syntax-and-flags.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
