-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init, move from internal git server at Karlstad Universiy to GitHub.
- Loading branch information
0 parents
commit defb139
Showing
13 changed files
with
2,559 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# The Oracle | ||
A website oracle operating on Tor exit relays. | ||
* Author: Oscar Andersson [oscaande.se](https://www.oscaande.se) | ||
* Organization: Karlstads University [kau.se](https://www.kau.se) | ||
* Course: Examnesarbete DVGC25 | ||
* Term: Autmn 2020 (HT2020) | ||
* Licence: GPL-3.0 License, see license file or [gpl-3.0 on gnu.org](https://www.gnu.org/licenses/gpl-3.0.en.html). | ||
|
||
## NOTICE | ||
Do not use this on exit nodes and relays that you do not own! | ||
|
||
## Overview | ||
This is tool that exploits DNS cache in the Tor exit nodes. | ||
|
||
## Requirements | ||
Makefile supose that a UNIX enviorment is used. On Windows, manual building is required. | ||
This repository requires python 3 and the dependencies requires python 2. | ||
The current version of the tools is noted in case future versions dont support backwards compatability. (as of 2020-10-28) | ||
### Command line tools | ||
install using `pacman -S python python2 pip git tor` on Arch based systems and `apt-get install python python2 python-pip git tor` on Debian based systems. | ||
* python2 (2.7.18) | ||
* python3 (3.8.5) | ||
* pip (20.1.1) | ||
* git (2.28.0) | ||
* autoconf (2.69) | ||
* automake (1.16.2) | ||
* libtool (2.4.6.42-b88ce-dirty) | ||
* gcc (10.2.0) | ||
* tor (0.3.5.12) | ||
### Python3 packages | ||
install using `python3 -m pip install stem pysocks seaborn`. | ||
* stem | ||
* pysocks | ||
* seaborn | ||
### Python2 packages | ||
install using `python2 -m pip install stem`. | ||
* stem | ||
### You also need to build thses tools | ||
These tools can be built using the makefile in this repository. More about this in "Running chapter". | ||
* [exitmap](https://github.com/NullHypothesis/exitmap) (2019.05.30) by [Philipp Winter](https://nymity.ch/) | ||
* [torsocks](https://git.torproject.org/torsocks.git) (2.3.0) by [The Tor Project](https://torproject.org) | ||
|
||
## Using the tool | ||
### Setup | ||
* All requirements can simply be aquired from running `make` or install [exitmap](https://github.com/NullHypothesis/exitmap) manually, then place the contents of `src/` in exitmaps modules folder and copy `theoracle.conf.example` to `theoracle.conf` to the same direcotry. | ||
* After running `make` or manually installing. Configure the program in the `theoracle.conf` file. | ||
### Reset | ||
To reset the tool, run `make clean`. You will then have do redo the setup procedure, altough note that the configuration file is persistent. | ||
### Run | ||
Run the modules with exitmap using `./exitmap/bin/exitmap A --first-hop B --exit C --config-file exitmaprc` where A is a module, B is the fingerprint of the first hop relay and C is the fingerprint of the targeted exit relay. The supplied exitmap configuration file is called `exitmaprc` and should be specificed using `--config-file exitmaprc`. Read [exitmap documentation](https://github.com/NullHypothesis/exitmap/blob/master/README.md) or run `./exitmap/bin/exitmap` for more commands, modules and information. | ||
|
||
## This could not have been possible without: | ||
* [Philipp Winter](https://nymity.ch/) for creating the wonderfull tool [exitmap](https://github.com/NullHypothesis/exitmap). | ||
|
||
> And don't worry about the vase. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
# Setup | ||
if [ -z $1 ] | ||
then | ||
echo "Script $0 takes two arguments. Provide a period in between exitmap runs in hours 1-23 as an integer. Provide amount of runs as an integer." | ||
echo "Syntax: sh $0 PERIOD RUNS" | ||
exit 1 | ||
fi | ||
|
||
echo "Period: $1" | ||
echo "Runs: $2" | ||
|
||
# Variables and executables | ||
WORKING_DIRECTORY=$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"/../" | ||
EXITMAP_CMD="( cd $WORKING_DIRECTORY && sh bin/run.sh )" | ||
#CLEAN_CMD="( crontab -l | grep "$WORKING_DIRECTORY" -v | crontab - )" | ||
|
||
# Temporary directory | ||
CRON_TMP="/tmp/"$(tr -dc A-Za-z0-9 </dev/urandom | head -c 8 ; echo '') | ||
eval touch $CRON_TMP | ||
eval crontab -l > $CRON_TMP | ||
|
||
# Set cron jobs | ||
echo $(date --date 'now + 1 minutes' +"%M")' */'$1' * * * '$EXITMAP_CMD >> $CRON_TMP | ||
#echo $(date --date 'now + 5 minutes' +"%M")' */'$(($1*$2))' * * * '$CLEAN_CMD >> $CRON_TMP | ||
eval crontab $CRON_TMP | ||
eval rm -f $CRON_TMP | ||
eval crontab -l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
# Variables and direcories | ||
ID=$(tr -dc A-Za-z0-9 </dev/urandom | head -c 8 ; echo ''); ID=$(date +%s)"-"$ID | ||
WORKING_DIRECTORY=$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"/../" | ||
CONFIG=$WORKING_DIRECTORY"exitmaprc" | ||
CACHE_DIR=$WORKING_DIRECTORY"tor_cache/"$ID | ||
OUTPUT_FILE=$WORKING_DIRECTORY"logs/"$ID".txt" | ||
|
||
touch $OUTPUT_FILE | ||
# Run command and log | ||
echo "Running exitmap with module timeddns. Id: $ID" | ||
echo "$0 Started at $(date) by user $(whoami)." >> $OUTPUT_FILE | ||
echo "Current working directory $WORKING_DIRECTORY" >> $OUTPUT_FILE | ||
eval $WORKING_DIRECTORY"exitmap/bin/exitmap" timeddns -f $CONFIG -t $CACHE_DIR &>> $OUTPUT_FILE | ||
echo "$0 Exitmap done at $(date) by user $(whoami)." >> $OUTPUT_FILE | ||
|
||
# Cleanup | ||
echo "Remving $CACHE_DIR" >> $OUTPUT_FILE | ||
eval rm -rf $CACHE_DIR | ||
echo "$0 Cache cleared, script exiting at $(date) by user $(whoami)." >> $OUTPUT_FILE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
WORKING_DIRECTORY=$( cd "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"/.." | ||
watch " | ||
echo 'Watching the oracle output and exitmap running processes.'; | ||
echo 'Results files:'; | ||
du -hs $WORKING_DIRECTORY'/results'; | ||
echo 'Exit nodes scanned:'; | ||
ls -1q results/** | wc -l; | ||
echo 'Exitmap processes:'; | ||
ps wwuxa | grep 'exitmap' | grep -E 'grep|Watching the oracle output' -v -c; | ||
echo 'Run script processes:'; | ||
ps wwuxa | grep -E 'run.sh' | grep 'grep' -v -c; | ||
echo 'Memory:'; | ||
free -ht; | ||
echo 'CPU usage top 5:'; | ||
ps -eo pcpu,pid,user,args | sort -k 1 -r | head -5; | ||
" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[Defaults] | ||
verbosity = info | ||
build_delay = 2 | ||
delay-noise = 2 | ||
analysis_dir = exitmap_scans | ||
first_hop = EDAF30C58D6CCF359EA062C668C7180A17076440 | ||
country = |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
make: | ||
[ -d "exitmap" ] || git clone [email protected]:NullHypothesis/exitmap.git | ||
[ -d "exitmap" ] && python2 -m pip install -r exitmap/requirements.txt | ||
[ -d "exitmap" ] && [ -f "exitmap/src/modules/timeddns.py" ] || ln src/timeddns.py exitmap/src/modules/timeddns.py | ||
[ -d "exitmap" ] && [ -f "exitmap/src/modules/theoracle.conf" ] || ln theoracle.conf exitmap/src/modules/theoracle.conf | ||
[ -d "logs" ] || mkdir logs | ||
[ -d "results" ] || mkdir results | ||
[ -d "tor_cache" ] || mkdir tor_cache | ||
python3 -m pip install stem pysocks seaborn | ||
python2 -m pip install stem | ||
|
||
clean: | ||
@echo "THIS WILL REMOVE ALL RESULTS, LOGS AND CACHE IN 5 SECONDS! Press Ctrl + C to cancel." | ||
sleep 5 | ||
rm -rf exitmap_scans/* | ||
rm -rf tor_cache/* | ||
rm -f logs/* | ||
rm -rf results/* |
Oops, something went wrong.