Skip to content

Instantly share code, notes, and snippets.

View wildstray's full-sized avatar
🐺
I may be slow to respond.

Wild Stray wildstray

🐺
I may be slow to respond.
View GitHub Profile
@wildstray
wildstray / rspamd.local.lua
Created September 12, 2024 20:34
rspamd.local.lua for detecting phishing email made up of a single image with a link, and short or no other content at all
local function check_html_image(task, min, max)
local tp = task:get_text_parts()
for _,p in ipairs(tp) do
if p:is_html() then
local hc = p:get_html()
local len = p:get_length()
if len >= min and len < max then
local images = hc:get_images()
if images then
local count = 0
@wildstray
wildstray / bareos-fd-mariabackup.py.diff
Created March 31, 2024 17:12
A fast and easy change to bareos-fd-mariabackup.py to add tempdir parameter.
--- bareos-fd-mariabackup.py.orig 2024-03-28 13:56:48.000000000 +0100
+++ bareos-fd-mariabackup.py 2024-03-31 19:03:37.117059351 +0200
@@ -50,7 +50,7 @@
# we first create and backup the stream and after that
# the lsn file as restore-object
self.files_to_backup = ["lsnfile", "stream"]
- self.tempdir = tempfile.mkdtemp()
+ self.tempdir = None
# self.logdir = GetValue(bVarWorkingDir)
self.logdir = "/var/log/bareos/"
@wildstray
wildstray / twofactor_totp-0.8.0-gdlib.diff
Created September 10, 2023 15:36
Owncloud twofactor_totp 0.8.0 patch for using php-gd instead of php-imagick (BaconQrCode PR #114)
diff -urN twofactor_totp.orig/lib/Service/OtpGen.php twofactor_totp/lib/Service/OtpGen.php
--- twofactor_totp.orig/lib/Service/OtpGen.php 2023-07-29 15:23:22.000000000 +0200
+++ twofactor_totp/lib/Service/OtpGen.php 2023-09-10 12:15:29.411654688 +0200
@@ -17,9 +17,7 @@
namespace OCA\TwoFactor_Totp\Service;
-use BaconQrCode\Renderer\ImageRenderer;
-use BaconQrCode\Renderer\Image\ImagickImageBackEnd;
-use BaconQrCode\Renderer\RendererStyle\RendererStyle;
@wildstray
wildstray / generations.txt
Created June 23, 2023 16:15
Generations (IT humor)
EN 🇬🇧
Too much IT is bad, to play down and laugh about it... you will realize of the problem when you rewrite sociology in informatics key... 😅 😂
🖋 Analogic generation (born before 1975)
💾 Generation 8bit (born between 1975 and 1984)
📀 Generation 16bit (born between 1985 and 1994)
🖥 Generation 32bit (born between 1995 and 2005)
📱 Generation 64bit (born between 2005 and 2014)
🤖 Generation Qbit (born between 2015 and the present)
@wildstray
wildstray / ems_scan.py
Last active November 23, 2022 11:03
Modbus TCP scan for Contrel EMS meters and print configuration in human readable form
#!/usr/bin/env python3
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
from pymodbus.pdu import ExceptionResponse
from pymodbus.constants import Endian
from pymodbus.payload import BinaryPayloadDecoder
import sys
from tabulate import tabulate
if len(sys.argv) < 2:
print("Please specify hostname!")
@wildstray
wildstray / schneider_scan.py
Last active November 23, 2022 11:04
Modbus TCP scan for Schneider meters
#!/usr/bin/env python3
import os
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
from pymodbus.exceptions import ConnectionException, ModbusIOException
from pymodbus import mei_message
import signal
import sys
from tabulate import tabulate
# Credits: https://stackoverflow.com/questions/3173320/text-progress-bar-in-the-console
@wildstray
wildstray / qeed_scan.py
Last active November 23, 2022 11:24
Modbus TCP scan for Qeed meters and print configuration in human readable form
#!/usr/bin/env python3
from pymodbus.client.sync import ModbusTcpClient as ModbusClient
from pymodbus.pdu import ExceptionResponse
from pymodbus.constants import Endian
from pymodbus.payload import BinaryPayloadDecoder
import sys
from tabulate import tabulate
if len(sys.argv) < 2:
print("Please specify hostname!")
@wildstray
wildstray / qgenie_telnet.pl
Last active March 16, 2018 00:25
QNAP QG-103N "QGenie" hack: remote execution of telnetd ;-) It seems that QGenie firmware was originally something other (router?) from AXIMCom. Its firmware (up to last version available, 3.2.2) is really insecure: no privilege separation, no input validation neither user authentication for CGI scripts.
#!/usr/bin/perl
use strict;
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common qw(GET POST);
my ($nas_ip) = @ARGV;
die "$0 <QGenie_IP_Address>\n" if (not defined $nas_ip);
@wildstray
wildstray / arduclean.pl
Created December 8, 2017 15:10
Clean Arduino IDE working directory from old libraries and tools versions (quiet perl script tested under GNU/Linux only)
#!/usr/bin/env perl
use strict;
use warnings;
use File::Path qw(rmtree);
my $STAGING = ".arduino15/staging";
my $PACKAGES = ".arduino15/packages";
my $lastfile = "";
my $lastdir = "";