Skip to content

Instantly share code, notes, and snippets.

View malfaux's full-sized avatar

malfaux malfaux

View GitHub Profile
@malfaux
malfaux / patch-xt_RAWNAT.diff
Created January 5, 2014 13:47
xtables RAWNAT patch to allow easy round-robin of udp/tcp data between multiple local processes
--- /home/build/aur/xtables-addons/orig-src/src/xtables-addons-1.46/extensions/xt_RAWNAT.c 2012-08-23 16:54:21.000000000 +0300
+++ /home/build/aur/xtables-addons/src/xtables-addons-1.46/extensions/xt_RAWNAT.c 2012-11-30 18:13:18.000000000 +0200
@@ -154,7 +154,30 @@
__be32 new_addr;
iph = ip_hdr(*pskb);
- new_addr = remask(iph->daddr, info->addr.ip, info->mask);
+ if(info->mask < 32) {
+ void *transport_hdr = (void *)iph + ip_hdrlen(*pskb);
+ struct tcphdr *tcph;
@malfaux
malfaux / brutecounter.txt
Last active February 28, 2020 12:17
#hattrickmalfaux bruteforced md5 cracker. well, rather a brute counter....
#!/usr/bin/python
"""
for user1796738@stackoverflow.com
in reply to the stackoverflow thread: http://stackoverflow.com/questions/13210943/md5-brute-forcing
which was closed by some weirdos
=>> problem description <snip from the above url>, posted by user1796738:
... In someone's puzzle game, I reached this puzzle. I tried searching for an answer or a way
@malfaux
malfaux / dnslabel_case#hattrick-malfaux.txt
Last active January 2, 2016 05:59
#hattrickmalfaux branch-free, loop-unrolled lower (upper) case transform algorithm for DNS labels, following yet-another-way to do hex2chars
The normal path one takes to lowercase a string is to test if the character is uppercase and add 'a'
to it if so, while looping over the characters in the given string. A clean implementation may be
found in djbdns source code:
void case_lowerb(char *s,unsigned int len)
{
unsigned char x;
while (len > 0) {
--len;
x = *s - 'A';
@malfaux
malfaux / ubuntu-deb-src-util-linux-2.7.12_getty_login_args.diff
Created January 4, 2014 08:53
getty can't execute a login program with arguments
diff -Nru util-linux-2.17.2/login-utils/agetty.8 util-linux-2.17.2_login_params_patch/login-utils/agetty.8
--- util-linux-2.17.2/login-utils/agetty.8 2010-02-04 13:53:56.000000000 +0200
+++ util-linux-2.17.2_login_params_patch/login-utils/agetty.8 2011-04-06 14:54:31.962879000 +0300
@@ -12,6 +12,7 @@
.I port
.I baud_rate,...
.RI [ term ]
+.RI "[-- [login_program parameters]]"
.br
.BR "agetty " [\-8ihLmnw]
diff -Nru ./mux.c ../../openssh-5.5p1//mux.c
--- ./mux.c 2010-01-30 08:36:33.000000000 +0200
+++ ../../openssh-5.5p1//mux.c 2011-01-19 22:44:47.288605002 +0200
@@ -602,7 +602,8 @@
return 0;
}
/* XXX support rport0 forwarding with reply of port assigned */
- if (fwd.listen_port == 0 || fwd.listen_port >= 65536) {
+ //if (fwd.listen_port == 0 || fwd.listen_port >= 65536) {
+ if (fwd.listen_port >= 65536) {
@malfaux
malfaux / ipaddress.py.diff
Last active December 21, 2015 14:08
backport of ipaddress.py from python3 to python2
--- /usr/lib/python3.3/ipaddress.py 2013-05-21 18:50:37.000000000 +0300
+++ ipaddress.py 2013-08-23 13:22:40.310226926 +0300
@@ -1,5 +1,8 @@
# Copyright 2007 Google Inc.
# Licensed to PSF under a Contributor Agreement.
+#
+# backported to python 2.x by (malfaux) cia@mud.ro
+#
"""A fast, lightweight IPv4/IPv6 manipulation library in Python.
@malfaux
malfaux / softdog_autostart_debian-3.2.0-1
Created May 10, 2012 08:25
softdog autostart patch generated against debian linux kernel 3.2.0-1
--- linux-source-3.2-mods/drivers/watchdog/softdog.c 2012-05-10 04:29:31.928352117 -0400
+++ linux-source-3.2/drivers/watchdog/softdog.c 2012-04-13 12:11:03.000000000 -0400
@@ -65,12 +65,6 @@
"Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-#define WATCHDOG_AUTOSTART 0
-static int autostart = WATCHDOG_AUTOSTART;
-module_param(autostart,
- "Start the timer automagically on init (default="
@malfaux
malfaux / softdog_autostart_linux-2.6.38-gentoo-r6.diff
Created July 3, 2011 08:36
softdog autostart patch generated against gentoo kernver 2.6.38
--- ../x/linux-2.6.38/drivers/watchdog/softdog.c 2011-03-15 01:20:32.000000000 +0000
+++ ./drivers/watchdog/softdog.c 2011-06-15 18:44:44.000000000 +0000
@@ -64,6 +64,13 @@
"Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+#define WATCHDOG_AUTOSTART 0
+static int autostart = WATCHDOG_AUTOSTART;
+module_param(autostart,int,0);
+MODULE_PARM_DESC(autostart,