Skip to content

Instantly share code, notes, and snippets.

View DonnchaC's full-sized avatar

Donncha Ó Cearbhaill DonnchaC

View GitHub Profile
@DonnchaC
DonnchaC / torrent-file-size.py
Last active July 14, 2022 03:06
Get total file sizes of contents for a set of .torrent files
import os
import sys
import bencodepy
import humanize
import argparse
def total_size_files_torrent(file_name):
try:
parsed = bencodepy.decode_from_file(file_name)
@DonnchaC
DonnchaC / gist:03ad5cd0b8ead0ae9e30
Last active March 3, 2018 17:26
Tor Summer of Privacy Proposal: Load Balancing/High Availability Onion Services

What project would you like to work on? Use our ideas lists as a starting point or make up your own idea. Your proposal should include high-level descriptions of what you're going to do, with more details about the parts you expect to be tricky. Your proposal should also try to break down the project into tasks of a fairly fine granularity, and convince us you have a plan for finishing it. A timeline for what you will be doing throughout the summer is highly recommended.

I'm particularly interested in Tor onion services. I hope that they can facilitate widely deployed self-authenticating encrypted communication channels at scale.

Anecdotal reports suggest that the current onion services infrastructure does not scale well [1, #8902]. In particular onion service introduction points are susceptible to hammering by clients and malicious attackers. Denial of service attacks where a single Tor process is overloaded by an attackers have also been experienced recently [#15463].

In contrast to modern distribute

@DonnchaC
DonnchaC / gist:b76d934b8601ca9b3be0
Created March 14, 2015 18:40
Requesting hidden service descriptors via the Tor control port
# nc 127.0.0.1 9051
AUTHENTICATE
250 OK
SETEVENTS HS_DESC
250 OK
SETEVENTS HS_DESC_CONTENT
250 OK
HSFETCH v2-riwvyw6njgvs4koel4heqs7w4bssnmlw SERVER=8A30C9E8F5954EE286D29BD65CADEA6991200804
250 OK
650 HS_DESC_CONTENT facebookcorewwwi riwvyw6njgvs4koel4heqs7w4bssnmlw $8A30C9E8F5954EE286D29BD65CADEA6991200804~YorkshireTOR
@DonnchaC
DonnchaC / tor-hs-descriptor-calculate.py
Last active August 29, 2015 14:16
Snippets of code for calculating Tor hidden service descriptor values. Based on the descriptors in https://trac.torproject.org/projects/tor/ticket/15004#comment:4
import unittest
import hashlib
import struct
import binascii
from base64 import b32decode, b64decode
import Crypto.Util
from Crypto.PublicKey import RSA
from Crypto.Cipher import AES
@DonnchaC
DonnchaC / gist:46b123d62fc3a658f54e
Created January 27, 2015 21:09
Facebook .onion HS descriptor
rendezvous-service-descriptor unwuduahxm6zfxpjjiivihifj6gdoerl
version 2
permanent-key
-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBALfng/krEfrBcvblDiM3PAkowkiAKxLoTsXt3nPEzyTP6Cw+Gdr0ODje
hmxTngN1pKiH7szk4Q1p2RabOrUHWwXmGXeDDNs00fcyU6HupgqsCoKOqCsmPac6
/58apC64A7xHeS02wtfWJp6qiZ8i6GGu6xWXRWux+ShPgcHvkajRAgMahU8=
-----END RSA PUBLIC KEY-----
secret-id-part ml7grvzrml2n4e7euczhkkcdvinlyasi
publication-time 2015-01-27 20:00:00
@DonnchaC
DonnchaC / monitor.py
Created December 16, 2014 16:19
Simple log file poller for Tor HS logs.
# -*- coding: utf-8 -*-
"""Polls the Tor HS log file and records all INTRODUCTION
cells seen to a database.
"""
import re
import time
import datetime
def parse_introduce_from_log(log_line):
@DonnchaC
DonnchaC / gist:fbb7a9959c8352ab15d4
Created October 31, 2014 23:43
Facebookcorewwwi.onion Descriptor
INFO: Downloaded from Router[torgozza (130.211.66.254:9001)]
rendezvous-service-descriptor utjk4arxqg6s6zzo7n6cjnq6ot34udhr
version 2
permanent-key
-----BEGIN RSA PUBLIC KEY-----
MIGKAoGBAL7zXRnwSycHlKSqK+B8PFvy7RhkQ+OytYtxBwOLzhD82oY7zbpjSHY4
BZ+hsnceXVjB+f1mXGjvLY6pnYxuufV4wsMsk7a58aJOqUvZFFI2vXhJtnLICxoZ
AEHWzajz4ULagahB1Vi62loQE84OEcuFBekTvnHca1ZTxwp16aZtAgQvoiLZ
-----END RSA PUBLIC KEY-----
from jinja2 import Markup, escape
print 'Filter Test.\n---'
value = """
a test <strong>string</strong>
new line test.
"""
print 'Escape() give Markup Object:'
print type(escape(value))
@DonnchaC
DonnchaC / OnionTip Fee Estimation
Last active August 29, 2015 14:05
Some estimations to help determine a good donation distribution protocol
# Total Donation required for each selected relay to receive the bitcoin dust limit amount (5460 satoshi = ~ $0.03)
300 Selected Relays
---
Fee: 110000 ($0.5500)
Outputs: 1638000 ($8.19000)
Fee: 6.29%
Total Spend: $8.74000 (0.0175 BTC)
@DonnchaC
DonnchaC / keybase.md
Created March 31, 2014 18:03
Verifying my Github account on Keybase.io

Keybase proof

I hereby claim:

  • I am donnchac on github.
  • I am donncha (https://keybase.io/donncha) on keybase.
  • I have a public key whose fingerprint is 7EFB DDE8 FD21 11AE A7BE 1AA6 3B0D 706A 7FBF ED86

To claim this, I am signing this object: