Skip to content

Instantly share code, notes, and snippets.

View gvanem's full-sized avatar

Gisle Vanem gvanem

View GitHub Profile
@gvanem
gvanem / color_print.c
Last active April 24, 2018 05:40
Windump colorized output. color_print.c should be put in 'win32/src'. Example output: http://www.watt-32.net/misc/windump-color-2.png
/*
* Colourised output printer for tcpdump/windump.
* For Win32 only.
*
* Written by G. Vanem <gvanem@yahoo.no> 2014.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@gvanem
gvanem / route-win32.c
Last active August 15, 2016 09:02
Modified libdnet + Nmap route-win32.c file for those MinGW-distros which doesn't have <NetioApi.h>. Also uses some IpHlpAPI functions dynamically to better support Win-XP. The .diff at bottom.
/*
* route-win32.c
*
* Copyright (c) 2002 Dug Song <dugsong@monkey.org>
*
* $Id: route-win32.c 589 2005-02-15 07:11:32Z dugsong $
*/
#ifdef _WIN32
#include "dnet_winconfig.h"
@gvanem
gvanem / enum_adapters.c
Last active January 31, 2024 10:50
A simple program to enumerate the adapters found by Win10Pcap. Ref: https://github.com/SoftEtherVPN/Win10Pcap
/*
* Simple program to enumerate the adapters found by Win10Pcap.
*
* Ref: https://github.com/SoftEtherVPN/Win10Pcap
*
* Put this file in the root directory of Win10Pcap-root and do:
*
* cl -nologo -W3 -Zi -Ot -DWIN32 -DWIN32COM_CPP -MTd -GF -GS -EHsc -RTCs -RTCu -RTCc
* -I./Packet_dll -Fe./enum_adapters.exe enum_adapters.c
* -link -nologo -debug Packet.lib user32.lib ws2_32.lib version.lib
@gvanem
gvanem / Makefile.MSVC
Last active May 26, 2018 03:06
GNU makefile for Pylibnet and MSVC.
#
# GNU Makefile for libnet.pyd (MSVC)
# Only Python 2.7 have been tested.
#
# By G. Vanem <gvanem@yahoo.no> 2013.
#
#
# Options and paths. Change to suite your setup.
#
@gvanem
gvanem / context.diff
Last active February 9, 2017 17:10
[Patch] Make GNU-diff context header more readable. A simple patch to get rid of the \tab in the diff header and aligning the '+++' and '---' lines on the timestamp. Thus making it more readable to see which file is newer or older.
--- a/src/context.c 2015-03-09 22:54:10
+++ b/context.c 2015-10-12 21:21:56
@@ -41,7 +41,8 @@
print_context_label (char const *mark,
struct file_data *inf,
char const *name,
- char const *label)
+ char const *label,
+ int alignment)
{
@gvanem
gvanem / make-usb.py
Last active December 5, 2017 11:43
USB enumerator using libusb and the Python-script make-usb.py. This script generates usb_vendors.c.
#!/usr/bin/env python
#
# make-usb.py : a modified Python-script from Wireshark.
# http://www.wireshark.org/
# Creates the examples/usb_vendors.c file containing vendor and
# product ids. It use the databases at
# http://www.linux-usb.org/usb.ids
#
# Changed by G. Vanem <gvanem@yahoo.no> 2012.
@gvanem
gvanem / Jan-Olsen-MP3.py
Last active April 24, 2018 05:34
Jan Olsen Podcast/MP3 download Python script
# !/usr/bin/env python
# -*- coding: iso-8859-1 -*-
r"""
A Python script to download all MP3 files for the character Jan Olsen
in the NRK P1 radio-show Lønsj. This will download from NRK's podcast
location at:
%s (a XML-file).
unless this RSS-file doesn't exist in %s already. This should
cause all the 153 MP3 files to be downloaded into the current directory
@gvanem
gvanem / SnmpMgr.c
Last active December 13, 2018 19:46
Windows SNMP client with libcurl
/*****************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
@gvanem
gvanem / Makefile.MSVC
Last active February 14, 2018 15:23
GNU-makefile for CubicSDR (MSVC): https://github.com/cjcliffe/CubicSDR.git
#
# GNU Makefile CubicSDR (MSVC).
#
THIS_FILE = Makefile.MSVC
VER_MAJOR = 0
VER_MINOR = 2
VER_PATCH = 3
VERSION = $(VER_MAJOR).$(VER_MINOR).$(VER_PATCH)
@gvanem
gvanem / TESTrun.py
Last active August 29, 2023 10:29
Tcpdump test-script in Python (not any horrid Perl stuff). With colourised output. Put in tcpdump's "tests" directory.
#!/usr/bin/env python
#
# TESTrun.py; my feeble attempt at a Python version of
# the Perl-script 'TESTrun'.
#
# G. Vanem <gisle.vanem@gmail.com> 2015 - 2023.
#
# Reads './TESTLIST' and by default perform all the tcpdump tests specified
# therein (test-spec="*"). Use option '-l' to list them.
#