Created
August 29, 2021 00:24
-
-
Save wlach/e2352ae652dea067349627ed671e0d71 to your computer and use it in GitHub Desktop.
tailscale whois example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import socket | |
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) | |
server_address = "/var/run/tailscaled.socket" | |
sock.connect(server_address) | |
# this doesn't work | |
# but `http://local-tailscaled.sock/localapi/v0/status` does | |
sock.sendall( | |
b"GET http://local-tailscaled.sock/localapi/v0/whois?addr=100.87.138.81 HTTP/1.1\nHost: local-tailscaled.sock\n\n" | |
) | |
print(sock.recv(200)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment