Skip to content

Instantly share code, notes, and snippets.

View wfrisch's full-sized avatar

Wolfgang Frisch wfrisch

View GitHub Profile
@wfrisch
wfrisch / http-serve-incomplete-responses.py
Created February 1, 2024 09:15
Deliberately broken HTTP server that responds with either a) false Content-Length or b) broken chunked encoding
#!/usr/bin/env python3
"""
Deliberately broken HTTP server that responds with either
- false Content-Length
- broken chunked encoding
both triggering ChunkedEncodingError in clients using `python-requests`:
- ChunkedEncodingError: Connection broken: IncompleteRead
- ChunkedEncodingError: Connection broken: InvalidChunkLength
"""
@mgerstner
mgerstner / README.md
Created November 23, 2021 10:43
Connection to hosts D-Bus daemon not working from within user namespace

When trying to enter a user namespace and still communicating with the rest of the Linux system via D-Bus then this won't work:

$ unshare -U -r
$ root # dbus-monitor --system
Failed to open connection to system bus: Did not receive a reply. Possible causes include: \
 the remote application did not send a reply, the message bus security policy blocked the reply, \
 the reply timeout expired, or the network connection was broken.

The reason for this is a bit intricate. It is not found on kernel permission level but in the D-Bus userspace logic. It is explained in this mailing list post:

@jhass
jhass / dump_socket.sh
Last active June 11, 2024 13:15
Capture unix socket to pcap file with socat and tshark
#!/bin/bash
# Parameters
socket="/run/foo.sock"
dump="/tmp/capture.pcap"
# Extract repetition
port=9876
source_socket="$(dirname "${socket}")/$(basename "${socket}").orig"