Comments (2)
Couldn't see any packets from inside the Docker container with this snippet:
import socket
import struct
import binascii
raw_socket = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(0x0003))
while True:
packet = raw_socket.recvfrom(2048)
ethernet_header = packet[0][0:14]
ethernet_detailed = struct.unpack("!6s6s2s", ethernet_header)
arp_header = packet[0][14:42]
arp_detailed = struct.unpack("2s2s1s1s2s6s4s6s4s", arp_header)
# skip non-ARP packets
ethertype = ethernet_detailed[2]
if ethertype != '\x08\x06':
continue
print("****************_ETHERNET_FRAME_****************")
print("Dest MAC: ", binascii.hexlify(ethernet_detailed[0]))
print("Source MAC: ", binascii.hexlify(ethernet_detailed[1]))
print("Type: ", binascii.hexlify(ethertype))
print("************************************************")
print("******************_ARP_HEADER_******************")
print("Hardware type: ", binascii.hexlify(arp_detailed[0]))
print("Protocol type: ", binascii.hexlify(arp_detailed[1]))
print("Hardware size: ", binascii.hexlify(arp_detailed[2]))
print("Protocol size: ", binascii.hexlify(arp_detailed[3]))
print("Opcode: ", binascii.hexlify(arp_detailed[4]))
print("Source MAC: ", binascii.hexlify(arp_detailed[5]))
print("Source IP: ", socket.inet_ntoa(arp_detailed[6]))
print("Dest MAC: ", binascii.hexlify(arp_detailed[7]))
print("Dest IP: ", socket.inet_ntoa(arp_detailed[8]))
print("*************************************************\n")
from my-iot.
This altogether with DictReader
may really help:
nobody@raspberrypi:/app$ cat /proc/net/arp
IP address HW type Flags HW address Mask Device
192.168.2.13 0x1 0x2 xx:xx:xx:xx:xx:xx * wlan0
192.168.2.41 0x1 0x2 xx:xx:xx:xx:xx:xx * wlan0
172.18.0.2 0x1 0x2 xx:xx:xx:xx:xx:xx * br-7a16f1af2885
192.168.2.254 0x1 0x2 xx:xx:xx:xx:xx:xx * wlan0
from my-iot.
Related Issues (20)
- Make user setup class-based
- Custom 404 page
- Possibility to remove a channel altogether with the stored logs
- Print actual channel value in a browser tab title
- Implement Last-Modified and If-Modified-Since
- Control channels
- Display service status
- Re-think dashboard
- New name
- ESPHome API camera
- Streaming
- Keep actual values in memory only
- OAuth authentication via Google or so
- Proper SQLite download HOT 1
- Automation editor
- Compile YAML automation
- Integrate terminal emulator
- Millheat channel
- BLE channel
- ARP scan channel
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from my-iot.