Skip to content

Instantly share code, notes, and snippets.

@wheel5up
wheel5up / ffmpeg install
Created April 25, 2020 21:44
using brew install ffmpeg on Mojave
$ brew install ffmpeg
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 2 taps (homebrew/core and homebrew/cask).
==> Updated Formulae
gd ✔ embree goofys libcbor nifi-registry pulp swagger-codegen
asio ensmallen grafana libfido2 node-build q swift-sh
ask-cli faudio grin libmaa node-sass raylib ttygif
awsume feh groovy link-grammar now-cli re-flex tunnel
azcopy flyway groovysdk maxwell octave regina-rexx twar
@wheel5up
wheel5up / conv.sh
Created April 28, 2020 02:44
Quick script to convert MTS files to mp4 without transcodeing and keeping the original date
#!/bin/bash -x
exifdateformat='%Y:%m:%d %T%Z'
ffmpegdateformat='%FT%T'
filenamedateformat='%Y%m%d_%H%M%S'
for srcfile in "$@"
do
exifcreatetime=$(exiftool -s -s -s -datetimeoriginal $srcfile)
echo "Get date/time:$exifcreatetime"
ffmpegcreatetime=$(date -j -f "$exifdateformat" "$exifcreatetime" +"$ffmpegdateformat")
echo "transformed date/time:$ffmpegcreatetime"
@wheel5up
wheel5up / gist:da2a446ff00587ae2e220199f586bf2f
Created May 17, 2020 19:44
Synthetic GuardDuty Finding
{
"version":"0",
"id":"41bf9552-66c8-9430-5139-894482655fba",
"detail-type":"GuardDuty Finding",
"source":"aws.guardduty",
"account":"**********",
"time":"2020-01-17T15:00:00Z",
"region":"us-east-1",
"resources":[
@wheel5up
wheel5up / gist:fe7c90af7749e6ef1710e27baaa24dfc
Last active May 17, 2020 19:56
Lamdba function to map GuardDuty Findings to Opsgenie priorities
var AWS = require('aws-sdk');
exports.handler = (event, context, callback) => {
console.log(event);
console.log(context);
var sns = new AWS.SNS();
if ( event.detail.severity > 0.1 && event.detail.severity < 3.9 ) {
event.detail.priority = "P3";
} else if (event.detail.severity > 3.9 && event.detail.severity < 6.9 ) {
event.detail.priority = "P2";
} else if (event.detail.severity > 6.9 && event.detail.severity < 9.0 ) {
@wheel5up
wheel5up / shell.sh
Created September 30, 2020 01:28
update syslog facility dnsmasq
pi@pi-hole2:~ $ ls -l /etc/dnsmasq.d/01-pihole.conf
-rw-r--r-- 1 root root 1517 Aug 30 19:30 /etc/dnsmasq.d/01-pihole.conf
pi@pi-hole2:~ $ grep log-facility /etc/dnsmasq.d/01-pihole.conf
log-facility=/var/log/pihole.log
pi@pi-hole2:~ $ sudo sed -i "s/log-facility=.*/log-facility=local5/" /etc/dnsmasq.d/01-pihole.conf
pi@pi-hole2:~ $ ls -l /etc/dnsmasq.d/01-pihole.conf
-rw-r--r-- 1 root root 1504 Sep 30 02:08 /etc/dnsmasq.d/01-pihole.conf
pi@pi-hole2:~ $ grep log-facility /etc/dnsmasq.d/01-pihole.conf
log-facility=local5
@wheel5up
wheel5up / restartpihole.sh
Created September 30, 2020 01:37
Restart dns on pihole
pi@pi-hole2:~ $ ls -lasrt /var/log |tail -10
76 -rw-r----- 1 root adm 70204 Sep 29 06:25 syslog.1
4 -rw-r----- 1 root adm 314 Sep 29 06:25 messages
12152 -rw-r--r-- 1 pihole pihole 12441230 Sep 30 00:00 pihole.log.1
4 -rw-r--r-- 1 pihole pihole 559 Sep 30 00:00 pihole-FTL.log.1
0 -rw-r--r-- 1 pihole pihole 0 Sep 30 00:00 pihole-FTL.log
4 drwxr-xr-x 9 root root 4096 Sep 30 00:00 .
84 -rw-r----- 1 root adm 79311 Sep 30 02:10 auth.log
60 -rw-r----- 1 root adm 53494 Sep 30 02:15 syslog
76 -rw-r----- 1 root adm 73162 Sep 30 02:15 daemon.log
@wheel5up
wheel5up / shell.sh
Created September 30, 2020 01:50
Flush the pihole logs
pi@pi-hole2:~ $ ls -lasrt /var/log |tail -10
76 -rw-r----- 1 root adm 70204 Sep 29 06:25 syslog.1
12152 -rw-r--r-- 1 pihole pihole 12441230 Sep 30 00:00 pihole.log.1
4 -rw-r--r-- 1 pihole pihole 559 Sep 30 00:00 pihole-FTL.log.1
4 drwxr-xr-x 9 root root 4096 Sep 30 00:00 .
1160 -rw-r--r-- 1 pihole pihole 1180366 Sep 30 02:16 pihole.log
80 -rw-r----- 1 root adm 75936 Sep 30 02:16 daemon.log
84 -rw-r----- 1 root adm 80478 Sep 30 02:17 auth.log
8 -rw-r--r-- 1 pihole pihole 6392 Sep 30 02:18 pihole-FTL.log
108 -rw-r----- 1 root adm 106342 Sep 30 02:18 syslog
@wheel5up
wheel5up / shell.sh
Created October 2, 2020 01:45
fifo buffer output
$ cat /var/log/pihole.log
2020-10-01T20:43:27.338118-05:00 pi-hole2 dnsmasq[1362]: query[A] pug.jira-dev.com from 192.168.1.201
2020-10-01T20:43:27.340477-05:00 pi-hole2 dnsmasq[1362]: forwarded pug.jira-dev.com to 1.0.0.1
2020-10-01T20:43:27.350393-05:00 pi-hole2 dnsmasq[1362]: reply pug.jira-dev.com is 18.204.64.66
2020-10-01T20:43:27.352540-05:00 pi-hole2 dnsmasq[1362]: reply pug.jira-dev.com is 18.204.64.64
2020-10-01T20:43:27.354438-05:00 pi-hole2 dnsmasq[1362]: reply pug.jira-dev.com is 18.204.64.65
2020-10-01T20:43:33.990470-05:00 pi-hole2 dnsmasq[1362]: query[A] clients6.google.com from 192.168.1.60
2020-10-01T20:43:33.992609-05:00 pi-hole2 dnsmasq[1362]: cached clients6.google.com is <CNAME>
2020-10-01T20:43:33.994504-05:00 pi-hole2 dnsmasq[1362]: cached clients.l.google.com is 172.217.8.174
2020-10-01T20:43:34.214114-05:00 pi-hole2 dnsmasq[1362]: query[A] console.aws.amazon.com from 192.168.1.201
@wheel5up
wheel5up / tailLog.php
Created October 2, 2020 02:00
Updated tailLog.php file
<?php
/* Pi-hole: A black hole for Internet advertisements
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
* Network-wide ad blocking via your own hardware.
*
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license. */
require "password.php";
if(!$auth) die("Not authorized");
@wheel5up
wheel5up / Add Vulnerability.postman_collection.json
Created October 25, 2020 18:35
Reference design for postman collection to reconcile Security Scorecard issues with Jira
{
"info": {
"_postman_id": "adfce9c7-7a45-443d-9ae0-0fbc77075059",
"name": "Add Vulnerability",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "search jira for issue",
"event": [