Passive Scan on ESP8266(AP Beacon)

ESP_Kewal
Posts: 2
Joined: Mon Jul 25, 2016 2:23 pm

Passive Scan on ESP8266(AP Beacon)

Postby ESP_Kewal » Sat Apr 22, 2017 6:42 pm

The attached example code decodes AP details by catching beacon from each access point. The ESP8266 works in sniffer mode. Please go through the readme and sniffer.c and sniffer.h file. Also ESP8266 cannot connect to any access point in sniffer mode. You need to disable sniffer mode on esp8266 before connecting to access point.
Attachments
passive scan.rar
(278.34 KiB) Downloaded 269 times
Regards,
Kewal Shah

User avatar
pratik
Posts: 467
Joined: Wed Jun 29, 2016 7:17 pm
Location: India
Contact:

Re: Passive Scan on ESP8266(AP Beacon)

Postby pratik » Wed Apr 26, 2017 1:26 pm

Thanks for posting, this is rather helpful!
Regards,
Pratik Panda
Website: http://www.PratikPanda.com

Custom firmware, Knowledge base and freelancing (ESP8266/ESP32):
http://www.iot-bits.com

hanehalthy
Posts: 1
Joined: Tue Jun 20, 2017 3:05 pm

Re: Passive Scan on ESP8266(AP Beacon)

Postby hanehalthy » Tue Jun 20, 2017 3:07 pm

你好,如何才能获取Sniffer到1470长度的整个数据包?

请问是否够在
wifi_set_opmode(STATION_MODE); // Promiscuous works only with station mode
wifi_set_channel(channel);
wifi_promiscuous_set_mac(dstMac);
wifi_promiscuous_enable(disable);
wifi_set_promiscuous_rx_cb(promisc_cb); // Set up promiscuous callback
wifi_promiscuous_enable(enable);

之后,在
void promisc_cb(uint8_t *buf, uint16_t len)
{}
里面获取整个Sniffer到 的数据包,我发送的包长度是1500,但每次在回调函数里面获取的包长是60,128,为什么?

RozaliaDum
Posts: 1
Joined: Wed Jul 26, 2017 5:34 pm

Passive Scan on ESP8266AP Beacon

Postby RozaliaDum » Thu Oct 26, 2017 6:43 pm

Hi

My objective is to get the beacon data from advertising data i.e. uuidManfacturing dataMajor_Minortxpower,

I am unable to get whole beacon data from ble.start scan,

Pleas help me in this regard,

The following is the code,
---------------------------------------------
if device.advertisementData return;


if device.scanRecord return;




var byteArray = evothings.util.base64DecToArrdevice.scanRecord;
var pos = 0;
var advertisementData = ;
var serviceUUIDs;
var serviceData;

while pos < byteArray.length
var length = byteArraypos;
if length == 0
break;

length -= 1;
var type = byteArraypos;


var BLUETOOTH_BASE_UUID = -0000-1000-8000-00805f9b34fb

// Convert 16-byte Uint8Array to RFC-4122-formatted UUID.
function arrayToUUIDarray, offset
var k = 0;
var string = ;
var UUID_format = 4, 2, 2, 2, 6;
for var l = 0; l < UUID_format.length; l
if l = 0
string = -;

for var j = 0; j < UUID_formatl; j, k
string = evothings.util.toHexStringarrayoffset k, 1;


return string;


if type == 0x02 type == 0x03 // 16-bit Service Class UUIDs.

serviceUUIDs = serviceUUIDs ? serviceUUIDs : ;
for var i = 0; i < length; i = 2
serviceUUIDs.push
0000
evothings.util.toHexString
evothings.util.littleEndianToUint16byteArray, pos i,
2
BLUETOOTH_BASE_UUID;


if type == 0x04 type == 0x05 // 32-bit Service Class UUIDs.

serviceUUIDs = serviceUUIDs ? serviceUUIDs : ;
for var i = 0; i < length; i = 4
serviceUUIDs.push
evothings.util.toHexString
evothings.util.littleEndianToUint32byteArray, pos i,
4
BLUETOOTH_BASE_UUID;


if type == 0x06 type == 0x07 // 128-bit Service Class UUIDs.

serviceUUIDs = serviceUUIDs ? serviceUUIDs : ;
for var i = 0; i < length; i = 16
serviceUUIDs.pusharrayToUUIDbyteArray, pos i;


if type == 0x08 type == 0x09 // Local Name.

advertisementData.kCBAdvDataLocalName = evothings.ble.fromUtf8
new Uint8ArraybyteArray.buffer, pos, length;

if type == 0x0a // TX Power Level.

advertisementData.kCBAdvDataTxPowerLevel =
evothings.util.littleEndianToInt8byteArray, pos;

if type == 0x16 // Service Data, 16-bit UUID.

serviceData = serviceData ? serviceData : ;
var uuid =
0000
evothings.util.toHexString
evothings.util.littleEndianToUint16byteArray, pos,
2
BLUETOOTH_BASE_UUID;
var data = new Uint8ArraybyteArray.buffer, pos 2, length - 2;
serviceDatauuid = base64.fromArrayBufferdata;

if type == 0x20 // Service Data, 32-bit UUID.

serviceData = serviceData ? serviceData : ;
var uuid =
evothings.util.toHexString
evothings.util.littleEndianToUint32byteArray, pos,
4
BLUETOOTH_BASE_UUID;
var data = new Uint8ArraybyteArray.buffer, pos 4, length - 4;
serviceDatauuid = base64.fromArrayBufferdata;

if type == 0x21 // Service Data, 128-bit UUID.

serviceData = serviceData ? serviceData : ;
var uuid = arrayToUUIDbyteArray, pos;
var data = new Uint8ArraybyteArray.buffer, pos 16, length - 16;
serviceDatauuid = base64.fromArrayBufferdata;

if type == 0xff // Manufacturer-specific Data.

// Annoying to have to transform base64 back and forth,
// but it has to be done in order to maintain the API.
advertisementData.kCBAdvDataManufacturerData =
base64.fromArrayBuffernew Uint8ArraybyteArray.buffer, pos, length;


pos = length;

advertisementData.kCBAdvDataServiceUUIDs = serviceUUIDs;
advertisementData.kCBAdvDataServiceData = serviceData;
device.advertisementData = advertisementData;

Waiting for your response,

Thanks and Regards,
Murali

JamelBF
Posts: 1
Joined: Fri Nov 17, 2017 7:23 pm

Re: Passive Scan on ESP8266(AP Beacon)

Postby JamelBF » Fri Nov 17, 2017 7:39 pm

Hello guys. I'm new here.
Where can I see the information with the basics of the work?
Maybe something for beginners? Very interesting. :)
My spec: Apple Mac mini 2.8GHz Intel Core i5 Dual Core, 8GB RAM, 1TB Fusion Drive
"I have been developing for 5 years,my current project.Beta for now."

Who is online

Users browsing this forum: No registered users and 1 guest