Python: Subnetmaske, CIDR, Anzahl Hosts rechnen
Hostanzahl -> CIDR CIDR -> Hostanzahl CIDR -> Subnetmask Subnetmask -> CIDR
where do you want LAN bugs today?
Hostanzahl -> CIDR CIDR -> Hostanzahl CIDR -> Subnetmask Subnetmask -> CIDR
Das Beispiel gibt eine Liste mit allen Dateien und dem vollen Pfad zur Datei in allen Ordnern zurück.
Hetzner bietet einen kostenlosen DNS Service an welcher sich per API steuern lässt. Hierfür habe ich ein CLI Tool geschrieben in Python. Github Seite: lanbugs/hdns_cli: Hetzner DNS CLI Tool (github.com) PyPI Paket: hdns-cli · PyPI Description Hetzner provides an DNS service completely manageable via API, this tool gives you easy access via CLI to the … Weiterlesen
Hier eine „einfache“ Variante ein Flask Projekt mit Gunicorn und Caddy zu betreiben. Caddy ist ein Webserver welcher in GO geschrieben ist und von sich aus bereits HTTPS mit Letsencrypt macht, dabei ist Caddy ultraleicht einzurichten. In dem Beispiel verwenden wir Caddy um mit dem Backend Gunicorn Webserver zu sprechen, Caddy fungiert hier als Reverse … Weiterlesen
Hier zur DCACI Schulung die Umsetzung nur auf API in Python, die Schulung ist super, bezieht sich aber hauptsächlich auf die GUI, das Interessante an einem APIC ist ja ich möglichst viel über Automatisierung / die API löse. Alles weitere hier: lanbugs/DCACI_Lab_Solution_REST_API: DCACI training solution only with API (github.com) Beispiel: Lab 3: Task 1 – … Weiterlesen
Ich habe eine schöne Umsetzung gefunden auf Stackoverflow (Quelle: python – How to send email attachments? – Stack Overflow) um E-Mails mit Anhang zu versenden. Mail with attachment (python3) (github.com)
Hier ein kleiner Helfer um eine User => Gruppen Matrix automatisch zu bauen aus dem Active Directory. Anleitung und Code findet Ihr auch auf Github. lanbugs/get_ad_right_matrix: Script to export active directory user => group matrix to excel (github.com)
Wenn man ein System hat das isoliert ist, z.B. in einer DMZ und keinen Internetzugriff hat man aber trotzdem für python Pakete per pip installieren will kann man diese auf einem anderen System herunterladen mit allen Abhängigkeiten und diese dann im Zielsystem installieren. Quell und Zielsystem sollten die gleiche Python Version haben. Download z.B. von … Weiterlesen
This script exports over an Check_MK View hosts and imports them in SecureCRT Session Manager. Get source code: https://github.com/lanbugs/check_mk_to_securecrt_export The bundled python of SecureCRT not support urllib / urllib2 (see https://forums.vandyke.com/showthread.php?t=13127). I don`t want to modify the bundled python version of SecureCRT, so i have decided to put the code in an extra binary. The advantage … Weiterlesen
SSH Shell Menu written in Python Source: https://github.com/lanbugs/ssm This is a small python script for a shell menu to manage and open ssh connections. Requirements python3 dialog pythondialog Installation Install Debian packages and pip packages Copy ssm to /usr/bin/local Create connections.ini Create folder in home directory and create connections.ini file. For each server create a … Weiterlesen
Normalerweise erzeugt ein Python Dictionary einen „KeyError“ wenn auf einen Key zugegriffen wird der nicht existiert. Mit „defaultdict“ werden die Keys einfach erzeugt wenn sie nicht existieren. Ohne defaultdict: Mit defaultdict: Das Verhalten hat natürlich Vorteile wenn man mehrdimensionale Dictionarys bauen will: Ohne defaultdict: Mit defaultdict: Mehr dazu: https://docs.python.org/3/library/collections.html
Von ARISTA wird ein Python Paket bereitgestellt um über die eAPI mit dem Switch arbeiten zu können. Dies ist eine Qickanleitung. pyeapi Paket installieren ARISTA eAPI aktivieren Auf dem Arista Switch muss die API Schnittstelle aktiviert werden. Beispiel: Aktuelle running-config auslesen Beispiel: Command execute & result
With this script you can parse the postfix databases / lookuptables which are in berkley database format.
Das Skript verwende ich um aus der Plesk Datenbank alle gültigen E-Mail Adressen für einen Frondend Mailserver zu exportieren.
This tool exports every hardware asset from an Cisco device with a serial number. You can export the list as table or CSV. Download: https://gist.github.com/lanbugs/4dbed5e0e8a7d5b6d29c4ea9b9e93bb2 >python cisco_inventory.py -h usage: cisco_inventory.py [-h] -H HOST -v SNMP_VERSION [-C SNMP_COMMUNITY] [-u SNMP_USER] [-A SNMP_AUTH] [-a SNMP_AUTH_METHOD] [-X SNMP_PRIVACY] [-x SNMP_PRIVACY_METHOD] [-L SNMP_SECURITY] [–csv] Cisco inventory grabber Version 0.1 Written … Weiterlesen
This tool exports the complete AP inventory from an Cisco WLC. You can create an CSV export or an table. Download: https://gist.github.com/lanbugs/e86042c0b2afaf7166637a9aa9711cb6 $ python cisco_wlc_ap_grabber.py -h usage: cisco_wlc_ap_grabber.py [-h] -H HOST -v SNMP_VERSION [-C SNMP_COMMUNITY] [-u SNMP_USER] [-A SNMP_AUTH] [-a SNMP_AUTH_METHOD] [-X SNMP_PRIVACY] [-x SNMP_PRIVACY_METHOD] [-L SNMP_SECURITY] [–csv] Cisco AP WLC inventory grabber Version 0.1 Written … Weiterlesen
This a pipe backend for PowerDNS to MongoDB written in Python. Requirements pymongo python library powerdns min. version 4.x The MongoDB schema (for example DB: dns / Collection: records) For SOA records: { „name“:“example.org“, „type“:“SOA“, „content“:““, „ttl“: 300, „primary“: „ns1.example.org“, „mail“: „admin.example.org“, „serial“: 2018030311, „refresh“: 86400, „retry“: 7200, „expire“: 3600000, „nttl“: 3600 } For standard … Weiterlesen
– Kurze Zusammenfassung, ausführlich siehe Quelle am Ende des Artikels – Python Virtual Environment aufsetzen pip install virtualenv virtualenv projekt source projekt/bin/activate pip install uwsgi flask Mini Flask Applikation projekt.py from flask import Flask app = Flask(__name__) @app.route(„/“) def hello(): return „Hello world!“ WSGI Startfile wsgi.py from projekt import app if __name__ == „__main__“: app.run() … Weiterlesen
Per Default ist bei einer MongoDB Instanz keine Authentication aktiviert. Hier der kurze Weg. Admin Account anlegen devusr@testsystem:~# mongo MongoDB shell version v3.6.5 connecting to: mongodb://127.0.0.1:27017 MongoDB server version: 3.6.5 > use admin switched to db admin > db.createUser({user: „admin“, pwd: „geheimes_passwort“, roles: [{ role: „root“, db: „admin“ }]}) Successfully added user: { „user“ : … Weiterlesen