Skip to content

Instantly share code, notes, and snippets.

View LukeMurphey's full-sized avatar

Luke LukeMurphey

View GitHub Profile
@LukeMurphey
LukeMurphey / splunk_tab_focus_fix.css
Created January 24, 2018 20:00
This CSS snippet fixes the issue where the focus box on tabs looks odd in Splunk
/**
* This fixes the issue where the tab focus looks weird.
*/
.nav-tabs > li > a:focus {
box-shadow: none !important;
}
.nav-tabs > li:focus-within:after {
box-shadow: inset -2px 2px 3px rgba(82, 168, 236, .5);
}
@LukeMurphey
LukeMurphey / splunk-search-from-python-example.py
Last active August 30, 2017 18:17
An example of kicking off a saved search from Python without using the SDK #splunk
import splunk.auth
import splunk.rest
import splunk.search
import json
import time
# Authenticate
session_key = splunk.auth.getSessionKey(username='admin', password='changeme')
search_to_run = "Errors in the last 24 hours"
@LukeMurphey
LukeMurphey / splunk_secure_storage_example.py
Last active May 4, 2022 19:53
An example of storing the contents of a file in the secure storage system in Splunk #splunk
import splunk.auth
import splunk.rest
import json
import hashlib
# Authenticate
session_key = splunk.auth.getSessionKey(username='admin', password='changeme')
# Read in the file
with open('password.txt', 'r') as myfile:
@LukeMurphey
LukeMurphey / custom_lookup.py
Created July 27, 2017 22:36
A base class that can be used for making external Splunk lookup commands #splunk
"""
This is a base-class for writing custom external lookups.
This is licensed under the Apache License Version 2.0
See https://www.apache.org/licenses/LICENSE-2.0.html
To use this, you will need to:
1) A lookup command script that implements from CustomLookup
2) Create a transforms.conf that declares your lookup command
@LukeMurphey
LukeMurphey / entitygroups.xml
Last active December 17, 2022 18:10
An update to 7 Days to Die that removes the stripper/party girl zombies (for A20). Place this in C:\Program Files (x86)\Steam\steamapps\common\7 Days To Die\Data\Config. This file can be recreated at any time by removing the entity nodes with the name of "zombieStripper". Originally from: http://bit.ly/2um1OL0
<?xml version="1.0" encoding="UTF-8"?>
<entitygroups>
<entitygroup name="ZombiesAll">
<entity name="zombieBoe"/>
<entity name="zombieJoe"/>
<entity name="zombieSteve"/>
<entity name="zombieTomClark"/>
<entity name="zombieMoe"/>
<entity name="zombieYo"/>
@LukeMurphey
LukeMurphey / splunk_simple_request_example.py
Last active June 1, 2017 04:15
A short example of using Splunk.rest to access the REST API #splunk
import splunk.auth
import splunk.rest
import json
# Authenticate
session_key = splunk.auth.getSessionKey(username='admin', password='changeme')
# Get lookup transforms
server_response, server_content = splunk.rest.simpleRequest('/services/data/transforms/lookups?count=0&output_mode=json', sessionKey=session_key)
@LukeMurphey
LukeMurphey / splunkuitest.py
Last active July 27, 2019 03:14
A Python module that loads test cases that were exported from the Selenium IDE and runs them against a Splunk install.
"""
This Python script loads test cases that were generated from the SeleniumIDE and executes them
against a running Splunk install. The purpose of this script is to make it possible to run tests
against Splunk without having to write code using WebDriver directly. Instead, the intent is that
testers write tests in the Selenium IDE GUI. This ought to make tests easier to write and maintain.
This is release under the Apache 2.0 Licence:
https://www.apache.org/licenses/LICENSE-2.0
@LukeMurphey
LukeMurphey / half_size_images.sh
Last active August 10, 2017 19:37
A bash script to reduce the size of images by 50% using ImageMagick
#!/bin/bash
mogrify -resize 50% "$@"
@LukeMurphey
LukeMurphey / SetupView.js
Last active August 7, 2017 20:58
A backbone base class for making SimpleXML setup views in Splunk #splunk
/*
* This view is intended to be used as a base class for simpleXML setup views. This class is
* intended to make creation of a setup view easier by:
*
* 1) Providing a mechanism for setting the app as configured so that users aren't redirected through setup again.
* 2) Providing a means for permission checking so that you can ensure that the user has admin_all_objects
*
* To use this class, you will need to do the following:
*
* 1) Make your view class sub-class "SetupView" (the class providing in this file)
@LukeMurphey
LukeMurphey / simple_rest_handler.py
Last active December 12, 2021 22:43
A REST handler base class that makes writing Splunk REST handlers that serve a custom conf file easier #splunk
"""
This includes a helper class (named RestHandler) that makes implementing a custom REST handler in Splunk very easy.
This is licensed under the Apache License Version 2.0
See https://www.apache.org/licenses/LICENSE-2.0.html
To use this, you will need to:
1) Define a restmap.conf and declare the handler
2) Define the Python code of the REST handler