> For the complete documentation index, see [llms.txt](https://documentation.hak5.org/packet-squirrel-mark-ii/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.hak5.org/packet-squirrel-mark-ii/advanced-payloads/tips-tricks-and-pitfalls.md).

# Tips, tricks, & pitfalls

Finally, we collect some tips, tricks, and common pitfalls to watch out for.

### TIP: Including files

It's easy to include text-based files in your payload, so that the user does not have to edit or upload a second file. This trick is used in the OpenVPN configuration example:

```bash
cat <<EOF > /some/file/path
file contents
go here
multiple lines are fine

blank lines are fine too

when we're done
EOF
```

This trick will dump everything between the `cat` line and the `EOF` line to the specified file.

### TIP: Directing output to stdout

Not all tools support this, but many tools will accept `-` as a special filename indicating data should be written to the `stdout` (or console) stream instead of a file.

One of the most useful tools that supports this trick is `wget`.  Instead of saving a download to a file, it can be echoed to `stdout`:

```bash
wget -O - https://fake.host/some/file 2>/dev/null
```

The `-O` argument specifies the output file to `wget`, and the `-` argument sends it to the output stream.  We also use the `stderr` redirect to hide the status output of `wget`.

### TIP: Always set a network mode!

We've said it in other sections, but always remember to set a network mode in your payloads!  If there is no `NETMODE` command in the payload, the Packet Squirrel will remain offline and not pass any traffic from the Target port!

### PITFALL: Ligatures and fancy quotes

A ligature is the combination of multiple characters for presentation.  Common ligatures combine characters like `>=` into `≥` and `--` into `—` (notice how it is a subtly longer dash!)

Similarly, "fancy" quotes replace the standard straight double quote (`"`) and straight single quote (`'`) with more legible versions: `“ ”` and `‘ ’`. &#x20;

Why are these a problem?  Because as far as Bash is concerned, these *are not the same characters*.  Fancy and curly quotes are *not* quotes and will not parse!  Similarly, when running a command with a long option like `./script --option-one`, a typographically long dash is *not* the same as a double dash!

These fancy characters can happen when copying examples from online, or from editing code in a more traditional text editor instead of one designed specifically for code editing.


---

# 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://documentation.hak5.org/packet-squirrel-mark-ii/advanced-payloads/tips-tricks-and-pitfalls.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.
