View create_computer_object.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create computer object in OU | |
# Written by Maximilian Thoma 2023 | |
# More infos at https://lanbugs.de | |
from ldap3 import Connection | |
from ldap3.core.exceptions import LDAPException | |
import random | |
BACKEND_USER = "CN=Backend User,CN=Users,DC=ad,DC=local" | |
BACKEND_PASS = "SuperSecret" |
View flask_ad_ldap3_auth_and_autorization.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# FLASK with LDAP3 authentication against active directory and authorization check for group membership | |
# Written by Maximilian Thoma 2023 | |
# Visit: https://lanbugs.de for more ... | |
from functools import wraps | |
from flask import Flask, request, redirect, url_for, render_template, abort | |
from flask_login import LoginManager, UserMixin, login_user, login_required, logout_user, current_user | |
from ldap3 import Server, Connection, SUBTREE, SIMPLE |
View subnet_merge.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from netaddr import IPNetwork | |
from pprint import pprint | |
# right must be in left | |
def main(left_side, right_side): | |
with open(right_side, "r") as f: | |
raw_right = f.readlines() | |
View merge_subnets.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
from netaddr import cidr_merge | |
def main(FILE): | |
with open(FILE) as f: | |
raw_lines = f.readlines() | |
subnets = [] |
View cpl_merge.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import yaml | |
from loguru import logger | |
import glob | |
from pprint import pprint | |
import json | |
from netaddr import cidr_merge | |
import ipaddress | |
@logger.catch |
View cpl_delta.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import sys | |
from loguru import logger | |
@logger.catch | |
def cpl_parser(lines): | |
root = {} | |
View netbox_webhook_listener.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import hmac | |
from apiflask import APIFlask | |
import logging | |
from flask import request | |
from apiflask import Schema, abort | |
from apiflask.fields import String, Dict, DateTime, UUID | |
APP_NAME = "netbox-webhook-listener" | |
WEBHOOK_SECRET = "secret" |
View teampass_shell_exporter.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Teampass Shell Exporter | |
// Written by Maximilian Thoma 2022 | |
// Variables | |
// ************************************************** | |
// Path to sources directory of teampass | |
$path = "/var/www/html/sources"; | |
// Salt from teampass-seckey.txt | |
$salt = "<salt>"; |
View install_docker.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
GREEN="\e[32m" | |
ENDCOLOR="\e[0m" | |
echo -e " ${GREEN}Welcome to Docker-CE installer for Ubuntu 18.04/20.04/22.04 ...${ENDCOLOR} " | |
echo -e " ${GREEN}---------------------------------------------------------------${ENDCOLOR} " | |
echo -e " ${GREEN}You will be asked for your sudo password if set.${ENDCOLOR} " | |
echo -e " ${GREEN}>>> Get repo update ...${ENDCOLOR} " |
View flask_oidc_check_resource_access.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# | |
# flask_oidc_check_resource_access.py | |
# Written by Maximilian Thoma 2022 | |
# Visit https://www.lanbugs.de | |
# Free to use for everyone, without any warranty :-) | |
# | |
# Manual / Remarks | |
# I use it together with flask-oidc and Keycloak to give permission to API endpoint only to defined role. | |
# Its a wrapper function you can use together with @oidc.accept_token |
NewerOlder