Skip to content

Instantly share code, notes, and snippets.

View jasonish's full-sized avatar

Jason Ish jasonish

View GitHub Profile
@jasonish
jasonish / git-backup.sh
Created November 14, 2012 15:15
Script to backup your git repos and optionally push them to another remote.
#! /bin/sh
#
# Script to backup git repositories.
#
# For each subdirectory ending in .git:
# - perform a git fetch from origin.
# - perform a git push --all to all remotes other than origin.
repos=`find * -type d -name \*.git`
<!--
Extract JSP tag libs. This is so JSPs can find the taglibs when we
are using embedded Jetty, which seems to have trouble finding them. So put
them into our own jars classpath and it seems to work. The other option is
to shade the jar using the maven shade plugin.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
@jasonish
jasonish / gist:8903058
Created February 9, 2014 17:55
YAML based rule variables (translated by Suricata into rule-variable form)
vars:
address-groups:
HOME_NET: &HOME_NET
- 192.168.0.0/16
- 10.0.0.0/8
- 172.16.0.0/12
- not:
- 10.1.1.1/32
EXTERNAL_NET:
- not: *HOME_NET

Keybase proof

I hereby claim:

  • I am jasonish on github.
  • I am ish (https://keybase.io/ish) on keybase.
  • I have a public key whose fingerprint is 13F1 B6CB 851D 0565 8C27 9D3D 97F0 4794 1370 36B3

To claim this, I am signing this object:

@jasonish
jasonish / gist:5d363f357b9928629786
Created October 29, 2014 22:59
Playing with JGit
package rulemanager;
import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.api.errors.GitAPIException;
import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.revwalk.RevCommit;
import org.eclipse.jgit.revwalk.RevTree;
import org.eclipse.jgit.revwalk.RevWalk;
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
@jasonish
jasonish / gist:8976189e91947246f53a
Created January 13, 2015 16:15
Current logrotate configuration for Suricata.
/var/log/suricata/*.log /var/log/suricata/*.json
{
rotate 3
daily
missingok
nocompress
sharedscripts
postrotate
/bin/kill -HUP `cat /var/run/suricata-internal.pid` || true
endscript
@jasonish
jasonish / dnp3-sample.rules
Created April 20, 2015 16:48
dnp3-samples.rules
# 1 - Function code match - either direction.
alert dnp3 any any -> any any ( \
msg:"DNP3 Sample function code match"; \
dnp3_func:21; \
sid:1; rev:1;)
# 2 - Internal indicators. Applies to client only.
# - Providing multiple flags in one dnp3_ind option will match if any
# of the flags are set. Use dnp3_ind multiple times to alert on a specific
# combination of flags.
@jasonish
jasonish / dnp3-log-sample.txt
Last active August 29, 2015 14:20
DNP3 logging sample.
"dnp3": {
// This is actually 16 bits of flags. Should the flags be broken out into a list of symbolic names?
//
// Examples:
// - List flags that are set.
// "iin": ["device_restart", "class_3_events"]
// - List state of all flags:
// "iin": {
// "device_restart": true,
@jasonish
jasonish / eve-dnp3.json
Last active August 29, 2015 14:21
Sample DNP3 transaction logging
{
"dnp3": {
"iin": {
"indicators": [
"device_restart",
"class_2_events",
"class_1_events"
],
"value": 34304
},
@jasonish
jasonish / dnp3.json
Created May 15, 2015 16:43
Sample DNP3 request/response logging.
{
"dnp3": {
"application": {
"objects": [
{
"variation": 0,
"group": 1
}
],
"function_code": 1,