some scripts

This commit is contained in:
zzz
2009-11-14 17:40:03 +00:00
commit c37648a8ea
29 changed files with 274 additions and 0 deletions

10
README.txt Normal file
View File

@ -0,0 +1,10 @@
This branch contains scripts useful to developers.
Feel free to improve them and add new ones.
Most of these scripts need the environment variable $I2P set to the
i2p install directory.
Many of the scripts require naming lookups, which require hosts.txt
(or a symbolic link) to be in the current working directory.
All scripts are public domain unless otherwise specified.

10
b32/32to64.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
#
# this just does the b32 to b64 conversion, obviously you can't recover the
# dest from the hash, so this probably isn't what you want
#
echo ................decoding b32
java -cp $I2P/lib/i2p.jar net.i2p.data.Base32 decode foo32.txt foo.bin
echo ................encoding b32
java -cp $I2P/lib/i2p.jar net.i2p.data.Base64 encode foo.bin foo64.txt
cat foo64.txt

9
b32/64to32.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
#
# this just does the b32 to b64 conversion, obviously you can't recover the
# dest from the hash, so this probably isn't what you want
#
echo ................decoding b64
java -cp $I2P/lib/i2p.jar net.i2p.data.Base64 decode foo64.txt foo.bin
echo ................encoding b32
java -cp $I2P/lib/i2p.jar net.i2p.data.Base32 encode foo.bin foo32.txt

14
eephead/eephead.sh Executable file
View File

@ -0,0 +1,14 @@
#
# eephead
# zzz Feb 2008
#
if [ $# -ne 1 ]
then
echo "usage: $0 URL"
exit 1
fi
date
echo -ne "HEAD $1 HTTP/1.0\r\n\r\n" | netcat localhost 4444
X=$?
date
exit $X

2
eephead/eephead2.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp $I2P/lib/i2p.jar net.i2p.util.EepHead "$@"

11
i2ptunnel/i2ptunnel.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/sh
export TEST=$HOME/mtn/test3/pkg-temp
export DIR=~/i2p
export I2P=$HOME/i2pgfp
#export I2P=$TEST
#
# comment out the following if you don't need to use names instead of Base64 dests
# also to use the logger.config in this dir.
#
##cd $DIR
java -cp $I2P/lib/i2ptunnel.jar:$I2P/lib/mstreaming.jar:$I2P/lib/streaming.jar:$I2P/lib/i2p.jar net.i2p.i2ptunnel.I2PTunnel -cli "$@"

2
jbigi/speedtest.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp $I2P/lib/i2p.jar:$I2P/lib/jbigi.jar net.i2p.util.NativeBigInteger

5
lookup/README.txt Normal file
View File

@ -0,0 +1,5 @@
There are many ways to look up a hostname or b32 address and get back the b64 address.
The i2ptunnel CLI, BOB, and SAM all provide this service, as does the LookupDest class,
and a class in i2ptunnel.
Put your lookup scripts here.

6
netdb/getnetdb.sh Executable file
View File

@ -0,0 +1,6 @@
#
# Just get a copy of netdb and save it
#
unset http_proxy
rm -f netdb.jsp
wget -q -O netdb.jsp http://amd.n:7657/netdb.jsp?f=1

69
ocat/onioncat-privatehosts.pl Executable file
View File

@ -0,0 +1,69 @@
#!/usr/bin/perl
#
# Reads hosts.txt and generates a file which can be used as
# privatehosts.txt for the I2P router to convert .onion hostnames
# back to the original key.
#
# The original hostname, full IPV6 address, and b32 name are included as a comment for each host.
#
# See below for perl package requirements.
#
# zzz 1/09 public domain
#
use strict;
use CGI qw(:standard);
use MIME::Base64;
use Convert::Base32;
use Digest::SHA qw(sha256);
use Digest::SHA qw(sha256_hex);
my $hosthash;
# load the whole db into memory
sub loadhosts
{
my $hostcount = 0;
open(local *STATLIST, "hosts.txt") or die "Can't access hosts.txt!";
while (<STATLIST>) {
my $name;
my $key;
my $restofline;
($name,$restofline) = split(/=/);
$key = $restofline;
$name = lc($name);
chomp($key);
$hosthash->{$name} = $key;
$hostcount++;
}
close STATLIST;
}
sub printhosts
{
my @sorted = keys %$hosthash;
my $name;
foreach $name (@sorted) {
my $b64 = $hosthash->{$name};
$b64 =~ s/-/+/g;
$b64 =~ s/~/\//g;
my $decoded = decode_base64($b64);
my $hash=sha256($decoded);
my $hexhash = sha256_hex($decoded);
my $encoded = encode_base32($hash);
print "#" . $name . " FD87:D87E:EB43";
for (my $i = 0; $i < 20; $i += 4) {
#printf(":%.2x%.2x", substr($hash, $i, 1), substr($hash, $i+1, 1));
printf(":%s", substr($hexhash, $i, 4));
}
print " " . $encoded . ".b32.i2p\n";
# print $encoded . ".b32.i2p=" . $hosthash->{$name} . "\n";
print substr($encoded, 0, 16) . ".onion=" . $hosthash->{$name} . "\n";
}
return 0;
}
loadhosts();
printhosts();

2
privatekeyfile/dest.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp $I2P/lib/router.jar:$I2P/lib/i2p.jar net.i2p.data.Destination "$@"

2
privatekeyfile/pkf.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp $I2P/lib/router.jar:$I2P/lib/i2p.jar net.i2p.data.PrivateKeyFile "$@"

2
source/README.txt Normal file
View File

@ -0,0 +1,2 @@
Put scripts for working in the source tree here.
Most of these are probably useless if you use an IDE.

2
source/changejvm.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/bash
sudo update-alternatives --config java

6
source/findall.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
#
# grep the source and print the filenames only
# maybe grep -R would be better
#
find . -type f \( -name *.java -o -name *.jsp \) -exec grep -l -i "$@" {} \;

7
source/grepall.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
#
# grep the source
# maybe grep -R would be better
# add /dev/null to force filename print - seems like there should be a grep option but guess not
#
find . -type f \( -name \*.java -o -name \*.jsp -o -name \*.xml \) -exec grep -i "$@" {} /dev/null \;

7
source/review.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
#
# view the diff for the files listed in filelist.txt
# zzz 2008-10
#
mtn dif `cat filelist.txt` > out.diff 2>&1
$EDITOR out.diff

6
source/reviewall.sh Executable file
View File

@ -0,0 +1,6 @@
#
# view the diff from the current head for all files changed in the workspace
# zzz 2008-10
#
mtn dif > out.diff
$EDITOR out.diff

12
source/reviewfromrelease.sh Executable file
View File

@ -0,0 +1,12 @@
#
# view the changes from the last release for all files in the workspace;
# this includes local changes not checked in
# zzz 2008-10
#
PREF=0.7
LAST=7
REL=$PREF$LAST
echo "Diffing from $REL"
mtn diff -r t:i2p-$REL > 7$LAST.diff
$EDITOR 7$LAST.diff

13
source/reviewheadfromrelease.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/sh
#
# view the changes from the last release to the current head;
# files not checked in are not included
# zzz 2008-10
#
PREF=0.7.
LAST=7
REL=$PREF$LAST
echo "Diffing from $REL"
mtn diff -r t:i2p-$REL -r h: > 7$LAST.diff
$EDITOR 7$LAST.diff

11
source/reviewmissing.sh Executable file
View File

@ -0,0 +1,11 @@
#
# view the changes in the current workspace for files NOT listed
# in filelist.txt; this is a good way to make sure you're not
# forgetting something that should be in filelist.txt before you
# check it in
# zzz 2008-10
#
mtn dif `cat filelist.txt` > out.diff
mtn dif > all.diff
diff all.diff out.diff | cut -c3- > missing.diff
$EDITOR missing.diff

43
stresstests/lotsotunnels Executable file
View File

@ -0,0 +1,43 @@
#!/bin/bash
#
# make a shitton of tunnels using BOB.
# BOB must be running
#
# you may wish to set the following options in bob.config.
# I'm sure there's a way to set the options
# by talking to BOB but the documentation on bob.i2p
# isn't clear on the subject.
#
# inbound.length=1
# outbound.length=0
# inbound.lengthVariance=0
# outbound.lengthVariance=0
#
# zzz 2009-02
#
BOBHOST=127.0.0.1
BOBPORT=2827
STARTPORT=50000
QUANTITY=100
let ENDPORT=$STARTPORT+$QUANTITY
let i=$STARTPORT
while [ "$i" -ne "$ENDPORT" ]
do
echo setnick test$i
echo newkeys
echo inhost 127.0.0.1
echo inport $i
echo start
#sleep 10
let i=$i+1
done | netcat $BOBHOST $BOBPORT
let i=$STARTPORT
while [ "$i" -ne "$ENDPORT" ]
do
echo getnick test$i
echo stop
let i=$i+1
done | netcat $BOBHOST $BOBPORT

2
stresstests/multirouter.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp $I2P/lib/i2p.jar:$I2P/lib/router.jar net.i2p.router.MultiRouter $*

2
update/keygen.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp $I2P/lib/i2p.jar net.i2p.crypto.TrustedUpdate keygen public-signing.key private-signing.key

2
update/showversion.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp $I2P/lib/i2p.jar net.i2p.crypto.TrustedUpdate showversion i2pupdate.sud

2
update/sign.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp $I2P/lib/i2p.jar net.i2p.crypto.TrustedUpdate sign i2pupdate.zip i2pupdate.sud private-signing.key 0.9.9

9
update/updateheads.sh Executable file
View File

@ -0,0 +1,9 @@
#
# check to see if all update hosts have the latest
#
for i in `cat updatesources.txt``
do
echo $i
eephead $i
echo '==========================='
done

4
update/updatesources.txt Normal file
View File

@ -0,0 +1,4 @@
http://echelon.i2p/i2p/i2pupdate.sud
http://www.i2p2.i2p/_static/i2pupdate.sud
http://update.postman.i2p/i2pupdate.sud
http://stats.i2p/i2p/i2pupdate.sud

2
update/verifysig.sh Executable file
View File

@ -0,0 +1,2 @@
#!/bin/sh
java -cp $I2P/lib/i2p.jar net.i2p.crypto.TrustedUpdate verifysig i2pupdate.sud