Skip to content

Instantly share code, notes, and snippets.

View adulau's full-sized avatar
👨‍💻
Doing stuff

Alexandre Dulaunoy adulau

👨‍💻
Doing stuff
View GitHub Profile
@adulau
adulau / iporigin.pl
Created November 14, 2010 09:45
Lookup origin, country and BGP Ranking for a given IP address
#!/usr/bin/perl
#
# Takes as input IP address (one per line)
# and output the guessed IP location along with ASN origin and its description
# and the BGP Ranking of each ASN
#
#perl ip2asn.pl
# www.microsoft.com
# US;AS8075;MICROSOFT-CORP---MSN-AS-BLOCK - Microsoft Corp;65.55.12.249;8075,1.00036643769349,3/9
# 8.8.8.8
@jcromartie
jcromartie / recta.rb
Created December 17, 2010 18:34
Print a random password tabula recta
# by John Cromartie
# idea from http://blog.jgc.org/2010/12/write-your-passwords-down.html
# via http://news.ycombinator.com/item?id=2016608
alpha = ("A".."Z").to_a
chars = alpha + 'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(){}[]-+=.,;:~'.chars.to_a
class Array
def rand_el
@pachacamac
pachacamac / whereami.sh
Created June 30, 2011 17:34
Wanna know where you are?
#!/bin/bash
echo -n "{\"version\": \"1.1.0\",\"host\": \"maps.google.com\",\"request_address\": true,\"address_language\": \"en_GB\", \"wifi_towers\": [`iwlist scan 2> /dev/null | tr -d '\n' | sed -e 's/Cell [0-9]* - Address: \([0-9A-Z:]*\)[^C]*Channel:\([0-9]*\)[^S]*Signal level=\([0-9-]*\) dBm[^E]*E[^E]*ESSID:"\([^"]*\)"/\{"mac_address": "\1","signal_strength": \3,"age": 0,"channel": \2,"ssid": "\4"}/g' -e 's/[^{]*{/{/' -e 's/}[^{]*{/},{/g' -e 's/\}[^}]*$/\}/' `]}" | curl -s -X POST -d @/dev/fd/0 http://www.google.com/loc/json
# TIP: run with sudo for improved accuracy since iwlist can then provide more than the active hotspot
@rommelfs
rommelfs / xa-add.sh
Last active December 25, 2015 06:49
add information about file into metadata of file to be indexed by spotlight (OS X centric)
#!/bin/bash -x
FILENAME="$1"
echo "Collecting attributes for $FILENAME" &&\
HASHMD5=`md5 "$1" | cut -d"=" -s -f2|tr -d " "` &&\
echo -e "MD5\t\t$HASHMD5" &&\
HASHSHA1=`shasum "$1" | cut -d" " -f 1` &&\
echo -e "SHA1\t\t$HASHSHA1" &&\
SHA2ALGOS="224 256 384 512" &&\
HASHSHA2_224=`shasum -a 224 "$1"|cut -d" " -f1` &&\
echo -e "SHA2-224\t$HASHSHA2_224" &&\
@rommelfs
rommelfs / xa-add-comment.sh
Last active December 25, 2015 06:49
add comments to file in metadata to be indexed by spotlight (OS X centric)
#!/bin/bash
FILENAME="$1"
OLDCOMMENT="`mdls -r -nullMarker "" -n kMDItemFinderComment \"$FILENAME\"`"
echo "Old comment: $OLDCOMMENT"
while read LINE
do
COMMENT="$OLDCOMMENT $LINE"
done
echo "Updated comment: $COMMENT"
PATH=`pwd`
anonymous
anonymous / belgian-photographer.md
Created December 27, 2015 16:59
Notes about Belgian photographers
@2xyo
2xyo / misp-taxonomies-ETSI-GS-ISI.json
Last active July 10, 2016 09:20
misp-taxonomies - Information-security-indicators
{
"namespace": "Information-security-indicators",
"description": "A full set of operational indicators for organizations to use to benchmark their security posture",
"version": "1.1.2",
"predicates": [
{
"value": "IEX",
"expanded": "Intrusions and external attacks",
"description": "Indicators of this category give information on the occurrence of incidents caused by external malicious threat sources."
},
@iglocska
iglocska / gist:e1f38e7eb97514126ae9423426a80273
Created January 11, 2017 11:47
sample intel.log ingestion
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import string
from pymisp import PyMISP
from keys import misp_url, misp_key
import argparse
# For python2 & 3 compat, a bit dirty, but it seems to be the least bad one
try:
@mbijon
mbijon / iframe.html
Created August 4, 2013 19:42
Tor fingerprinting code-injection (allegedly by FBI) --from: http://www.twitlonger.com/show/n_1rlo0uu
//nl7qbezu7pqsuone.onion/?requestID=203f1a01-6bc7-4c8b-b0be-2726a7a3cbd0 iframe:
<html>
<body>
<iframe frameborder=0 border=0 height=1 width=1 id="iframe"> </iframe>
</body>
</html>
<script>
@digitalresistor
digitalresistor / Duplicate_EVP_PKEY.md
Last active October 23, 2018 01:38
Stupid OpenSSL idiosyncrasies/bad documentation/missing documentation I run across, or simply completely undocumented functions.

You are now getting to a point where you know you want to get a copy of an EVP_PKEY for one reason or another, not that it matters much why, you just need it.

So you start looking for a way to duplicate it, there has to be a function for it, right? You come across EVP_PKEY_CTX_dup, so you make the assumption that EVP_PKEY_dup should probably exist too ... well you'd be wrong. You come across this message on the OpenSSL mailling list: http://www.mail-archive.com/openssl-users@openssl.org/msg17608.html and the next follow-up says to just up the reference count, or RSA_dup() and copy it into the new EVP_PKEY ... except RSA_dup() doesn't exist either.

No real solutions come out of that email thread. No deep copies seem to be possible, well until you simply consider converting it from an EVP_PKEY format to PEM/DER and then back to an EVP_PKEY.

So, in that case all that is left is to encode it to PEM/DER and then decode it from PEM/DER.

// Create new memory BIO

BIO* tbio = BIO_new(BIO_s_