SpacehuhnTech / esp8266_deauther

Affordable WiFi hacking platform for testing and learning
http://deauther.com
Other
13.49k stars 2.6k forks source link

full serial peering #37

Closed tobozo closed 6 years ago

tobozo commented 7 years ago

Having to constantly switch between browser / wifi properties / reconnect / refresh sucks.

As this was getting on my nerves, I wanted to try a less disruptive approach by using the stable serial console instead of the unstable wifi connection. This is what I've done so far: https://github.com/tobozo/esp8266_deauther_serial

This version talks full JSON, and will only accept orders coming from the hardware serial port:

Now I'm not requesting you ditch the web server like I did, I'm just suggesting using the serial as an alternate channel, provided the other end know how to deal with the data.

[Edit]: use this lib as a substitute to ESP8266WebServer https://github.com/tobozo/SerialServer and talk to the Serial like you're a browser ( e.g. send GET /APScanResults.json HTTP/1.1)

spacehuhn commented 7 years ago

Great idea! I never thought about that, but sure with an app you could use it with your phone what most people already do. Maybe a native (Android) app could also be an option? Using the same html files as the user interface but communicate via serial instead of WiFi?

EDIT: Just found this: https://involt.github.io

tobozo commented 7 years ago

If I can get node-serialport to compile on Termux (currently giving errors with node-gyp) the native app is not required, and there's a possible codebase that can also be used from Mac/PC/Raspberry.

If unsuccessful I'll try setting up a Phonegap environment, the Cordovaduino plugin seems good enough for that. However, a native application requires a distribution center, not very rogue-ish :)

I'm more attracted to the node solution though, if I can manage to get node-serialport to install, the only requirement is to have the Termux application installed, run the node application, and open a browser.

spacehuhn commented 7 years ago

But with node-serialport the user needs to run a node.js server, right? Isn't that a bit complicated on let's say an Android phone?

tobozo commented 7 years ago

It's not really complicated;

While I'm not sure Termux exposes the serial port, or what /dev/tty* is linked to the usb otg (or if it's linked at all), I'm still looking for a context where Serial port and nodejs execution are allowed from a single application.

If I dont' find one, I'll go for the Android native app.

tobozo commented 7 years ago

Got the Phonegap + Cordovaduino plugin to compile using grunt-phonegap and successfully connected to the OTG Serial port while the ESP8266 was plugged in.

I thought no adb debug was possible while the USB is connected and gave up last night; but I just found out adb debug can be done over the network so I'll check it out later tonight.

If this turns out to be working, I'll publish the project source on github, Is "android_deauther" a good name or should it have a complementary name such as "android_esp8266_deauther" ?

spacehuhn commented 7 years ago

It would be great if you could add the serial interface to the main repo, just so that both serial and WiFi is an option. I will add "WiFi on/off" to the settings later together with some over things.

That way others could also create Apps or other GUIs easily.

tobozo commented 7 years ago

So Wifi on means Serial off? I'll start with that and make a PR soon:

define WIFI_UI_ON true

tobozo commented 7 years ago

38

spacehuhn commented 7 years ago

Hey so I ran into some serious conflicts with your PR with my current codebase. I suggest I finish my work and then we work together to implement a good serial interface.

tobozo commented 7 years ago

yikes I saw the diff mess ... I had to move loop() and setup() at the end of the ino file otherwise my Arduino IDE (Ubuntu) would complain, I'm not sure how this affects other versions of the IDE or why it happens though.

Meanwhile I'll see how far I can go with Corvodaduino.

spacehuhn commented 7 years ago

Great! I would love to see an App for this project!

tobozo commented 7 years ago

Current status on Android app: connecting well with Cordovarduino although I'm experiencing some data loss problems I can only reduce by modifying the esp8266_deauther behaviour (enumerating AP list items in separate JSON messages, 'pinging' the Android by constantly re-sending the AP List).

I'm not sure whether I should implement some CRC check or just manage a timed message queue, or both.

tobozo commented 7 years ago

I'm finally getting somewhere with the sketch and the android app binary available here https://github.com/tobozo/esp8266_deauther_serial

I know it sorta breaks the repository so I'll stop here until we discuss the next steps, the android app is only a proof of concept and it comes with requirements that can be annoying to fulfill.

tobozo commented 7 years ago

I've also started implementing a substitute to the ESP8266WebServer code in order to minimize the impact on the code in the ino file.

it's just a matter of changing this:

ESP8266WebServer server(80);

by this:

SerialServer server(115200);

I'll provide the code on request if it proves to be of any interest.

spacehuhn commented 7 years ago

Great 👍 Unfortunatly I still haven't had time to look into your version and the App :( I'm busy debugging the testing branch. If you're able to make a stable version with both WiFi and serial let me know :) No stress though, we have time! By the way - WiFi and serial could just run both at the same time (with the option to disable WiFi in the code and via a serial command).

tobozo commented 7 years ago

Here's the SerialServer library I've used, it needs to be installed in the 2.0.0/libraries/ folder and cannot yet coexist with the ESP8266WebServer but it works just fine with a copy of the testing branch cloned a few minutes ago.

tobozo commented 7 years ago

Just commited so both libraries can be loaded without namespace collisions.

The #include <ESP8266WebServer.h> does not need to be commented anymore.

Also I haven't removed yet my first attempt at producing a handlers lists (was coded before you replied to the manifest.json request).

You can get this handlers list by calling server.getManifest() while using ServerSerial. I'm not sure I'll keep this unless ESP826WebServer and RequestHandler can be overriden externally to maintain the syntactic substitution between both libraries.

tobozo commented 7 years ago

Full serial peering for desktop achieved using a nodejs pseudo proxy, instructions are in the readme.

There are still reasons to build an Android app for the esp8266_deautheer but none of those involve using the serial interface because it's too much of a drag.

tobozo commented 7 years ago

This project claims to do OTG but I'm quite sure it's also using Cordovarduino.

XAS-712 commented 7 years ago

Why not use a HC-05 Bluetooth serial port module? Most android phones support Bluetooth. The device needs not to have the OTG function. And this module is cheap. About 15 RMB in China.

tobozo commented 7 years ago

@XAS-712 Sound good for a headless build, I'll order one right away :-) There's a physical requirement for spatial isolation between the antennas to avoid interferences though.

dglaude commented 7 years ago

Creazy idea while reading this issue. Maybe using two ESP8266, one for the "attack" wifi and one for the "control" wifi. In between, the @tobozo serial interface that replace the WebServer.

tobozo commented 6 years ago

achieved in the next version, closing this