> For the complete documentation index, see [llms.txt](https://documentation.hak5.org/wifi-pineapple-pager/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/wifi-pineapple-pager/payloads-1/introduction-to-scripting.md).

# Introduction to Scripting

WiFi Pineapple Payloads are written in `bash`. [Bash](https://en.wikipedia.org/wiki/Bash_\(Unix_shell\)) is a `shell` - the interactive text environment when you log into a system. If you are more familiar with Windows environments, it is similar (but not quite the same) as the Windows command line or `powershell`.

Like most shells, `bash` includes a scripting language for performing tasks; the Pager leverages this as the language behind Payloads.

{% hint style="info" %}
There are many shells with similar names, functionality, and scripts. Often one version of shell scripting will work as expected with other shells, but there may be variations in specific support. When following generic shell scripting guides, make sure that they are for the `bash` style!
{% endhint %}

### An introduction  <a href="#an-introduction" id="an-introduction"></a>

In these docs we’ll strive to give an introduction to basic scripting and programming concepts and how to make your first working payloads.

Beyond the basics, shell scripting can be incredibly power - but also incredibly complex. When moving beyond the basics, we suggest:

* <https://linuxconfig.org/bash-scripting-tutorial-for-beginners>
* <https://www.redhat.com/sysadmin/learn-bash-scripting>

### Editing payloads  <a href="#editing-payloads" id="editing-payloads"></a>

Payloads can be edited or created anywhere with a text editor, including on the Pager itself using the `vim` or `nano` editors, using [Hak5 Payload Studio](https://payloadstudio.hak5.org/), or on a computer using a syntax highlighting editor such as VSCode, SublimeText, or even a basic editor like Notepad.

### The Bash shell  <a href="#the-bash-shell" id="the-bash-shell"></a>

A shell is a command-line interface that allows users to interact with the operating system by executing commands. The shell acts as an intermediary between the user and the operating system, and is responsible for interpreting and executing user commands.

When a user enters a command into the shell, the shell parses the command and determines what action needs to be taken. The shell then initiates the required system calls to launch the command.

The shell also provides various features and utilities to help users manage and manipulate their environment. It provides the ability to define and use variables, create and execute scripts, and navigate the file system.

When you are logged into a system via the command line, chances are, you’re interacting with one of several standard shells. On Windows it is typically the legacy command shell or the more modern `Powershell`. On Linux, it is typically the `bash` or `dash` shells, however dozens exist. On macOS, typically you are using the z shell, or `zsh`.

With the exception of the Windows command shell and `Powershell`, most modern shell environments operate extremely similarly, and often scripts written for one shell will operate fine on another. Unfortunately there are some situations where this is not always true, especially when using more advanced pattern matching and other scripting features.

The WiFi Pineapple Pager payload system uses the bash shell: bash (the Bourne Again Shell) was derived from sh (the Bourne Shell). It was created in 1987 by Brian Fox for the GNU Project as a free software replacement for the Bourne shell (sh).

Bash incorporates many features of the original Bourne shell, as well as improvements and new features from other shells such as the C shell (csh) and the Korn shell (ksh). This includes features such as command-line editing, history, and job control, and critically for the payload system, the ability to define functions and variables.

Over the years, Bash has become the default shell on most Linux distributions, and was the default on macOS until it was replaced by zsh in macOS Catalina. It is also available on other operating systems such as Windows, where it can be installed using the Windows Subsystem for Linux.

Bash has continued to evolve over time, with new features and improvements being added in each release. It is a powerful and flexible shell that is widely used in the Linux and Unix communities, both for interactive use and for writing scripts and automation tasks.

### DuckyScript Commands  <a href="#duckyscript-commands" id="duckyscript-commands"></a>

Originating on the Hak5 USB Rubber Ducky as a standalone language, the WiFi Pineapple Pager uses **DuckyScript commands** to bring the ethos of easy-to-use actions to the payload language.

DuckyScript commands are always in all capital letters to distinguish them from other system or script language commands. Typically, they take a small number of options (or sometimes no options at all).

Payloads can be constructed of DuckyScript commands alone, or combined with the power of bash scripting and system commands to create fully custom, advanced actions.

{% hint style="info" %}
Remember - Payloads with DuckyScript Commands are not the same as a payload for the USB Rubber Ducky, which is written purely in the DuckyScript language.\
\
Payloads are written in `bash` scripting language, with DuckyScript Commands for the Pager helping with complex tasks and simplifying user interaction via the Pineapple UI.
{% endhint %}


---

# 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/wifi-pineapple-pager/payloads-1/introduction-to-scripting.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.
