Skip to content

Instantly share code, notes, and snippets.

View BobBurns's full-sized avatar

Bob Burns BobBurns

  • Santa Cruz, CA
View GitHub Profile
@BobBurns
BobBurns / check-zpool.go
Created May 28, 2021 15:11
prometheus zpool check freebsd
package main
import (
"fmt"
"log"
"os/exec"
"bufio"
"strings"
"net/http"
"time"
@BobBurns
BobBurns / prom-serve.go
Created February 23, 2021 19:25
prometheus-disk-usage-exporter
package main
import (
"fmt"
"log"
"os/exec"
"bufio"
"strings"
"strconv"
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/time.h>
#include <net/bpf.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
@BobBurns
BobBurns / bpf-fun-1.c
Created January 3, 2021 19:30
BPF filter machine 1
#include <stdio.h>
#include <string.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/time.h>
#include <net/bpf.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#!/usr/bin/perl -w
# Author: Mark Foster
# (c) 2009 Credentia http://www.credentia.cc/
# $Id: check_zone.pl 104 2009-04-13 10:04:51Z mdf $
# Based on zonechk.pl, this script is a nagios plugin
#
# BUGS
# Not known
#
# TO DO
@BobBurns
BobBurns / cwtest.go
Last active January 1, 2018 23:51
Example of pushing disk and cpu metrics to AWS Cloudwatch
/* quick and dirty code to play around pushing
* aws metrics to cloudwatch
*/
package main
import (
"bufio"
"time"
"fmt"
@BobBurns
BobBurns / sockpay.c
Created October 3, 2017 03:51
fun payload for process infection
/* compile:
* gcc -fpic -pie -nostdlib sockpay.c -o sockpay
* use with https://github.com/BobBurns/hijack-process
* create a listener with nc -l -p 4444
*/
long _write(long fd, char *buf, unsigned long len)
{
long ret;
@BobBurns
BobBurns / hloop.go
Last active September 21, 2017 04:30
trying to trace golang program with ptrace from Learning Linux Binary Analysis by Elfmaster Ryan O'Neill
package main
import (
"fmt"
"time"
)
func print_hello(str string) {
fmt.Println("hello", str)
}
@BobBurns
BobBurns / cloudwatch_nrpe.php
Created October 15, 2016 18:51
Nagios plugin to check AWS Cloudwatch Metrics with AWS PHP SDK
#!/usr/bin/php
<?php
# php script to get aws cloudwatch data and format output
# for nagios check
# can be expanded to get Metrics from all AWS namespaces
# requires aws cli configured and aws sdk for php
# http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
@BobBurns
BobBurns / aws_check_nrpe.php
Last active October 15, 2016 21:33
Php wrapper script that can be used for nagios checks with an AWS ec2 instance
#!/usr/bin/php
<?php
# see https://gist.github.com/BobBurns/bc16d6e45fc01e61138f026c18187b00
# for a more efficient script using the aws php sdk
# wrapper script that can be used for nagios checks with aws ec2 instance
#
# Must have Instance Id $dim_value