Skip to content

Instantly share code, notes, and snippets.

View 13Cubed's full-sized avatar

Richard Davis 13Cubed

View GitHub Profile
@13Cubed
13Cubed / checklog.py
Created February 20, 2016 04:26
Use RegEx (Regular Expressions) to search through files for specific text.
#!/usr/bin/python
import sys
import re
def ParseLog(filename, search_string):
try:
f = open(filename, 'rU')
except IOError:
print '\n*** I/O Error: Can\'t read file', filename, '***\n'
@13Cubed
13Cubed / service
Created February 20, 2016 04:24
This template can be used to create a service script for Red Hat Enterprise Linux. It will enable you to use “service myservice start”, “service myservice stop”, or “service myservice status” to control a particular process.
#!/bin/bash
# Replace myservice with your service name. Insert commands where noted.
# chkconfig: - 99 00
# Source function library.
. /etc/rc.d/init.d/functions
case "$1" in
start)
echo -n "Starting myservice"
@13Cubed
13Cubed / ossec-installer.sh
Last active January 27, 2016 18:43
OSSEC HIDS agent installation script for RHEL/CentOS.
#!/bin/bash
# This script simplifies the installation of the OSSEC HIDS Agent for RHEL/CentOS boxes.
# Are we running is root?
if [ $(id -u) -ne 0 ]; then
echo
echo "This script must be run as root!"
echo
exit;
fi
@13Cubed
13Cubed / audit-tool.py
Created January 27, 2016 18:42
A simple file comparison utility written in Python.
#!/usr/bin/python
# audit-tool.py 2.0 - A simple file comparison utility.
# Copyright 2014 13Cubed. All rights reserved. Written by: Richard Davis
import sys
def compareFiles(filename1, filename2, ignorecase, bidirectional):
"""
Given two filenames and an ignorecase booelean, compares filename1
against filename2 and returns list of the differences and a count of