Skip to content

Instantly share code, notes, and snippets.

View sphaero's full-sized avatar

Arnaud Loonstra sphaero

View GitHub Profile
@sphaero
sphaero / winipaddr.py
Last active September 15, 2024 16:51
Get windows ipadresses info
#!/usr/bin/env python
#
# For the sake of humanity here's a python script retrieving
# ip information of the network interfaces.
#
# Pay some tribute to my soul cause I lost a few years on this one
#
# based on code from jaraco and many other attempts
# on internet.
# Fixed by <@gpotter2> from scapy's implementation to
@sphaero
sphaero / glesgeneric.c
Last active June 24, 2019 18:10
Gstreamer glimagesink raspberry pi generic example
/*
* GStreamer GLES2 Raspberry Pi example
* Based on http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/tests/examples/gl/generic/cube/main.cpp
* Modified for Raspberry Pi/GLES2 by Arnaud Loonstra <[email protected]>
* Orginal by Julien Isorce <[email protected]>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
# win_socket_test.py
#
# Test using netcat:
# nc -un 127.0.0.1 1200
# Broadcast test:
# socat - UDP-DATAGRAM:255.255.255.255:1200,broadcast
import socket
import struct
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
from pyre import zbeacon
import zmq
import struct
import uuid
import socket
ctx = zmq.Context()
beacon = zbeacon.ZBeacon(ctx, 1200)
transmit = struct.pack('cccb16sH', b'Z',b'R',b'E',
1, uuid.uuid4().bytes,
@sphaero
sphaero / dyn_dns_app.py
Last active April 6, 2020 16:04
Simple DynDNS Service using (apache) webserver and DNSMasq
#!/usr/bin/env python
# Simple Dynamic DNS update script for use with DNSMasq
#
# Install this WSGI script on a (apache) webserver. Make sure
# DNSMasq runs as the same user as this script does on the webserver
# E.g: /etc/default/dnsmasq add: (Debian and deriatives)
# DNSMASQ_USER='wsgiuser'
#
# ### DNSMASQ.CONF ###
# domain-needed
@sphaero
sphaero / urwid_zmq_event_loop.py
Last active January 18, 2020 03:43
Urwid ZeroMQ event loop class. For all your console joy with 0mq
# A ZeroMQ Event loop class for Urwid. This class inherits from the original
# SelectEventLoop and replaces the filedescriptor polling with the ZeroMQ
# methods.
# Author: Arnaud Loonstra <[email protected]>
import zmq
import time
class ZmqEventLoop(urwid.SelectEventLoop):
# Based on http://carnivore.it/2012/10/12/python3.3_sendmsg_and_recvmsg
# Example of using the new recvmsg() method of the sockets module
import ipaddress
import socket
import ctypes
# First, we have to tell the socket we want to receive this additional data.
# As the socket module lacks some constants, we need to define them too.
IP_PKTINFO = 8
@sphaero
sphaero / get_ifs.py
Created January 2, 2014 10:31
Get all interfaces and ipaddressen, python3 compatible. Tested on Linux
# Compatible with Python3, tested on Linux
# Author Arnaud Loonstra <[email protected]>
# based on <http://code.activestate.com/recipes/439093/#c1>
import socket
import fcntl
import struct
import array
import sys