Skip to content

Instantly share code, notes, and snippets.

@alfonsrv
alfonsrv / wake_supermicro.py
Last active April 2, 2023 10:47
Start and stop Supermicro servers for replica job via IPMI – since wake on lan does not work reliably for one of my servers. Uses the web interface directly so no ipmi binary is required – since supplying the username for ipmiutil didn't want to work reliably for me either
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Rau Systemberatung GmbH (www.rausys.de)
# Licensed under the GNU General Public License, Version 3
import argparse
import re
from time import sleep
from base64 import b64encode
@alfonsrv
alfonsrv / datev_belegtransfer.py
Last active April 3, 2023 08:07
DATEV Belegtransfer Auto-Login nach 30 Tagen Inaktivität
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Rau Systemberatung GmbH (rausys.de)
# Licensed under the GNU General Public License, Version 3
import subprocess
from typing import List
from pywinauto import Application
@alfonsrv
alfonsrv / find_administrator.yml
Last active April 15, 2023 12:23
Ansible – Find Domain Administrator used in Services, Processes and Scheduled Tasks using Ansible and PowerShell
---
# RAUSYS 2023, Leistungsstarker IT-Partner
# www.rausys.de
- name: Find all Services, Processes and Scheduled Tasks using the Domain Administrator
hosts: all
gather_facts: no
strategy: free
tasks:
- name: Domain Administrator Inspection via PowerShell
@alfonsrv
alfonsrv / github_mails.py
Created November 26, 2022 22:04
Find GitHub users' email addresses by their commit mails – quick and dirty scanner; yikes!
import requests
from collections import Counter
# Create empty token to authenticate against GitHub API (no checkboxes checked)
TOKEN = ''
# Define the user you'd like to scan mails for
USER = ''
BASE_URL = 'https://api.github.com'
PARAMS = {
@alfonsrv
alfonsrv / argon-eon.md
Last active September 26, 2022 06:39
Argon EON allow hard drive spin down with hd-idle – EON spin down idle disks

Argon EON's OLED display does not allow for tools like hd-idle to detect when drives are inactive due to constant temperature, RAID and usage checks, thus preventing spin down of the drives.

The responsible Python script is slowed down to a more senseful value using the decorator / extra bit of code below.

Simply insert the code from the Gist below in your /etc/argon/argonsysinfo.py and add @no_spinup above the following functions that already exist within the file:

@alfonsrv
alfonsrv / m365-xoauth-dump.py
Created August 6, 2022 10:40
Microsoft 365 XOAuth IMAP – create token and test login
import base64
import imaplib
from time import sleep
from typing import Union, Tuple
import requests
MAIL = 'migrate@domain.tld'
SERVER = 'outlook.office365.com' # used for IMAP Auth
AUTH_URL = 'https://login.microsoftonline.com' # OAuth2 endpoint
@alfonsrv
alfonsrv / SmtpRelay.py
Last active July 2, 2022 12:12
SMTP relay server in Python smtpd – forward incoming mails to remote SMTP server | simple smtp proxy server
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Rau Systemberatung GmbH (rausys.de)
# Licensed under the GNU General Public License, Version 3
import asyncore
import smtpd
import os
@alfonsrv
alfonsrv / proxy.py
Created June 5, 2022 15:01
asyncio Man-in-the-Middle Proxy – allowing for bidirectional streaming
"""
Bidirectional asyncio TCP man-in-the-middle proxy
allowing for both serverside- and clientside-triggered
network events.
github/alfonsrv, 2022
Licensed under Mozilla Public License 2.0
"""
import asyncio
@alfonsrv
alfonsrv / camera.py
Last active August 2, 2023 12:43
Motion detection with OpenCV + grab static snapshot every 1 second from RTSP video stream
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# Copyright (c) Rau Systemberatung GmbH (rausys.de)
# MIT License
# credits: https://pyimagesearch.com/start-here/
import argparse
import os
from datetime import datetime, timedelta