MCU---ESP8266Wifi SmartConfig one-click configuration (Part 2)

Publisher:真瓷堂Latest update time:2022-07-29 Source: csdnKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Chapter Highlights

According to the previous chapter, we have already used the one-click networking of ESP8266, but we don’t know the details. How are the SSID and password broadcasted?


Through Baidu's other information, it includes determining the SSID, channel, receiving data, separating the length inside, and extracting the password and SSID from the length.


Packet capture

We want to use the wireless network card to capture 802.1x WiFi messages and see what the broadcasted data looks like. Here we need to capture packets under Linux, because WiFi messages cannot be captured on Windows.

The system used here is Kali. Since the drivers of this system are all installed, you only need an external network card to capture.

But here we need to configure the network card first, we need to use the following two important commands


iw dev wlan0 interface add mon0 type monitor

ifconfig mon0 up


To understand why, you can refer to the following passage


Because of work, I need to monitor wireless network packets, especially IEEE802.11 management control frames (frames…actually I prefer to call them packets directly). My colleague opened wireshark and captured the wifi interface, but found that he heard a lot of ethernet frames but no wifi frames. Why? Let's see what the official website of wireshark says:

If you're trying to capture network traffic that's not being sent to or from the machine running Wireshark or TShark, ie traffic between two or more other machines on an Ethernet segment, or are interested in 802.11 management or control packets, or are interested in radio-layer information about packets, you will probably have to capture in "monitor mode". This is discussed below.

Without any interaction, capturing on WLAN's may capture only user data packets with "fake" Ethernet headers. In this case, you won't see any 802.11 management or control packets at all, and the 802.11 packet headers are "translated" by the network driver to "fake" Ethernet packet headers.

The answer is revealed. It turns out that this is because the wifi driver will automatically convert the wireless frame into an ethernet frame before giving it to the kernel, so that the protocol stack in the kernel will be easier to handle.

The question is, if I want to hear the wifi frame, what should I do? The answer is simple, set the wifi adapter to monitor mode. In wifi adapters, there is usually an SSID/ESSID filter, so even if the wifi adapter is set to promiscuous mode, it will be useless because it will still not be able to receive frames from SSIDs that are not joined by itself. What about monitor mode? Let's take a look at the following sentence:

In monitor mode the SSID filter mentioned above is disabled and all packets of all SSID's from the currently selected channel are captured.


This will add a network card on which you can capture WiFi messages.

Then open wireshark and you can capture packets happily.

But after capturing the process, I still didn't find anything from the data length.


Sniffing

ESP8266 has a function called sniffing mode, which allows you to continue to receive smartconfig messages in a sniffing manner to see what the content is.

The working path is reconfigured as shown below

insert image description here

Recompile and then burn the firmware

In this way, some frames were captured, similar to those captured by Wireshark


insert image description here

Analytical protocol

After two types of packet capture, we obtained the following information.


Start and stop messages

This kind of broadcast message always has a set of data sent in a loop at the beginning and end. What we see in Wireshark is

Cycle between 625 and 622,

insert image description here

Sniff caught the cycle between 599 and 596

insert image description here

The length of the middle

It should be encrypted. When sending the same password, the content is basically the same. When the password is changed, the length changes. It seems to be encrypted data.


Other valuable information cannot be guessed.


I found this article "AirKiss Technical Principles" on the Internet


There is a passage in it


To solve these two problems, before sending the link layer data (see the next section), it is necessary to send a 400ms preamble (400ms = 8*50ms, that is, if the device switches channels at a frequency of 50ms, it can cover 8 channels. Because the general user environment does not need to monitor 14 channels, it is sufficient to cover 8 channels). The preamble consists of 4 bytes, and its value is fixed to {1,2,3,4}. After receiving these preamble packets, the receiver uses the Length field in the SNAP packet to subtract it from the Length field to obtain the difference value. For example, the receiver intercepts the 802.2 SNAP format preamble data packet at the link layer through monitoring, and the values ​​of its Length field are 53, 54, 55, and 56 respectively. The difference value can be determined as 53-1=52. After that, the receiver subtracts 52 from the Length field value of the SNAP packet after receiving the data, and the actual information data can be obtained.


I don't know how to get this leading field yet. I'm afraid it's not done in the driver. Or it's a patent. Others can't get it.


In addition, the format they use cannot be seen from the message.

There is another article

"Wifi SmartConfig One-click Configuration", which introduces some TICC3000 things.


It seems that it is still very troublesome to make a similar function, and it is not a simple application. I will study it later.


Conclusion

After a day of hard work, there was no substantial breakthrough, but I did learn some techniques, such as capturing 802.1x messages, collecting smartconfig information everywhere, and found related content on the Internet, all of which were from one or two people.


Keywords:MCU Reference address:MCU---ESP8266Wifi SmartConfig one-click configuration (Part 2)

Previous article:MCU---HLK-W801 parallel port driver ST7789
Next article:MCU---ESP8266Wifi SmartConfig one-click configuration (I)

Recommended ReadingLatest update time:2024-11-16 14:59

51 MCU Design Scheme TOP10 (Part 9)
Design of optical power meter based on 51 single chip microcomputer    Abstract: The photoelectric sensor converts the light signal to be measured into an analog signal, and the analog signal is processed and analyzed by AD to obtain the parameter characteristics of the light signal and output it through serial port
[Analog Electronics]
51 MCU Design Scheme TOP10 (Part 9)
51 single chip microcomputer independent button
Button Introduction There are many types of buttons, with simple and complex functions, which greatly fill our lives. But no matter what, all buttons actually have a prototype, which comes from the same principle. All buttons, no matter how complex or gorgeous, are developed from such a prototype. It's like no matter
[Microcontroller]
51 single chip microcomputer independent button
Ways to measure frequency of any signal using 8051 microcontroller
Frequency is defined as cycles per second. It can also be defined as the reciprocal of the total time "T". In this project we will count the number of pulses entering port 3.5 of 8051 microcontroller and display it on 16*2 LCD display. So basically we measured the signal frequency at 8051 port 3.5. Here we use the AT8
[Microcontroller]
Ways to measure frequency of any signal using 8051 microcontroller
Design and research of heating temperature controller based on 89C51 single chip microcomputer and CAN bus
The Ministry of Construction requires that newly built public and residential buildings in cities and towns that use centralized heating facilities must design and install heating systems with household metering and room temperature control functions. Energy-saving heating temperature controllers use automatic control
[Power Management]
Capacitive touch sensing MCU working principle and basic characteristics
In today's electronic products, touch sensing technology is increasingly gaining more attention and application, and new technologies and ICs are constantly being introduced. At the same time, high-sensitivity capacitive touch technology is also developing rapidly, and is mainly used in capacitive touch screens and cap
[Microcontroller]
Section 11: PIC series microcontroller low power mode (SLEEP)
1. Enter SLEEP     Execute a "SLEEP" instruction to enter low power mode. When entering SLEEP, WDT is cleared and then restarts counting. The PD bit in the status register F3K is set to "0", the TO bit is set to "1", and the oscillation stops (referring to the oscillation circuit at the OSC1 end ). All I/O ports remai
[Microcontroller]
What is a microcontroller? What is a microcontroller used for?
If you say that there is no essential difference between a single-chip microcomputer and the computer we use (a chip)... This is not surprising. The fact is that a single-chip microcomputer is a simple but complete computer system. Although it is small, it has all the necessary functions. It is integrated into a chip.
[Microcontroller]
Microcontroller that combines Hi-Fi, intelligence and USB multi-channel features
With the continuous integration of many technological breakthroughs and new streaming services, and the growing prosperity of the smart home and smart speaker markets, consumers' demand for audio is no longer limited to sound quality itself, but more about pursuing high-quality life experience and convenient smart i
[Embedded]
Microcontroller that combines Hi-Fi, intelligence and USB multi-channel features
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号