Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,29 @@
*.exe
*.out
*.app

# Vim backups
*.swp

# travis
.travis.yml

# PlatformIO work files
.pio
.pioenvs
.piolibdeps
*tags*

# IDE
.travis.yml
extensions.json
settings.json
*tags*
.clang_complete
.gcc-flags.json
.vscode
.vscode/.browse.c_cpp.db*
.vscode/.browse.c_cpp.db*
.vscode/c_cpp_properties.json
.vscode/launch.json

15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ It shows you the traffic of all nearby devices on the selected WiFi channel.
- SD card support to capture traffic
- better performance due to the powerful ESP32
- shows average RSSI
- [PlatformIO](http://platformio.org/) support

## Now Available on
**Tindie**: https://goo.gl/kZmVug
Expand Down Expand Up @@ -39,7 +40,7 @@ Sometimes the device can get into a restart loop, because it crashes everytime w

Also please be aware that not every packet can be saved all the time! If more packets come in that can be saved, they will be dropped.

## Compiling Source
## Compiling Source on Arduino
(**0.** Download and install [Arduino](https://www.arduino.cc/en/Main/Software))
**1.** Install the Arduino core for the ESP32: https://github.com/espressif/arduino-esp32#installation-instructions
**2.** Install this ESP8266/ESP32 OLED library: https://github.com/squix78/esp8266-oled-ssd1306
Expand All @@ -51,6 +52,18 @@ Also please be aware that not every packet can be saved all the time! If more pa
If you ran into upload problems, try setting the flash frequency to 40MHz and the upload speed 115200.
If you want to use your own hardware, you may want to edit the settings in lines 22 - 32.

## Compiling Source on Platformio

**0.** Please install first [PlatformIO](http://platformio.org/) open source ecosystem for IoT compatible with **Arduino**
**1.** [Download](https://github.com/spacehuhn/PacketMonitor32/archive/master.zip) and unzip the repository
**2.** Compiling and Uploading the firmware:

``` bash
pio run --target upload
```

**NOTE**: If you want use TTGO board, please select it on `platformio.ini`

## License

This project is licensed under the MIT License - see the [license file](LICENSE) for details.
39 changes: 39 additions & 0 deletions include/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

This directory is intended for project header files.

A header file is a file containing C declarations and macro definitions
to be shared between several project source files. You request the use of a
header file in your project source file (C, C++, etc) located in `src` folder
by including it, with the C preprocessing directive `#include'.

```src/main.c

#include "header.h"

int main (void)
{
...
}
```

Including a header file produces the same results as copying the header file
into each source file that needs it. Such copying would be time-consuming
and error-prone. With a header file, the related declarations appear
in only one place. If they need to be changed, they can be changed in one
place, and programs that include the header file will automatically use the
new version when next recompiled. The header file eliminates the labor of
finding and changing all the copies as well as the risk that a failure to
find one copy will result in inconsistencies within a program.

In C, the usual convention is to give header files names that end with `.h'.
It is most portable to use only letters, digits, dashes, and underscores in
header file names, and at most one dot.

Read more about using header files in official GCC documentation:

* Include Syntax
* Include Operation
* Once-Only Headers
* Computed Includes

https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
46 changes: 46 additions & 0 deletions lib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

This directory is intended for project specific (private) libraries.
PlatformIO will compile them to static libraries and link into executable file.

The source code of each library should be placed in a an own separate directory
("lib/your_library_name/[here are source files]").

For example, see a structure of the following two libraries `Foo` and `Bar`:

|--lib
| |
| |--Bar
| | |--docs
| | |--examples
| | |--src
| | |- Bar.c
| | |- Bar.h
| | |- library.json (optional, custom build options, etc) https://docs.platformio.org/page/librarymanager/config.html
| |
| |--Foo
| | |- Foo.c
| | |- Foo.h
| |
| |- README --> THIS FILE
|
|- platformio.ini
|--src
|- main.c

and a contents of `src/main.c`:
```
#include <Foo.h>
#include <Bar.h>

int main (void)
{
...
}

```

PlatformIO Library Dependency Finder will find automatically dependent
libraries scanning project source files.

More information about PlatformIO Library Dependency Finder
- https://docs.platformio.org/page/librarymanager/ldf.html
48 changes: 48 additions & 0 deletions platformio.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
;

[platformio]
default_envs = lolin32 ; select here your default environment

[common_env_data]
platform = espressif32
framework = arduino
upload_speed = 1500000
monitor_speed = 115200
build_flags =
-D CORE_DEBUG_LEVEL=0
; -D DSTIKE
-D TTGO

lib_deps =
2978 ; ESP8266 and ESP32 Oled Driver for SSD1306 display

[env:lolin32]
platform = espressif32
board = lolin32
framework = ${common_env_data.framework}
monitor_speed = ${common_env_data.monitor_speed}
lib_deps = ${common_env_data.lib_deps}
build_flags =
${common_env_data.build_flags}
-D LOLIN32=1

[env:WEMOSOLED]
platform = espressif32
board = lolin32
framework = ${common_env_data.framework}
monitor_speed = ${common_env_data.monitor_speed}
lib_deps = ${common_env_data.lib_deps}
build_flags =
${common_env_data.build_flags}
-D WEMOSOLED=1


File renamed without changes.
File renamed without changes.
17 changes: 13 additions & 4 deletions PacketMonitor32.ino → src/PacketMonitor32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@ using namespace std;
#define MAX_CH 14 // 1 - 14 channels (1-11 for US, 1-13 for EU and 1-14 for Japan)
#define SNAP_LEN 2324 // max len of each recieved packet

#define BUTTON_PIN 5 // button to change the channel

#define USE_DISPLAY // comment out if you don't want to use the OLED display
#define FLIP_DISPLAY // comment out if you don't like to flip it
//#define FLIP_DISPLAY // comment out if you don't like to flip it
#ifdef DSTIKE
#define BUTTON_PIN 5 // button to change the channel
#define SDA_PIN 26
#define SCL_PIN 27
#define MAX_X 128
#elif TTGO
#define BUTTON_PIN 0 // button to change the channel
#define SDA_PIN 5
#define SCL_PIN 4
#endif
#define MAX_X 126
#define MAX_Y 51

#if CONFIG_FREERTOS_UNICORE
Expand Down Expand Up @@ -66,6 +72,9 @@ uint32_t deauths = 0; // deauth frames per second
unsigned int ch = 1; // current 802.11 channel
int rssiSum;

void wifi_promiscuous(void* buf, wifi_promiscuous_pkt_type_t type);
void coreTask( void * p );

/* ===== functions ===== */
double getMultiplicator() {
uint32_t maxVal = 1;
Expand Down Expand Up @@ -164,7 +173,7 @@ void draw() {
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString( 36, 0, ("Pkts:"));

display.drawLine(0, 63 - MAX_Y, MAX_X, 63 - MAX_Y);
display.drawLine(0, 63 - MAX_Y, MAX_X-1, 63 - MAX_Y);
for (int i = 0; i < MAX_X; i++) {
len = pkts[i] * multiplicator;
display.drawLine(i, 63, i, 63 - (len > MAX_Y ? MAX_Y : len));
Expand Down
11 changes: 11 additions & 0 deletions test/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

This directory is intended for PIO Unit Testing and project tests.

Unit Testing is a software testing method by which individual units of
source code, sets of one or more MCU program modules together with associated
control data, usage procedures, and operating procedures, are tested to
determine whether they are fit for use. Unit testing finds problems early
in the development cycle.

More information about PIO Unit Testing:
- https://docs.platformio.org/page/plus/unit-testing.html