Comments (5)
from scapy.
I entered these commands to install scapy from Github instead of using pip:
git clone https://github.com/secdev/scapy
cd scapy
./run_scapy
bt = BluetoothHCISocket(0)
I encountered this error:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Users/.../Developer/scapy/scapy/layers/bluetooth.py", line 2506, in __init__
s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW, socket.BTPROTO_HCI) # noqa: E501
^^^^^^^^^^^^^^^^^^^
AttributeError: module 'socket' has no attribute 'AF_BLUETOOTH'
Indeed, macOS does not support AF_BLUETOOTH
in Python's socket
module. To work with Bluetooth in programming on macOS, you will need to use macOS-specific libraries or command-line tools like bluetoothctl
(on Linux) or macOS-specific low-level programming interfaces. A good solution would be to use the PyBluez
library.
So, I am applying some modifications in the code on my Mac (version : 14.2.1 (23C71)).
from scapy.
Could you show us your modifications? I don't understand if you modified Scapy to stop the exception from happening or if you added Bluetooth support on macOS.
from scapy.
I found a way to address the issue with the libc library that Scapy encountered when running on a Mac. The core issue was Scapy's attempt to load libc.so.6
, which is specific to Linux systems, while macOS uses libc.dylib
.
I implemented a conditional import based on the operating system. This solution utilizes the platform
module to dynamically determine the operating system at runtime and then load the appropriate C library. For Linux, it continues to load libc.so.6
, and for macOS, it switches to loading libc.dylib
.
import platform
import ctypes
ctypes.cdll.LoadLibrary("libc.{}".format("so.6" if platform.system() != "Darwin" else "dylib"))
libc = ctypes.CDLL("libc.{}".format("so.6" if platform.system() != "Darwin" else "dylib"))
As for the socket.AF_BLUETOOTH
issue on macOS, I'm currently exploring solutions and considering alternatives like PyBluez.
from scapy.
You said that already.
from scapy.
Related Issues (20)
- list object has no attribute display
- Sniffign in Monitor Mode on Windows Throws Exception - libpcap & WLanHelper path issue
- send(generator) skips first packet HOT 1
- smbclientserver test timing out in autopkgtest HOT 7
- TCPSession rebuild http session bug HOT 2
- sndrcv does not return control to user after KeyboardInterrupt HOT 3
- RFE: support for the DHCP "option overload" option
- Enhancement: Validate one-line comments HOT 1
- Incorrect RTCP SR + RR parsing HOT 6
- As of NetBSD 10.0, it is possible to send packets via bpf through loopback devices HOT 1
- ICMPv6 Time Exceeded is not using `length` field
- haslayer with conditional packet fields HOT 1
- Add stop_filter parameter to SndRcvHandler
- decrypted IPv6 packet using decrypt_esp for NAT-Traversal is return wrong packet
- tls appear as padding HOT 1
- Flaky DoIP test on MacOSX HOT 1
- TLS in Scapy should have more doc HOT 8
- RFE: mDNS unicast-response and cache-flush bits HOT 2
- Why is the encoding mode of 'ifreq' 16s16x? HOT 1
- Issue with Packet Creation in AH Tunnel Mode over Socket HOT 1
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 scapy.