-
Notifications
You must be signed in to change notification settings - Fork 2
/
localReadScript.sh
45 lines (40 loc) · 1.03 KB
/
localReadScript.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#! /bin/bash
#This script looks through the system for all directories
#containing the filenames "hostname" and "private_key"
#and checks if you have the message packs that correspond
#with any of those hidden service directories and if
#so decrypts them and and displays them immediately
#so they are never written to file as plaintext
read -ra prelim <<< `find / -path */hostname 2> /dev/null`
for i in ${prelim[@]}
do
if [[ -e "`dirname $i`/private_key" ]]
then
dirs+=("$(dirname $i)")
fi
done
if [[ ${#dirs[@]} = 0 ]]
then
echo "It looks like you aren't running any hidden services, this tool isn't for you :("
exit
fi
for i in ${dirs[@]}
do
host=$(cat $i/hostname)
hosts+=host
cat $i/private_key > "$host.key"
done
for i in ${hosts[@]}
do
path=$(find / -path "*$host.tar.gz" 2> /dev/null)
tar -xzf $path
mkdir -p $host
read -ra files <<< $(tar -tzf $path)
for j in ${files[@]}
do
mv "./$j" ./$host
cat "./$host/$j" | openssl rsautl -decrypt -inkey "$host.key" -raw | less
done
rm "$host.key"
rm -rf "./$host/"
done