GoogleFindMyTools ของ Leon Böttger เป็นการนำเครือข่าย Google Find My Device กลับมาสร้างใหม่ โดยสามารถทำงานร่วมกับอุปกรณ์ Android และตัวติดตามเชิงพาณิชย์ นอกจากนี้ยังมีการรองรับอุปกรณ์ติดตาม Bluetooth ที่ใช้ ESP32 ในรูปแบบทดลอง
การใช้งานมีสององค์ประกอบหลักได้แก่ สคริปต์ Python main.py ซึ่งใช้สำหรับแสดงรายการและค้นหาตำแหน่งอุปกรณ์, และเฟิร์มแวร์ของ ESP32 โดยใช้ภาษา C พร้อมกับ ESP-IDF นอกจากนี้คอมพิวเตอร์โฮสต์จะต้องติดตั้งไลบรารี Python หลายตัวผ่านคำสั่ง “pip install -r requirements.txt” และต้องใช้เว็บเบราว์เซอร์ Google Chrome
นี่คือผลลัพธ์ของสคริปต์ Python บนแล็ปท็อป Ubuntu ของฉัน:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
jaufranc@CNX-LAPTOP-5:~/edev/sandbox/GoogleFindMyTools$ python main.py Loading... [UsernameProvider] Username was not setup yet. Type your Google Username (Email without @gmail.com)') and press 'Enter':[email protected] [FCMReceiver] Credentials updated. [FCMReceiver] Listening for notifications. [AuthFlow] This script will now open Google Chrome on your device to login to your Google account. > Please make sure that Chrome is installed on your system. > For macOS users only: Make that you allow Python (or PyCharm) to control Chrome if prompted. [AuthFlow] Press Enter to continue... [AuthFlow] Installing ChromeDriver... [AuthFlow] ChromeDriver installed and browser started. [AuthFlow] Waiting for 'oauth_token' cookie to be set... [AuthFlow] Retrieved Account Token successfully. The following trackers are available: 1. Oppo A98 5G: xxxx-0000-2551-xxxx-xxxxxxxx If you want to see locations of a tracker, type the number of the tracker and press 'Enter'. If you want to register a new ESP32-based tracker, type 'r' and press 'Enter': |
หลังจากลงชื่อเข้าใช้บัญชี Google ของฉัน สคริปต์สามารถค้นหาสมาร์ทโฟนของฉันได้ จากนั้นฉันสามารถเลือกตัวเลือก 1 เพื่อรับพิกัด GPS ของสมาร์ทโฟน หรือ ลงทะเบียนตัวติดตาม Bluetooth ที่ใช้ ESP32 ฉันยังไม่มีตัวติดตามดังกล่าว แต่ลองทดสอบดู:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
If you want to register a new ESP32-based tracker, type 'r' and press 'Enter': r Loading... [SharedKeyRetrieval] You need to log in again to access end-to-end encrypted keys to decrypt location reports. This script will now open Google Chrome on your device. Make that you allow Python (or PyCharm) to control Chrome (macOS only). [SharedKeyRetrieval] Press 'Enter' to continue... [SharedKeyFlow] Signed in successfully. [SharedKeyFlow] Received Shared Key. Registered device successfully. Copy the Advertisement Key below. It will not be shown again. Afterward, go to the folder 'GoogleFindMyTools/ESP32Firmware' and follow the instructions in the README.md file. +------------------------------------------------------------------------------+ | 2acbd5cd41b7acbedef192f0141cd5b4a62345df | | Advertisement Key | +------------------------------------------------------------------------------+ |
ฉันต้องลงชื่อเข้าใช้ Google อีกครั้งเพื่อให้สคริปต์ดึง คีย์ที่ใช้ร่วมกัน (shared key) มาใช้งาน จากนั้นฉันได้รับ คีย์โฆษณา (advertisement key) (ซึ่งฉันได้แก้ไขสำหรับโพสต์นี้)คีย์นี้ต้องคัดลอกและวางลงใน บรรทัดที่ 15 ของไฟล์ main.c แทนที่ “INSERT_YOUR_ADVERTISEMENT_KEY_HERE”:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
#include <stdio.h> #include <stdint.h> #include <string.h> #include <stdlib.h> #include "esp_bt.h" #include "esp_gap_ble_api.h" #include "esp_log.h" #include "nvs_flash.h" // For NVS functions like nvs_flash_init #include "esp_bt_main.h" // For esp_bluedroid_* functions #include "esp_err.h" // For error handling #define TAG "ESP_FMDN" // This is the advertisement key / EID. Change it to your own EID. const char *eid_string = "INSERT_YOUR_ADVERTISEMENT_KEY_HERE"; // Function to convert a hex string into a byte array void hex_string_to_bytes(const char *hex, uint8_t *bytes, size_t len) { for (size_t i = 0; i < len; i++) { sscanf(hex + 2 * i, "%2hhx", &bytes[i]); } } |
กระบวนการนี้ควรทำใน Visual Studio โดยต้องติดตั้ง ESP-IDF framework ไว้ก่อนจากนั้นสามารถคอมไพล์เฟิร์มแวร์ และแฟลชลงบนตัวติดตาม ESP32 ที่เชื่อมต่อกับคอมพิวเตอร์โฮสต์ผ่าน USB ได้
จากนั้นเราสามารถ รัน main.py อีกครั้ง และสคริปต์จะสามารถค้นหาทั้งสมาร์ทโฟน และตัวติดตาม ESP32 ที่ลงทะเบียนใหม่:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
jaufranc@CNX-LAPTOP-5:~/edev/sandbox/GoogleFindMyTools$ python main.py Loading... The following trackers are available: 1. Oppo A98 5G: xxxx-0000-2551-xxxx-xxxxxxxx 2. GoogleFindMyTools ESP32: xxxx-0000-2ad2-xxxx-xxxxxxxx If you want to see locations of a tracker, type the number of the tracker and press 'Enter'. If you want to register a new ESP32-based tracker, type 'r' and press 'Enter': 1 [LocationRequest] Requesting location data for device with canonic ID: xxxx-0000-2551-xxxx-xxxxxxxx [FCMReceiver] Listening for notifications. [FCMReceiver] Notification received! [LocationRequest] Location request successful. ---------------------------------------- [DecryptLocations] Decrypted Locations: Latitude: 11.3347438 Longitude: 10.8444803 Altitude: 2580 Time: 2025-02-12 09:58:34 Status: 1 Is Own Report: True ---------------------------------------- |
เนื่องจากฉันไม่มีตัวติดตาม ESP32 ฉันจึงทดสอบกับสมาร์ทโฟนของฉันแทน แต่ผลลัพธ์ควรจะคล้ายกันหากใช้กับตัวติดตาม ESP32 ที่ทำงานได้จริง ซึ่งอาศัยสมาร์ทโฟนในเครือข่าย Google Find My Device เพื่อระบุตำแหน่ง ไม่ต้องกังวล ฉันได้แก้ไขค่าด้านบนเพื่อความเป็นส่วนตัวแล้ว
สามารถทำได้ดี แต่มีปัญหาที่ทราบกันดีเกี่ยวกับการใช้งานบน ESP32 ได้แก่:
- ขณะนี้ อาจต้องลงทะเบียน ESP32 ใหม่ทุก 3 วัน แต่ Leon กำลังหาทางแก้ไข
- ผู้ใช้บัญชีใหม่ ควรใช้แอป Find My Device บน Android ก่อนลงทะเบียนตัวติดตาม ESP32 (แต่ฉันไม่ต้องทำ)
- ตำแหน่งของตัวติดตาม ESP32 สามารถดูได้เฉพาะผ่าน สคริปต์ Python เท่านั้น ไม่สามารถดูได้ในแอปหรือเว็บไซต์ Google Find My Device
- คุณสมบัติด้านความเป็นส่วนตัว เช่น การหมุนที่อยู่ MAC ยังไม่ได้ถูกนำมาใช้
- เฟิร์มแวร์ของ ESP32 ถูกออกแบบมาให้ค้นหารายงานเครือข่ายให้ได้มากที่สุด ไม่ได้เน้นประหยัดพลังงาน
คุณสามารถดูคำแนะนำฉบับเต็มและซอร์สโค้ดได้บน GitHub หากคุณสนใจโซลูชันโอเพ่นซอร์สสำหรับตัวติดตาม สามารถดูโครงการ AirGuard ใช้กับสมาร์ทโฟน Android หรือ iOS เพื่อตรวจจับ Samsung Trackers (SmartTags), Google Find My Network Trackers และ Apple AirTags
แปลจากบทความภาษาอังกฤษ : GoogleFindMyTools locates ESP32-based Bluetooth trackers using Google Find My Device network
![สุธินี-small](https://th.cnx-software.com/wp-content/uploads/2021/02/สุธินี-small.jpg)
บรรณาธิการข่าวและบทความภาษาไทย CNX Software ได้มีความสนใจในด้านเทคโนโลยี โดยเฉพาะ Smart Home และ IoT