SpacehuhnTech / esp8266_deauther

Affordable WiFi hacking platform for testing and learning

Home Page:http://deauther.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scan wont pick up APs

nutterdk opened this issue · comments

Im using this board:
NodeMCU with an ESP-12E

It uploaded and works fine. except when scanning for networks it just keeps scanning and doesnt find anything. Even when its right next to the router

Have you tried to upload one of the examples and are they working? There is one example (for the ESP8266) for scanning APs which prints them out in the serial monitor.
Please try that out and tell me if this works.

Could you link me to the example?

And by the way its the same card that Seytonic used in his video

If you followed the steps correctly you should have the SDK installed in Arduino and with that the examples.
So under tools select an ESP8266 and then go to File -> Examples -> ESP8266WiFi -> WiFiScan.

Sorry I'm new to arduino. I've uploaded the wifiscan to the nodemcu, now what? How do i test this example

I managed to work that out, so after uploading the wifiscanner example it just spits out all this random text "�¢ÿ�À)óÿVÿå1ü�þDà2ÿÿô��ù�ú¢ÈBÿÿøå%þ�ü*ð�ÿÿù"

Go to Tool and open Serial Monitor make sure the baud rate (bottom right in the corner) is set to 115200 and then when running the example you should see the scan results in the monitor.

Ah yeah, it works! It gives a list of the access points near me.

learned something :D

Now when you upload the deauther code does it work? You can let the serial monitor open and see what it does, maybe you find a clue why it's not working.

Should i reset my board first before uploading the deauther?

No just upload.

It won't let me.
The Error message and also the port in tools is now greyed out.
Arduino: 1.8.1 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz, Serial, 115200, 4M (3M SPIFFS)"

java.io.IOException: jssc.SerialPortException: Port name - COM4; Method name - setEventsMask(); Exception type - Can't set mask.
at processing.app.Serial.dispose(Serial.java:144)
at processing.app.SerialMonitor.close(SerialMonitor.java:108)
at processing.app.AbstractMonitor.suspend(AbstractMonitor.java:96)
at processing.app.Editor$DefaultExportHandler.run(Editor.java:2182)
at java.lang.Thread.run(Thread.java:745)
Caused by: jssc.SerialPortException: Port name - COM4; Method name - setEventsMask(); Exception type - Can't set mask.
at jssc.SerialPort.setEventsMask(SerialPort.java:279)
at jssc.SerialPort.removeEventListener(SerialPort.java:1064)
at jssc.SerialPort.closePort(SerialPort.java:1090)
at processing.app.Serial.dispose(Serial.java:141)
... 4 more
Board at COM4 is not available

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Click upload again. If this doesn't work close the serial monitor and open it again after the upload is finished.

Ive clicked upload again, got the same message. So i closed it and uploaded again which i got these error messages
error: Failed to open COM4
error: espcomm_open failed
error: espcomm_open failed

But now when trying to open Serial monitor it tells me "Board at COM4 is not available

Dude my bad, I completely forgot I had unplugged the board :D its uploading now with no errors

Alright so the deauther is uploaded but when scanning, still no networks are showing :/

Ok this is strange! Because both, the example and my code, use to same functions to scan for APs.
Hm.. do you see any activity in the serial monitor while scanning with the deauther?

This is all i get the monitor
starting...
SSID: pwned
Password: deauther

Ok well then I have no idea... :(
I never had this problem, I can't reproduce it and it really doesn't make sense! If the example code is working, the deauther code should be too - it's the same!

If you get it running somehow, let me know please!

Hi Spacehuhn
Great video by the the way. I'm getting the same as nutterdk :( open the example one and serial display 16 access point around where I live but when recompile and upload the deauther shows nothing, very strange.

I'm thinking that I am just going to reset my board by holding down the reset button and reupload/test it and if that doesnt work then I have no idea either

Yeah still nothing

I'm using one of these, they should be ok right ?

in the readme it says to go here packages > esp8266 > hardware > esp8266 > 2.0.0 > tools > sdk > include
I have version 2.3 in the esp8266 directory.

You need version 2.0

Yours probably isnt working because you have the wrong sdk version

Hi nutterdk, do you have a link for 2.0.0 ?

Just delete the one you have now and go follow the tutorial again, it shows you how to do it. It says to select 2.0.0 from the drop down menu after searching for esp8266

ah yes of course, thanksz i'll try that now.

Tell us if you get it working please :D

will do having trouble making it show now.

I can't see the library in the library manager :(

Just to make it clear, it works now right?
It was a browser problem with IE (?): https://github.com/spacehuhn/esp8266_deauther/issues/6

Strangely enough I seem to be facing the same issue.

I've got the 2.0 SDK installed, and all the network scans from the example seem to work fine.

I've tried Google Chrome and Safari browser on my iPhone and so far neither of them find any networks are are stuck at "scanning..."

EDIT: I can confirm this issue seems to only happen on my iPhone (maybe mobile phones in general???)
Any idea what might be causing that? Maybe something to do with flash support?

I can confirm that I am having the same issue.

After the first compile and upload my Android phone, Windows laptop with Chrome & Windows tablet with IE have all connected to my ESP-12F with Deauther and have all scanned for AP's sucessfully. That was last night.

Today when I have plugged the ESP-12F back into power, I no longer get any APs when scanning. I had not changed anything on the ESP-12F. no re-upload, the same power supply, everything is the same as it was yesterday. Hence I really don't understand what is happening. I have since tried re-uploading the sketch, but am seeing the same result.

I will be trying another ESP board to see if I can get it working on that. Other then this I have no further ideas.

Today when I have plugged the ESP-12F back into power, I no longer get any APs when scanning.

Have you tried other browsers for your tablet device? If I had to guess it's something with how the POST information is sent when the buttons are pressed.. Really no idea though.

Have you tried other browsers for your tablet device?

Absolutely
On the Android I have tried the standard browser that comes with the phone as well as Chrome.
On the Laptop I have tried Chrome & MS Edge.
On the Tablet I have tried Chrome & IE 11.

All of which worked yesterday, none do today.

Since my last post I have recompiled and uploaded to another ESP-12F board and I'm still having the same problem on all devices and browsers.

This is making me think that perhaps some temporary files being stored on the devices are creating an issue after the first use. I'm coming to this conclusion through the process of eliminating...

  1. The ESP HW as an issue, as I've used 2 boards.

  2. The issue started on an ESP that had only ever been flashed one time which at first worked but later didn't.

  3. All attempts to recompile and upload have been the original un-touched sketch.

  4. Three client devices have been used with various browser software. All of which worked the first time and have later not worked.

There is a tiny bug in "APScan::getResults()" in APScan.cpp. If you got more than maxResults APs an extra comma gets added to the json which throws off the parser.

Fixed line 73: if ((i!=results-1) && (i!=maxResults-1)) json += ",";

The timeout is also too short and will fire every time for me, with the fix above a manual reload will do.

Can you confirm that it works now with the updated files (for all your browsers and devices)?

I've redownloaded and re-uploaded the new code to the ESP-12E but I still can't seem to get past the "scanning" in both Google Chrome and Safari in my phone browser :/

I just updated a few things and increased the result list to 80, maybe this will help.

There is a tiny bug in "APScan::getResults()" in APScan.cpp. If you got more than maxResults APs an extra comma gets added to the json which throws off the parser.
Fixed`` line 73: if ((i!=results-1) && (i!=maxResults-1)) json += ",";
The timeout is also too short and will fire every time for me, with the fix above a manual reload will do.

After making this change I'm now getting scan results again. I thought nothing in my environment had changed hence some serious head scratching. But it is entirely possible a few more AP's could have been picked up when running at a different time or the ESP orientated differently. Which triggered this bug.

Hi
I'm having quite the same problem :
~3 seconds after running scan, I get a timeout error message (the one contained in functions.js)
I've got this behaviour on every device I own (Android phone / Linux Laptop / Win10 Laptop) and with various browsers FF / Chrome / Edge / Chromium.
I've tried to power the ESP from computer and various USB adapters (including 2Amps).

The Wifi Scanner example works well.

I managed to catch the following trace from the serial interface with CuteCom.

Hope this helps and thanks !

starting...
SSID: pwned
Password: deauther

Exception (28):
epc1=0x4000df60 epc2=0x00000000 epc3=0x00000000 excvaddr=0x00000000 depc=0x00000000

ctx: cont 
sp: 3fff5330 end: 3fff5690 offset: 01a0

>>>stack>>>
3fff54d0:  4010684c 4010683a 3fff5590 4020e53a  
3fff54e0:  00000af3 00000001 3fff5590 4020e592  
3fff54f0:  00000b03 00000001 3fff5590 4020e95d  
3fff5500:  00000013 3fff08e4 3fff5590 3fff0898  
3fff5510:  00000013 3fff08e4 3fff5590 4020e9bd  
3fff5520:  3ffe8570 3fff08e4 3fff5590 4020e4ec  
3fff5530:  3ffe8a20 00000000 3fff5590 40206e20  
3fff5540:  3fff9000 0000001f 00000011 3fff8ee8  
3fff5550:  0000000f 00000005 3fff5590 4020e5c2  
3fff5560:  3fff0f7b 3fff17b7 3fff1993 00000013  
3fff5570:  3fff2ca8 3fff23e4 3fff5640 00000001  
3fff5580:  00000001 00000001 3fff85a8 402086ae  
3fff5590:  00000000 00000aff 00000af2 4020e5c2  
3fff55a0:  4010684c 3fff85a8 3fff55d0 4020d742  
3fff55b0:  0000000a 401011f3 3fff85a8 4020a8e2  
3fff55c0:  4020a8ec 3fff85a8 3fff55f0 4020a91e  
3fff55d0:  3fff9000 0000001f 00000013 4020e6e8  
3fff55e0:  4020a8ec 3fff85a8 3fff23e4 4020aad9  
3fff55f0:  3fff8fd0 0000001f 00000013 40209b7f  
3fff5600:  3fff2420 401011f3 3fff4670 00000001  
3fff5610:  00000000 0000000a 4020c768 3fff4670  
3fff5620:  402012e6 00000001 00000001 3fff4668  
3fff5630:  3fffdc20 000003e8 3fff23e4 4020abd4  
3fff5640:  3ffe88f0 00000000 000003e8 000092c9  
3fff5650:  3fff2404 3fff90c0 00000016 40101941  
3fff5660:  4020c789 00000000 3fff4661 40208fe1  
3fff5670:  00000000 00000000 3fff4661 4020c7b1  
3fff5680:  00000000 00000000 3fff4670 40100114  
<<<stack<<<

 ets Jan  8 2013,rst cause:2, boot mode:(3,6)

load 0x4010f000, len 1264, room 16 
tail 0
chksum 0x42
csum 0x42
~ld
EEPROM cleared

starting...
SSID: pwned
Password: deauther

Thanks @labraloutre for the detailed information. Seems like the ESP crashes after scanning for some reason. I will add more debug infos to the serial monitor with the next update! until then could the others please check if they get the same error?

Hi
I've some informations to add.
I just tried again without changing anything except I'm at work, well it had worked for some time quite well.

I'm wondering whether it Could be something related to the networks surrounding an area, perhaps a SSID name with special characters or accents or too long ?...

I had the same issue and the same error at my workplace. However at the trainstation 30 mins later it worked again...

I think either there is an error in the code which lets the ESP8266 crash or there is something wrong with the returned JSON string.
hm... :/

probably something about the JSON, since it worked at a different place... I can try to scan the APs with the ESP8266WiFi WiFi Scan. Maybe there are some chars in it that make it crash.

EDIT: I added the JSON-String to the debug-console, so I can send you the full string by tomorrow.

EDIT 2: It doesn't even give back a JSON-String.

EDIT 3: Actually it doesn't even get to the APScan::getResults() function.

what is the solution for scanning in mobile devices?

@dushyantpunk it has nothing to do if you scan it via mobile or pc. There is a bug in the code that probably is caused by an attribute (ssid, mac, etc) of a nearby network.

I get the same error when an AP has a quotes (") in its SSID because then the generated JSON string is invalid. I'll fix that in the next update!

But I'm sure we are all talking about different errors, just with the same results.

  • Browser incompatibility is one thing, you can debug using the developer options and see if the javascript gives an error or something else.
  • The other thing is when the ESP8266 crashes. @WhyIsThisUsernameAlreadyTaken you said it doesn't get to the getResults() function, so does it crash before that?

You guys need to debug more! I can't help you without knowing whats wrong. I can't reproduce that error and I've tested it a lot now.

@spacehuhn I tried to add more debug information to your code but because I don't have a lot of knowledge in C I don't really understand the whole program. If you could add more debug options I could give you more information.

This is exactly how I found myself trying to implement a serial substitute to the webserver thing #37

@WhyIsThisUsernameAlreadyTaken have you tried out the testing branch? https://github.com/spacehuhn/esp8266_deauther/tree/testing I added a lot of debug infos. You just need to set debug = true in the esp8266_deauther.ino file. Maybe this helps a bit.

And thank you for your help so far! I hope we can find the error soon :)

Hi @spacehuhn
I just tried with the testing branch, and the symtoms are the same (timeout and no data on the client web page)
Strangely, I see a correct log in the serial monitor
Here's a link to my log after a fresh reboot

http://pastebin.com/hpfSQNEE

Thanks for your help

Thanks!
Can you repeat that and paste the log again? I just updated a few things and after the scan it should now print out the json string to the serial monitor.

Here it is
This time, esp crashed.

http://pastebin.com/Xi7t2hrF

Hope this helps

I can reproduce the problem too on the testing branch.

I've added Serial.print statements to the json loop in APScan::getResults() and it seems to crash randomly, sometimes in the middle of serial.print()ing a valid word, does it mean it's a not a problem with the getters?

Speculation: maybe dealing with HTTP requests while the in scan mode is what makes it crash ?

Exception (28) means LoadProhibitedCause:
https://github.com/esp8266/Arduino/blob/master/doc/exception_causes.md

A load referenced a page mapped with an attribute that does not permit loads

I got the same error before when I made a mistake and the generated string was to big and let it crash when printing or sending it.
@labraloutre I see in your log that you have a lot of WiFi networks nearby, maybe you can try to reduce the list size. Go to APScan.h and set maxResults = 10 (3rd line).

@spacehuhn I guess you found the problem !
I've tried with 10 and worked well, seems ok too with 20, and problems arise if I use 30 as maxResults.

So far so good.

BTW I used the same value for MaxResults in ClientScan.h

Great! Finally some progress on this.
I updated the testing branch and made the json string much smaller and reduced the max results to 40.

The json serializer creates a faulty json whenever an ssid contains a double quote ("). This leads to 0 scan results. Note that the creation of the json itself does not fail (-> no obvious crash).

Escaping the double quotes from ssid names should fix the problem. Maybe this is the reason why some of you cannot see any results.

Thanks. I already fixed that.

I get the same error when an AP has a quotes (") in its SSID because then the generated JSON string is invalid. I'll fix that in the next update!

https://goo.gl/os8Wme
Error Log with yesterday's version on the testing branch

Yeah looks like that's really the problem, too much SSIDs and the JSON string gets to big.
I updated the testing branch right now. Please test and report if works now :)

Hey spacehuhn,

Loving this tool! Having some trouble getting it to work on mobile. Just tried the testing branch with my iPhone 6S (Safari + Chrome + Firefox), and I'm having the same problem as everyone else. Works perfectly fine on my Mid-2012 MacBook Pro, but connecting with my iPhone causes the AP scan to be stuck on "scanning..". I suspect this still has to do with the interface and not the backend - as the settings page shows up blank on the iPhone as opposed to the MacBook where it has information filled in upon opening. Attached screenshots from my iPhone.

photo 2017-03-01 8 03 01 pm
photo 2017-03-01 8 03 04 pm

UPDATE: Looks like the iPhone doesn't trigger the AP scan, debugged with the serial monitor and I get the following with an iPhone:

starting...
starting WiFi AP
SSID: pwned
Password: deauther
generating Macs...done

As opposed to what I get with the MacBook:

starting...
starting WiFi AP
SSID: pwned
Password: deauther
generating Macs...done
getting AP scan result JSON done
starting AP scan...
MAC - Ch - RSSI - Encrypt. - SSID
:9a::9c:66:** - 6 - -89 - WPA2 - *********
:32::54:c8:** - 6 - -71 - WPA2 - ********
:8d::61:93:** - 11 - -82 - WPA2 - *********
scan done

I've found a way to get a full APScan list (i.e. setting maxAPScanResults to 120 in a busy area) without having the ESP to crash, but this requires som tuning.

The crash can be avoided by sending the collected information separately for every acces point found in the scan.

If APScan.json returns the ID's of the scan results (instead of just "true"), the client can use theses ID's to start polling APScanResults.json?ID=xx for each access point and the ESP will never encounter the string overflow problem.

ya that's true I thought about the same. Can you make a PR if you have it working?

I can start by making a PR to add the String APScan::getResults(int i) and modify sendAPResults() to implement the server.hasArg("apid") case

Hi, I am having the same issue. What is weird, is that if I upload the Arduino sketch I can use my iPhone 7 to hit 192.168.4.1 and it scans fine. However, if I then do something, stop it and try again, I just get stuck in scanning and it wont work again! Ive tried different browsers and I`ve tried rebooting - still is dead after the first initial working run!

Does someone still have this porblem with the current version?

Nope thanks for fixing :)

Hi!
I have flashed my nodemcu with deauther 1.1 via nodemcu-firmware-flasher

It works fine on my computer (OS X 10.11.6 / Safari 10.0.3)

But on my mobile devices i can't scan, save settings etc

Only top buttons that point to .html file work APs, Clients, Attack, etc

Hi @gegtor !
Sounds like a javascript issue.
Can you specify which phone and browser are you using ?

Mobile devices are both running IOS and Safari
Device#1 - IOS 5
Device#2 - IOS 8

I have tried chrome on device#2 and that had no effect :/

Try the testing branch, i've made some changes on javascript files.
Can you have any kind of web debugger on ios ?

Sure
Here you are:
alt text

Can you view the full source of this page ? It seems to be truncated because your esp is running out of memory.

Well i can't open source on ipad because Safari doesn't have that function on IOS

But i can view source fine on my mac
zrzut ekranu 2017-03-13 o 02 01 41
zrzut ekranu 2017-03-13 o 02 02 00

This is not the current functions.js file, this one is incompatible with ios < 10.
You are using a wrong version of esp8266_deauther or your browser is loading a cached version of functions.js
Try to clear your cache

Clearing cash had no effect

I will try test branch later today

The javascript code in your screenshot is a part of an old version of the esp8266_deauther. This bug is fixed since few days.

Can i have a link to the latest source code that i can compile in Arduino IDE?

It works!!!

Test branch code works really well on all my mobile devices :) Good Job fixing that

great! :)

oh I didn't want to close it. Anyway I think it's really fixed now for everyone, isn't it?

90% yes

APScan still needs to return the full AP list (currently limited to 30). Also today my own wifi box doesn't even appear in the list even though it's got the biggest RSSI, I can see it on my mobile, tablet, PC, but it has become invisible to the ESP8266.

If it's okay I'll open a new issue asking for a "Full APScan Async List", the getScanResult(id) only needs a webServer callback and JavaScript can take care of the rest.

yeah I know, hadn't time to do that yet. You can open up an issue 👍