Skip to content

Instantly share code, notes, and snippets.

@defanator
defanator / gist:4715322
Created February 5, 2013 15:54
Sample output of upsc command for Ippon UPS.
defan@hs:~/bin$ upsc ippon
battery.charge: 100
battery.voltage: 13.70
battery.voltage.high: 12.60
battery.voltage.low: 10.60
battery.voltage.nominal: 12.0
beeper.status: enabled
device.type: ups
driver.name: blazer_usb
driver.parameter.pollinterval: 2
@defanator
defanator / amazon-id.conf
Created September 23, 2015 10:27 — forked from schlomo/amazon-id.conf
Amazon ID plugin for YUM. This will add 2 headers to the HTTP requests. With these headers the YUM repo server can identify the EC2 instance. These files come from the rh-amazon-rhui-client RPM package found on RHEL EC2 instances, probably part of the Red Hat Update Infrastructure (https://access.redhat.com/products/red-hat-update-infrastructure/)…
[main]
enabled=1
#!/bin/bash
usage()
{
cat <<EOF
Usage: $(basename $0) [options]
This shell script is a simple wrapper around the openssl binary. It uses
s_client to get certificate information from remote hosts, or x509 for local
certificate files. It can parse out some of the openssl output or just dump all
raspberry pi 1 model b (2 USBs):
$ cat /proc/cpuinfo
processor : 0
model name : ARMv6-compatible processor rev 7 (v6l)
BogoMIPS : 2.28
Features : half thumb fastmult vfp edsp java tls
CPU implementer : 0x41
CPU architecture: 7
CPU variant : 0x0
@defanator
defanator / nginx-memleaktest.sh
Last active November 9, 2016 19:31
nginx memory leaks monitoring
#!/bin/sh
nginxpidfile=/var/run/nginx.pid
if [ ! -e ${nginxpidfile} ]; then
echo "nginx pid file (${nginxpidfile}) not found" >&2
exit 1
fi
ppid=`cat ${nginxpidfile}`
@defanator
defanator / testapp.ini
Last active March 31, 2017 08:43
Test WSGI application useful for debugging purposes
[uwsgi]
uid=nginx
gid=nginx
socket = 0.0.0.0:3131
max-requests = 4000
buffer-size = 16384
master = true
log-master = true
die-on-term = true
vacuum = true
@defanator
defanator / flaskapp.py
Created November 16, 2016 12:43
Test WSGI application using Flask
#!/usr/bin/env python
#
# ./nginman --listen 9999 --py-path `pwd` --py-module flaskapp
from flask import Flask
from flask import request
from werkzeug.debug import get_current_traceback
application = Flask(__name__)
@defanator
defanator / libmodsecurity-with-nginx-debug-log.txt
Created November 24, 2016 15:07
Triggering rule 920440 from OWASP CRS v3.0.0
[4] (Rule: 920440) Executing operator "@rx" with param "\.(.*)$" against REQUEST_BASENAME.
[9] T (0) t:urlDecodeUni: "/nginx_signing.key"
[9] T (1) t:lowercase: "/nginx_signing.key"
[9] Target value: "/nginx_signing.key" (Variable: REQUEST_BASENAME)
[4] Operator completed in 0.000027 seconds
[4] Rule returned 1.
...
[4] (Rule: 949110) Executing operator "@ge" with param "5" Was: "%{tx.inbound_anomaly_score_threshold}" against TX:ANOMALY_SCORE.
[9] Target value: "0" (Variable: TX:ANOMALY_SCORE)
[6] Resolving: tx.inbound_anomaly_score_threshold to: 5
@defanator
defanator / modsecurity-scoring.t
Created November 24, 2016 17:50
ModSecurity-nginx connector tests
#!/usr/bin/perl
# Tests for ModSecurity module.
###############################################################################
use warnings;
use strict;
use Test::More;
---i7wdgemV---A--
[29/Nov/2016:11:09:10 +0000] 148041775067.012532 127.0.0.1 53931 127.0.0.1 80
---i7wdgemV---B--
GET /?param="><script>alert(1);</script> HTTP/1.1
REQUEST_HEADERS:User-Agent: curl/7.38.0
REQUEST_HEADERS:Host: localhost
REQUEST_HEADERS:Accept: */*
---i7wdgemV---D--
---i7wdgemV---E--
---i7wdgemV---F--