Skip to content

Instantly share code, notes, and snippets.

View peterfroehlich's full-sized avatar

Peter Fröhlich peterfroehlich

  • gutefrage.net GmbH
  • Munich, Germany
View GitHub Profile
#!/usr/bin/env python3
""" Fake email domain crawler
uses search page of known temp mail provider to crawl domains
These domains are getting used on, among others:
https://generator.email/
https://emailfake.com/
https://email-fake.com/
1.) slowly retrives results for strings aaa-zzz, validates DNS and stores in set
2.) fetches public tld list from icann
3.) writes entry with one "." and known tld into outfile
@peterfroehlich
peterfroehlich / graylog2.drl
Created March 27, 2014 15:55
Graylog2 0.2.x drools file
rule "access log"
when
m : Message( message matches ".*access.*:.*" )
then
Matcher matcher = Pattern.compile("^.* (.*\\.log): ([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}).* \"([A-Z]{3,7}) (.*) HTTP/1.1\" ([0-9][0-9][0-9]) ([0-9]{1,}) \"(.*)\" \"(.*)\" (?<=[ ])([0-9]+$)").matcher(m.getMessage());
if (matcher.find()) {
m.addField("_Logfile",matcher.group(1));
m.addField("_clientIp",matcher.group(2));
m.addField("_Method",matcher.group(3));
m.addField("_URI",matcher.group(4));
@peterfroehlich
peterfroehlich / syndic.py
Last active August 29, 2015 13:57
Salt executor method to sync files to syndics
def sync_syndic():
'''
Sync defined folders and files from the salt master to the syndic fileserver
Looks for production specific top file to replace top.sls on syndics
'''
base_dir = "/srv/salt/"
dirs_to_sync = ["salt-cloud", "_modules", "_grains", "_runners", "scripts", "states"]
files_to_sync = []
production_top = "top-prod.sls"
@peterfroehlich
peterfroehlich / munin-generic.py
Created November 14, 2013 10:58
Generic munin shell cmd monitor replace monitor_cmd with your shell cmd
#!/usr/bin/env python
# munin-deleted-files.py
#
# Generic munin shell cmd monitor
# replace monitor_cmd with your shell cmd
#
from sys import exit,argv
import subprocess
@peterfroehlich
peterfroehlich / commit_to_youtrack.py
Last active June 2, 2022 19:47
Mercurial hook to parse commit messages of just pushed commits for Youtrack IDs and post the commits and a link to the mercurial web interface as comments into the matching Youtrack ticket.
#!/usr/bin/env python
'''Get mercurial hook and post commit message with link to hg page to youtrack issue as comment.
Installation:
Add hook entry in your hgrc:
[hooks]
incoming = python:/<path>/commit-to-youtrack.py:hook
[youtrack-hook]
ID = EXPL,EG,OPS
AGGRO = False
@peterfroehlich
peterfroehlich / vms.py
Last active March 16, 2022 20:53
Virtual Machine Snapshots - This tool eases the usage on virtual machine snapshots from inside the target vm. It can list, create and delete snapshots. Needs authorized credentials of ESX/ESXi/vCenter Server.
#!/usr/bin/env python
# List, create, delete vmware vsphere snapshots with unix-like user interface.
# This assumes that the vm name are equal to the hostname or the fqdn
# Requirements: pysphere >= 0.1.6 If Python < 2.7: argparse
#
# Peter Froehlich (tarwin@tarwin.de) @ 03/2013
#
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by

graystreamlogger

Introduction

graystreamlogger is a python script born out of necessity. Use graylogger.py to send GELF-formatted messages to a graylog host. You may log string messages, file contents or read from stdin, add additional fields. Host name and timestamp will be provided automatically.