Skip to content

Instantly share code, notes, and snippets.

@2xyo
2xyo / Python_Rest_API
Created May 24, 2012 06:32
Simple REST API in Python
#!/usr/bin/python
import json
import bottle
from bottle import static_file, route, run, request, abort, response
import simplejson
import pymongo
from pymongo import Connection
import datetime
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@naiquevin
naiquevin / octo2pelican.py
Created February 17, 2013 17:21
A quick script for converting octopress posts (markdown source files) to pelican posts (markdown again but slightly different)
#!/usr/bin/env python
import os
import yaml
import datetime
from collections import OrderedDict
__doc__ = 'A quick script for converting octopress posts (markdown source files) to pelican posts'
@rep
rep / masscares.py
Created September 24, 2013 13:31
pycares mass resolver, input names on stdin
#!/usr/bin/python
# -*- coding: utf8 -*-
import sys
import os
import time
import select
import socket
import pycares
@joefitzgerald
joefitzgerald / win-updates.ps1
Created December 31, 2013 23:18
Install All Windows Updates, Rebooting As Many Times As Required
param($global:RestartRequired=0,
$global:MoreUpdates=0,
$global:MaxCycles=10)
function Check-ContinueRestartOrEnd() {
$RegistryKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
$RegistryEntry = "InstallWindowsUpdates"
switch ($global:RestartRequired) {
0 {
$prop = (Get-ItemProperty $RegistryKey).$RegistryEntry
@9b
9b / k10.py
Last active September 20, 2015 16:53
import datetime, re, difflib
def k10(stack):
if len(stack) <= 1:
return
checkHashes, checkDuplicates, checkDelta, checkName = True, True, True, True
score, dCount, fCount, deltaScore, fnameScore, chainAverage = 65, 0, 0, 0, 0, 0
duplicates, dChain, fChain, features = [], [], [], [ 'valid_filenames' ]
@xrstf
xrstf / letsencrypt.md
Last active April 18, 2023 05:01
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple:

@grigorescu
grigorescu / README.md
Last active November 6, 2020 02:34
breakpoint_to_pcap

breakpoint_to_pcap

Overview

Given an input PCAP and a location in a Bro script, this script will filter the PCAP into a new file, which contains only the connections that visited that script location. This script can help filter a large PCAP to narrow down problematic connections, such as protocol violations, weirds, etc.

Example

/*
* CVE-2016-5195 dirtypoc
*
* This PoC is memory only and doesn't write anything on the filesystem.
* /!\ Beware, it triggers a kernel crash a few minutes.
*
* gcc -Wall -o dirtycow-mem dirtycow-mem.c -ldl -lpthread
*/
#define _GNU_SOURCE
anonymous
anonymous / psx.py
Created November 13, 2016 14:32
PowerShell decoder by @JohnLaTwC
## hacked together by @JohnLaTwC, Nov 2016, v 0.5
## This script attempts to decode common PowerShell encoded scripts. This version handles:
## * base64 data which encode unicode, gzip, or deflate encoded strings
## * it can operate on a file or stdin
## * it can run recursively in the event of multiple layers
## With apologies to @Lee_Holmes for using Python instead of PowerShell
##
import sys
import zlib
import re