Skip to content

Instantly share code, notes, and snippets.

View kost's full-sized avatar
💭
I'm upto something

kost kost

💭
I'm upto something
View GitHub Profile
@kost
kost / webrick-https-server.rb
Created August 6, 2013 16:13
Basic HTTPS server using webrick
#!/usr/bin/env ruby
require 'openssl'
require 'webrick'
require 'webrick/https'
include WEBrick
port = 8443
server = HTTPServer.new(:Port=>port,:DocumentRoot=>Dir::pwd,
@kost
kost / udppipe.c
Last active April 19, 2016 03:47
UDPpipe
/*
* udppipe.c
*
* Created on: Mar 5, 2011
* Author: ssullivan
* @build instructions
* MINGW: gcc -o udppipe udppipe.c -lws2_32
* *NIX: gcc -o udppipe udppipe.c
*WINDOWS: ?
* CYGWIN: gcc -o udppipe udppipe.c
@kost
kost / datapipe.c
Created April 19, 2016 03:49
datapipe.c - TCP pipes
/*
* Datapipe - Create a listen socket to pipe connections to another
* machine/port. 'localport' accepts connections on the machine running
* datapipe, which will connect to 'remoteport' on 'remotehost'.
* It will fork itself into the background on non-Windows machines.
*
* This implementation of the traditional "datapipe" does not depend on
* forking to handle multiple simultaneous clients, and instead is able
* to do all processing from within a single process, making it ideal
* for low-memory environments. The elimination of the fork also
@kost
kost / screenshotweb.js
Last active April 19, 2016 03:51
PhantomJS script to screenshot web page
#!/usr/bin/env phantomjs
// screenshotweb.js - Copyright (C) Kost
// PhantomJS script to screenshot web page
var system = require('system');
var argv = system.args;
if (argv.length === 1) {
console.log('Provide URL to take screenshot: '+argv[0]+' <URL>');
phantom.exit();
} else {
@kost
kost / testingDAO v1.1
Created June 5, 2016 19:10 — forked from D-Nice/testingDAO v1.1
DAO for use in testing and finding any bugs in V1.1 features
/*
- Bytecode Verification performed was compared on second iteration -
This file is part of the DAO.
The DAO is free software: you can redistribute it and/or modify
it under the terms of the GNU lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
@kost
kost / webinspect-urls.vbs
Created June 28, 2016 11:43
Run HP Webinspect on Multiple target URLs
REM HP Webinspect batch invocation
REM Copyright (C) Vlatko Kosturjak - Kost
REM cscript webinspect-urls.vbs file-each-line-different-url.txt
On Error Resume Next
Set args = Wscript.Arguments
REM iterate through each argument/file
For Each arg in args
@kost
kost / limeinfo.c
Created July 25, 2016 09:56
Displays info about LiME memory dump
#include <stdio.h>
#include <stdlib.h>
typedef struct {
unsigned int magic; // Always 0x4C694D45 (LiME)
unsigned int version; // Header version number
unsigned long long s_addr; // Starting address of physical RAM range
unsigned long long e_addr; // Ending address of physical RAM range
unsigned char reserved[8]; // Currently all zeros
} __attribute__ ((__packed__)) lime_mem_range_header;
@kost
kost / run_burp.sh
Created September 28, 2016 09:54 — forked from jamesbcook/run_burp.sh
#!/bin/bash
BURPFOLDER="$HOME/Documents/burp"
SAVESTATEROOT="$BURPFOLDER/burpState"
cd $BURPFOLDER
# LATESTBURP=$(ls -1 burpsuite* | tail -n 1)
LATESTBURP=$(ls -1t burp*.jar | head -n1)
echo "Running ${LATESTBURP}"
@kost
kost / gist:8445cd68f0af98d27ca69e5d53192d61
Created October 6, 2016 06:56 — forked from mjpowersjr/gist:740a9583e9ec8b49e0a3
Parsing the MySQL slow query log via Logstash (the easy way?)

The MySQL slow query log is a difficult format to extract information from. After looking at various examples with mixed results, I realized that it's much easier to configure MySQL to write the slow query log to a table in CSV format!

From the MySQL documentation:

By default, the log tables use the CSV storage engine that writes data in comma-separated values format. For users who have access to the .CSV files that contain log table data, the files are easy to import into other programs such as spreadsheets that can process CSV input.

my.cnf

Note: don't forget to open up permissions on your slow query log CSV file so logstash can read it!

# enable slow query log
@kost
kost / hop.go
Created October 22, 2016 10:08
Meterpreter hop in Go
//usr/bin/go run $0 $@ ; exit
// Meterpreter hop in Go. Copyright (C) Kost. Distributed under MIT.
package main
import (
"io/ioutil"
"net/http"
"os"
"strings"