Skip to content

Instantly share code, notes, and snippets.

# delete existing rules
iptables -F
# drop all traffic not explicitly allowed
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
# allow ping from inside
iptables -A OUTPUT -p icmp --icmp-type echo-request -j ACCEPT
from datetime import datetime, date
from json import dumps
import fileinput
import re
import sys
# detect useless "page x of n" lines
page_regex = re.compile(r'^Page,[0-9]+,of,[0-9]+')
def parse_input():
@notslang
notslang / unpack-config.js
Created March 27, 2021 22:50
Extract files from an ignition config
const { ArgumentParser } = require('argparse')
const fs = require('fs')
const path = require('path')
const mkdirp = require('mkdirp')
const packageInfo = require('./package')
const argparser = new ArgumentParser({
addHelp: true,
description: 'Extract files from an ignition config',
version: packageInfo.version
@notslang
notslang / timespecs.cpp
Last active February 8, 2024 06:26
get difference between timespecs
/**
* Subtract timespec `b` from `a`. timespec `a` must be greater than `b`.
* @param res Where we put the result
* @param a timespec pointer for end time
* @param b timespec pointer for start time
*/
void get_difference(timespec *res, timespec *a, timespec *b) {
if (a->tv_nsec < b->tv_nsec) {
res->tv_sec = a->tv_sec - b->tv_sec - 1;
res->tv_nsec = a->tv_nsec - b->tv_nsec + 1000000000;
@notslang
notslang / start.php
Last active August 19, 2017 17:37
a basic RPC found in some wordpress malware. original file was base64'd and obfusticated.
@ini_set('error_log', NULL);
@ini_set('log_errors', 0);
@ini_set('max_execution_time', 0);
@error_reporting(0);
@set_time_limit(0);
if(!defined("PHP_EOL"))
{
define("PHP_EOL", "\n");
length total
0 140
1 301
2 1014
3 2078
4 4872
5 2486
6 2742
7 4773
8 8379
@notslang
notslang / index.coffee
Last active April 4, 2016 02:31
Multihash CLI in coffeescript
base58 = require 'bs58'
{ArgumentParser} = require 'argparse'
packageInfo = require '../package'
multihash = require '../src'
printJSON = (obj) ->
# print out one key/value per line, so (for example) piping into `wc -l` gives
# a count of the total supported functions
console.log JSON.stringify(obj, null, 1).replace(/\s*(\}|\{)\s*/gm, '$1')
@notslang
notslang / urlteam 2013-07-20 torrent errors.md
Created October 26, 2015 16:17
unparseable lines in the 2013-07-20 urlteam torrent
  • bit.ly/A0000-Z_____/Q0000-Q____
    • no url on line: Q3g5g|
  • is.gd/00000-9____/70000-7____
    • no url on line: 7Osni|
    • no url on line: 7YKrn|
  • is.gd/00000-9____/90000-9____
    • no url on line: 91E3L|
  • tinyurl.com/0-zzzz
    • no url on line: 8w8|
  • no url on line: 08w8|
@notslang
notslang / index.html
Created August 16, 2015 04:58
old rick and morty tumblr theme
<!DOCTYPE html>
<!--[if IE 8]><html class="lt-ie10 lt-ie9"> <![endif]-->
<!--[if IE 9]><html class="lt-ie10"> <![endif]-->
<!--[if gt IE 9]><!--> <html> <!--<![endif]-->
<head>
{MobileAppHeaders}
<meta charset="utf-8">
<title>{Title}{block:SearchPage} ({lang:Search results for SearchQuery}){/block:SearchPage}{block:PermalinkPage}{block:PostSummary} — {PostSummary}{/block:PostSummary}{/block:PermalinkPage}</title>
{block:Description}
<meta name="description" content="{MetaDescription}">
@notslang
notslang / vine-id-pairs
Created June 16, 2015 15:23
100-something sample ID pairs from vine.co
[
[
"1199912457779691520",
"euEZOhr7EYW"
],
[
"1182862150076080128",
"O21aDKXWJwW"
],
[