Skip to content

Instantly share code, notes, and snippets.

View DonnchaC's full-sized avatar

Donncha Ó Cearbhaill DonnchaC

View GitHub Profile
@DonnchaC
DonnchaC / onionbalance-ip-counts
Created July 3, 2015 23:59
OnionBalance Master Descriptor and Backend Instance IP counts
python descriptor-fetcher.py --onion-list onion-list.txt
2015-07-03 23:58:01,916 [DEBUG]: Successfully connected to the Tor control port
2015-07-03 23:58:06,924 [INFO]: Sending HS descriptor fetch for eujuuws2nacz4xw4.onion
2015-07-03 23:58:07,863 [INFO]: Storing new descriptor with 10 introduction points for HS eujuuws2nacz4xw4
2015-07-03 23:58:11,937 [INFO]: Sending HS descriptor fetch for nkcoog3avb3iwels.onion
2015-07-03 23:58:12,982 [INFO]: Storing new descriptor with 3 introduction points for HS nkcoog3avb3iwels
2015-07-03 23:58:16,945 [INFO]: Sending HS descriptor fetch for le3jeksfogq2zrpx.onion
2015-07-03 23:58:17,474 [INFO]: Storing new descriptor with 3 introduction points for HS le3jeksfogq2zrpx
2015-07-03 23:58:21,953 [INFO]: Sending HS descriptor fetch for ymiwfpbw32xai4ko .onion
2015-07-03 23:58:22,475 [INFO]: Storing new descriptor with 3 introduction points for HS ymiwfpbw32xai4ko
@DonnchaC
DonnchaC / ip-selection.txt
Created July 7, 2015 13:35
Confimation of introduction point selection algorithim in OnionBalance. 2 IPs selected from each of the 5 backend instances
3 introduction-point g246pla6g23cvhlpgmfl5nqbfot7bvaa
ip-address 37.187.22.87
onion-port 9001
onion-key
-----BEGIN RSA PUBLIC KEY-----
MIGJAoGBAMdEmLQDuMItvkVj43VzG/gyOR9bgJ5l32+ZlwXxwbBSIaGqD5dRZf+I
RCY1g44V/LDjgFykM0WaTYF3u4zZCZtqX3z8PymLozQIxdRW0rSQZWaStJ2XOt0p
h7dK9ONxWNt5EALzT6uxIOmfMllF0FWVJ1Tx9R0ylxxdJ5S95sC3AgMBAAE=
-----END RSA PUBLIC KEY-----
service-key
@DonnchaC
DonnchaC / sni-proxy.py
Last active May 12, 2019 11:54
This is a proof-of-concept tool which demonstrates transparent proxying of SSL connections from an entry server to a hidden servce with end-to-end encryption. The SNI extension in the SSL ClientHello is used to determine the destination. Further info in the Tor2web ticket: https://github.com/globaleaks/Tor2web/issues/252
#!/usr/bin/env python
"""
Proxy an SSL connection to a Twisted endpoint based on the SNI extension
Allows for end-to-end encrypted connections from a browser to a Tor hidden
service.
Proxy code based on
http://blog.laplante.io/2013/08/a-basic-man-in-the-middle-proxy-with-twisted/
@DonnchaC
DonnchaC / onion-address-calculate.py
Created August 25, 2015 14:24
Simple script to calculate the onion address from a Tor hidden service descriptor or public key
import hashlib
import base64
import argparse
import sys
from Crypto.PublicKey import RSA
def calculate_onion(pem_key):
key = RSA.importKey(pem_key)
@DonnchaC
DonnchaC / relay-monitor.py
Last active December 17, 2015 22:46
Simple script to monitor a Tor relay and report any warning via email.
# -*- coding: utf-8 -*-
"""
Monitors Tor control port and sends email notifications for
log events NOTICE, WARN, and ERROR.
"""
import os
import time
import datetime
import argparse
import logging
@DonnchaC
DonnchaC / fetch-hs-descriptor.py
Created December 17, 2015 15:49
A simple script which demonstrates how to retrieve hidden service descriptors via the HSFETCH Tor control port command
import sys
import argparse
import stem
from stem.control import Controller
def main():
parser = argparse.ArgumentParser(description="%s fetches a Tor hidden "
"service descriptor." % sys.argv[0])
@DonnchaC
DonnchaC / tor-hs-cell-patterns.txt
Last active May 7, 2016 17:22
Circuits and cell patterns for a Tor hidden service client connection
Circuit 6 - HS_DESC facebookcorewwwi [OPEN]
Circuit events:
- EXTENDED ['0CA305E63C99FB8E2E1C6CA11CD1E569E780C691', '51BD833B86D556EE968CDFFFD79592BE56761238', 'FC9AC8EA0160D88BCCFDE066940D7DD9FA45495B', '2F5E1DAAD1388F7DBECCF6C4E839098C88BA3D2A']
- BUILT ['0CA305E63C99FB8E2E1C6CA11CD1E569E780C691', '51BD833B86D556EE968CDFFFD79592BE56761238', 'FC9AC8EA0160D88BCCFDE066940D7DD9FA45495B', '2F5E1DAAD1388F7DBECCF6C4E839098C88BA3D2A']
Cells:
- <Cell RELAY_EARLY OUT 2016-05-07 17:10:27.954415>
- <Cell RELAY IN 2016-05-07 17:10:28.485182>
- <Cell RELAY_EARLY OUT 2016-05-07 17:10:28.485466>
- <Cell RELAY_EARLY OUT 2016-05-07 17:10:28.485479>
- <Cell RELAY IN 2016-05-07 17:10:28.995197>
@DonnchaC
DonnchaC / tor-circuit-cell-monitor.py
Created May 7, 2016 17:24
Rough script for reading Tor CIRC and a custom CELL control events and keep tracking of Tor's circuits and cells
# -*- coding: utf-8 -*-
"""
Monitors Tor control port for descriptor lookups and INTRODUCE1
requests.
"""
import os
import time
import datetime
import argparse
import logging
# bwscan --verbose scan --no-launch-tor -p 3000 --timeout 5
2016-07-31 20:15:40+0200 [-] Log opened.
2016-07-31 20:15:40+0200 [-] Verbose log mode is on.
2016-07-31 20:15:40+0200 [-] Using /home/donnncha/.config/bwscanner as the data directory.
2016-07-31 20:15:40+0200 [-] Connecting to a running Tor instance
2016-07-31 20:15:40+0200 [-] Connected to a Tor instance.
2016-07-31 20:15:40+0200 [-] Performing a measurement scan with 3 relays.
2016-07-31 20:15:40+0200 [-] Downloading https://bwauth.torproject.org/bwauth.torproject.org/32M over $8C7106C880FE8AA1319DD71B59623FCB8914C9F1, $0DB5577A293D70F014663C68364F4D449C4D62DD
2016-07-31 20:15:40+0200 [-] Starting factory <txsocksx.client.SOCKS5ClientFactory instance at 0x7f9a74571cf8>
2016-07-31 20:15:40+0200 [-] Downloading https://bwauth.torproject.org/bwauth.torproject.org/16M over $CCA1BE38F343CF1E1B4BB1857A786957B056DC0F, $C92EAF09EB7B2B6D63DB776F7A7C025075765D29
@DonnchaC
DonnchaC / huaiwei-unlock.py
Created September 24, 2016 19:27
Huaiwei unlock code generator - Based on the disassembler generated C code in https://github.com/forth32/huaweicalc
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import hashlib
import argparse
import binascii
import struct
def encrypt_v1(imei, key):