Skip to content

Instantly share code, notes, and snippets.

@wdormann
Created October 8, 2024 12:18
Show Gist options
  • Save wdormann/85426467dd5a1d310d1d208fc16ade23 to your computer and use it in GitHub Desktop.
Save wdormann/85426467dd5a1d310d1d208fc16ade23 to your computer and use it in GitHub Desktop.
Crash macOS Sequoia with a simple attempt to use a Unix datagram
import socket
import os
def main():
# Create a Unix Datagram (DGRAM) socket
sock = socket.socket(socket.AF_UNIX, socket.SOCK_DGRAM)
# Bind the socket to a file
socket_path = './sock'
if os.path.exists(socket_path):
os.remove(socket_path)
sock.bind(socket_path)
# Connect the socket to its own address
sock.connect(socket_path)
# Send data
sock.send(b'test')
# Receive data
data = sock.recv(4)
print(data)
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment