Skip to content

Instantly share code, notes, and snippets.

@rmrf-run
rmrf-run / functions.php
Created September 5, 2014 15:42
Gravity forms validation for IP address, valid URLs, and regex
<?php
add_filter('gform_validation_1', 'ip_validation');
function ip_validation($validation_result){
$form = $validation_result["form"];
//validate input 9 on form 1 for valid IP
if($_POST['input_9'] != filter_var($_POST['input_9'], FILTER_VALIDATE_IP)){
$validation_result["is_valid"] = false;
foreach($form["fields"] as &$field){
if($field["id"] == "9"){
$field["failed_validation"] = true;
{
"title": "Apache Overview",
"services": {
"query": {
"list": {
"2": {
"id": 2,
"type": "topN",
"query": "",
"alias": "",
@rmrf-run
rmrf-run / 13-filter-bro.json
Last active December 22, 2017 06:26
Bro IDS - logstash-forwarder - Kibana Dashboard - Bro grok filter
filter {
if [message] =~ /^#/ {
drop { }
}
else {
if [type] == "BRO_httplog" {
grok {
match => [ "message", "(?<ts>(.*?))\t(?<uid>(.*?))\t(?<id.orig_h>(.*?))\t(?<id.orig_p>(.*?))\t(?<id.resp_h>(.*?))\t(?<id.resp_p>(.*?))\t(?<trans_depth>(.*?))\t(?<method>(.*?))\t(?<host>(.*?))\t(?<uri>(.*?))\t(?<referrer>(.*?))\t(?<user_agent>(.*?))\t(?<request_body_len>(.*?))\t(?<response_body_len>(.*?))\t(?<status_code>(.*?))\t(?<status_msg>(.*?))\t(?<info_code>(.*?))\t(?<info_msg>(.*?))\t(?<filename>(.*?))\t(?<tags>(.*?))\t(?<username>(.*?))\t(?<password>(.*?))\t(?<proxied>(.*?))\t(?<orig_fuids>(.*?))\t(?<orig_mime_types>(.*?))\t(?<resp_fuids>(.*?))\t(?<resp_mime_types>(.*))" ]
}
@rmrf-run
rmrf-run / bro-ids.json
Created September 22, 2014 15:44
Kibana Dashboard for Bro IDS, logstash, elasticsearch
{
"title": "Traffic Eth1 BRO IDS",
"services": {
"query": {
"idQueue": [],
"list": {
"0": {
"query": "files.log",
"alias": "",
"color": "#7EB26D",
@rmrf-run
rmrf-run / apache error
Last active August 29, 2015 14:07
Helpful logstash crap, simple logstash forwarder script to install LF on centos 6.0 and above boxes
APACHE_ERROR_TIME %{DAY} %{MONTH} %{MONTHDAY} %{TIME} %{YEAR}
APACHE_ERROR_LOG \[%{APACHE_ERROR_TIME:timestamp}\] \[%{LOGLEVEL:loglevel}\] (?:\[client %{IPORHOST:clientip}\] ){0,1}%{GREEDYDATA:errormsg}
@rmrf-run
rmrf-run / 10-syslog.conf
Last active August 29, 2015 14:07
partial working grok for sshd syslogs shipped with lumberjack
filter {
if [type] == "syslog" {
grok {
match => { "message" => "%{MONTH:month} %{MONTHDAY:day} %{TIME:time} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}"}
add_field => [ "received_at", "%{@timestamp}" ]
add_field => [ "event_time", "%{time}"]
add_field => [ "received_from", "%{host}" ]
add_field => ["logdate","%{month} %{day} %{time}"]
remove_field => ["month","day", "time"]
remove_field => ["syslog_pid"]
@rmrf-run
rmrf-run / elasticsearch.repo
Created October 14, 2014 19:11
elasticsearch.repo
[elasticsearch-1.1]
name=Elasticsearch repository for 1.1.x packages
baseurl=http://packages.elasticsearch.org/elasticsearch/1.1/centos
gpgcheck=1
gpgkey=http://packages.elasticsearch.org/GPG-KEY-elasticsearch
enabled=1
### Place in your /etc/cron.d/ directory
### Assumes your git folder is at /root/backup
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
HOME=/root/
* 2 * * * root cd /root/backup && iptables-save > /root/backup/iptables && git add . && git commit -m "Daily Backup" && git push >> /root/backup/log 2>&1
@rmrf-run
rmrf-run / README.md
Created January 29, 2016 17:16 — forked from ChrisCrewdson/README.md
Uptime Robot Dashing Widget

Simple Uptime Robot Dashing widget

Description

Dashing widget to display a short list of Uptime Robot monitors.

##Usage

Add this to your Gemfile and run bundle install:

@rmrf-run
rmrf-run / Readme.md
Created February 10, 2016 15:44 — forked from andre-morassut/Readme.md
Dashing - "hotness meter" widget

Dashing Hotness Meter Widget

This widget is based on the standard Dashing Meter widget and the Hotness Widget created by Rowanu.

What it does

Use it as the standard Meter widget and add the following attributes in your dashboard elements declaration :

  • data-cool : all values below this will display the "cool" colour. Use it to symbolize the "good" range of values.
  • data-warm : all values greater than this will display the "hot" colour. Use it to symbolize the "bad" range of values.