Creating a Module for the WiFi Pineapple part 1

The WiFi pineapple is a versatile platform for wireless attacks. What makes it stand out from other devices is its ability to run 3rd party software using modules. In this article, I’ll be going over my experience building a module.

Disclaimer: I’m building a module for the wifi pineapple MKVI (nano and tetra) not MKVII because that’s all I have.

Edit: Here’s the link to the completed module

How a Module Works

Here is how a wifi pineapple MKVI module works. The API is handled using PHP and by calling built-in functions. The front end is just some HTML. The front end communicates with the API using Angular Js (support has ended since 2022).

HTML →Angular JS →PHP

What Module I am Making

I will be making the ZeroTier module. ZeroTier allows the creation of peer-to-peer networks that work over the web without the need for port forwarding. It is similar to a VPN but also different. You can read more about it here.

My module’s requirements are to install ZeroTier, start and stop ZeroTier, configure ZeroTier, and autostart at boot.

First Step: Create Files

I first created all the necessary files for the module. First was module.info, which contains a basic about section for the module, the author of the module, and the module version. Next was module.html, which was the front end of the module. Then module.js which lets the front end communicate with the API. Lastly, I created module.php which was the API for the module.

Second Step: Dependency Installer

After all the necessary files were created, I worked on getting the dependencies to install. To do this, I needed to create a section in the module page, a controller to communicate with the API, and make the API run the right commands. The js controller and API were easy. I copied xchwarze’s code because it worked well (Thanks!). I also didn’t want to waste time rewriting something that’s already available.

Xchware’s code worked well but it was missing the options for where to install the dependencies. Most modules ask if you want to install them internally or on the SD card. Luckily I didn’t need to change much for this to work. The front end did give me some trouble though. I wanted it to only show the SD card option if one was installed. This didn’t work for some reason so I abandoned the idea and trusted that the user would know if one was installed. At this point, I also added a dependencies.sh file with the commands to install and remove the required packages.

Third Step: Controls

I had three ideas for this step. I could have the API run commands, have a script, or use openwrt’s uci commands. All of these should work but I ran into a big problem, which I should have found earlier. Before starting this project, it never occurred to me to try setting up ZeroTier once to see if it would even work. I followed all the instructions on the wiki but for some reason, it never started. I tried other methods but it was unable to save its identity between reboots.

This is only part one of documenting my attempt at creating the ZeroTier module. In part two I will hopefully have all the setup issues sorted out and have the module function as it should.


Posted

in

,

by

Comments

Leave a Reply