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 python | |
import fileinput | |
import re | |
import sys | |
file = fileinput.FileInput("/etc/ssh/sshd_config", inplace=True, backup=".bak") | |
for line in file: | |
line = re.sub(r".*Banner.*","Banner /etc/issue.net", line) | |
sys.stdout.write(line) | |
file.close() |
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 python | |
filename = 'test.txt' | |
search = 'foobar' | |
with open(filename) as f: | |
for num, line in enumerate(f, 1): | |
if search in line: | |
print '%s - found at line:' % search, num |
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 python | |
# -*- coding: utf-8 -*- | |
# write config to file with cisco archive command | |
# see more in blog article: https://lanbugs.de/netzwerktechnik/hersteller/cisco/cisco-python-backup-der-konfiguration-bei-write-event-auf-externen-server/ | |
from flask import Flask | |
from flask import request | |
app = Flask(__name__) |
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 python | |
import mysql.connector | |
cnx = mysql.connector.connect(user='psa_readonly', password='securepassword', host='127.0.0.1', database='psa') | |
target = "smtp:[plesk_beckend_server.xxxx.xxx]:25" | |
buffer = "" |
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 python | |
# Need following pip packages | |
# - easysnmp | |
# - tabulate | |
# Checkout blog article to tool | |
# https://lanbugs.de/netzwerktechnik/commandline-tool-to-export-current-registered-users-at-aps-from-an-cisco-wireless-lan-controller-wlc/ | |
from easysnmp import Session |
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 python | |
from bsddb3 import db | |
filename = "/var/spool/postfix/plesk/virtual.db" | |
target = "smtp:[backend_plesk_server]:25" | |
postfix_db = db.DB() | |
postfix_db.open(filename, None, db.DB_HASH, db.DB_DIRTY_READ) |
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 python | |
# Need following pip packages | |
# - easysnmp | |
# - tabulate | |
# Checkout blog article to tool | |
# https://lanbugs.de/netzwerktechnik/hersteller/cisco/commandline-tool-for-exporting-cisco-hardware-inventory-via-snmp/ | |
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 | |
# | |
# SQLiteToMemory | |
# Python class to load sqlite3 database to memory and back to file | |
# Written by Maximilian Thoma 2019 | |
# Version 0.1 | |
# | |
import sqlite3 |
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 python | |
# required pip packages: lxml, beautifulsoup4, tabulate | |
from bs4 import BeautifulSoup as BS | |
import urllib2 | |
import ssl | |
import urllib | |
from tabulate import tabulate |
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 python | |
# Need following pip packages | |
# - easysnmp | |
# - tabulate | |
# Checkout blog article to tool | |
# https://lanbugs.de/netzwerktechnik/hersteller/cisco/cli-tool-export-ap-inventory-from-an-cisco-wireless-lan-controller-wlc/ | |