Skip to content

Instantly share code, notes, and snippets.

View darkshade9's full-sized avatar

Aaron Dean darkshade9

  • OH
View GitHub Profile
@darkshade9
darkshade9 / ipscan.sh
Created July 27, 2018 14:03
Finds an available IP address by scanning current records
#!/bin/bash
firstOctetinRange=9
secondOctet=253
foundIP=0
for i in $ovpn_ip
do
ovpn_octet=$(echo $i | cut -f 4 -d .)
if [[ 10.${secondOctet}.0.${ovpn_octet} = 10.${secondOctet}.0.${firstOctetinRange} && $foundIP = 0 ]]; then
echo "$i is taken, trying the next IP"
127.0.0.1 r1---sn-cvh7knez.googlevideo.com
127.0.0.1 r2---sn-cvh7knez.googlevideo.com
127.0.0.1 r3---sn-cvh7knez.googlevideo.com
127.0.0.1 r4---sn-cvh7knes.googlevideo.com
127.0.0.1 r5---sn-cvh7knez.googlevideo.com
127.0.0.1 r6---sn-cvh7knez.googlevideo.com
127.0.0.1 r7---sn-cvh7knez.googlevideo.com
127.0.0.1 r8---sn-cvh7knez.googlevideo.com
127.0.0.1 r9---sn-cvh7knez.googlevideo.com
127.0.0.1 r10---sn-cvh7knez.googlevideo.com
@darkshade9
darkshade9 / neo4j_logs_template.json
Last active March 27, 2017 19:02
neo4j_logs Elasticsearch 5.x Template
{
"order": 0,
"template": "neo4j_logs-*",
"settings": {},
"mappings": {
"neo4j_logs": {
"properties": {
"@timestamp": {
"type": "date"
},
@darkshade9
darkshade9 / logstash-neo4j-querylog.txt
Last active November 7, 2019 12:10
neo4j query log grok
if [type] == "neo4j_logs" {
if [source] == "/var/log/neo4j/query.log" {
grok {
match => ["message", "%{TIMESTAMP_ISO8601:datetime} %{WORD:severity} +%{NUMBER:ms} ms: %{NOTSPACE:session-type} %{WORD:protocol} %{WORD:remoteUser} %{NOTSPACE:driver}/(\[)?%{DATA:driver-version}(\])? client/%{IP:clientip}:%{NUMBER:clientport} server/%{IP:serverip}:%{NUMBER:serverport}> %{WORD:remoteUser} - %{GREEDYDATA:query} - (%{GREEDYDATA:parameters})? - {}"]
match => ["message", "%{TIMESTAMP_ISO8601:datetime} %{WORD:severity} +%{NUMBER:ms} ms: %{NOTSPACE:session-type} %{WORD:protocol} %{IP:clientip} %{GREEDYDATA:endpoint} %{WORD:remoteUser} - %{GREEDYDATA:query} - (%{GREEDYDATA:parameters})? - {}"]
}
}
}
@darkshade9
darkshade9 / ScaleAzureVM.ps1
Last active March 9, 2017 17:02
Scale Azure VM Up or Down
#Param needs to be either 'up' or 'down'
#scaleSize is optional if you know EXACTLY the name of the VM size you want
param(
[Parameter(Mandatory = $true)]
[String] $scale,
[Parameter(Mandatory = $false)]
[String] $scaleSize
)
$subscrip = "SUBSCRIPTIONNAME"
@darkshade9
darkshade9 / gist:75df25877d150c19e4f66f2e9044ac09
Created February 9, 2017 17:10
Elasticsearch Watcher Example (Elasticsearch 5.x)
{
"trigger": {
"schedule": {
"interval": "60s"
}
},
"input": {
"search": {
"request": {
"indices": ["indexname-*"],
%{TIMESTAMP_ISO8601:timestamp} %{WORD:severity} \[%{DATA:category}\] %{GREEDYDATA:message}
{
"template": "network-*",
"settings": {
"index": {
"refresh_interval": "5s"
}
},
"mappings": {
"network": {
"dynamic_templates": [{
{
"trigger": {
"schedule": {
"interval": "60s"
}
},
"input": {
"search": {
"request": {
"indices": [
\<%{POSINT:pid}\>%{SYSLOGTIMESTAMP:syslog_timestamp} %{IPORHOST:syslog_server}\[%{SYSLOGPROG}\]: %{IP:client_ip}:%{NUMBER:client_port} \[%{HAPROXYDATE:accept_date}\] %{NOTSPACE:frontend_name} %{NOTSPACE:backend_name}/%{NOTSPACE:server_name} %{NUMBER:time_request}/%{NUMBER:time_queue}/%{NUMBER:time_backend_connect}/%{NUMBER:time_backend_response}/%{NOTSPACE:time_duration} %{NUMBER:http_status_code} %{NOTSPACE:bytes_read} %{DATA:captured_request_cookie} %{DATA:captured_response_cookie} %{NOTSPACE:termination_state} %{NUMBER:actconn}/%{NUMBER:feconn}/%{NUMBER:beconn}/%{NUMBER:srvconn}/%{NOTSPACE:retries} %{NUMBER:srv_queue}/%{NUMBER:backend_queue} (\{%{HAPROXYCAPTUREDREQUESTHEADERS}\})?( )?(\{%{HAPROXYCAPTUREDRESPONSEHEADERS}\})?( )?\"%{WORD:http_verb} %{URIPATHPARAM:http_request}( HTTP/%{NUMBER:http_version}\")?