Giter VIP home page Giter VIP logo

i2pd-tools's Introduction

i2pd-tools

This repository contains tools that supplement i2pd.

Notice: git submodules are used so make sure to clone this repository recursively

git clone --recursive https://github.com/purplei2p/i2pd-tools

Building

Dependencies

  • boost chrono

  • boost date-time

  • boost filesystem

  • boost program-options

  • libssl

  • zlib1g

    (run dependencies.sh)

Building

make

Tools included

routerinfo

print information about a router info file

usage

print ip and port for router info excluding ipv6

./routerinfo -p ~/.i2pd/netDb/r6/routerInfo-blah.dat

print iptables firewall rules to allow 1 nodes in netdb through firewall including ipv6 addresses

./routerinfo -6 -f ~/.i2pd/netDb/r6/routerInfo-blah.dat

keygen

Generate an I2P private key

Usage

Make a EDDSA-SHA512-ED25519 destination key

./keygen privkey.dat

Make an destination key with a certain key type

./keygen privkey.dat <number>

or

./keygen privkey.dat <key name>
key name number
DSA-SHA1 0
ECDSA-SHA256-P256 1
ECDSA-SHA384-P384 2
ECDSA-SHA512-P521 3
RSA-SHA256-2048 4
RSA-SHA384-3072 5
RSA-SHA512-4096 6
EDDSA-SHA512-ED25519 7
GOSTR3410_CRYPTO_PRO_A-GOSTR3411-256 9
GOSTR3410_TC26_A_512-GOSTR3411-512 10
RED25519-SHA512 11

For more information on the types of signatures, see the documentation.

vain

Vanity generation address.

Usage

./vain --usage

Time to Generate on a 2.70GHz Processor

characters time to generate (approx.)
1 ~0.082s
2 ~0.075s
3 ~0.100s
4 ~0.394s
5 ~6.343s
6 ~1m-5m
7 ~30m

keyinfo

Prints information about an I2P private key

Usage

Print just the b32 address for this key

 ./keyinfo privatekey.dat

... just the base64 address

./keyinfo -d privatekey.dat

Print all info about the public key

./keyinfo -v privatekey.dat

regaddr

Generate authentication string to register a domain on reg.i2p and stats.i2p

./regaddr domain.dat domain.i2p > auth_string.txt
cat auth_string.txt

Send output of auth_string to http://reg.i2p/add and http://stats.i2p/i2p/addkey.html

To register a subdomain, use regaddr_3ld

regaddr_3ld

Generate authentication string to register a subdomain on reg.i2p and stats.i2p in 3 steps

./regaddr_3ld step1 sub_domain.dat sub.domain.i2p > step1.txt
./regaddr_3ld step2 step1.txt domain.dat domain.i2p > step2.txt
./regaddr_3ld step3 step2.txt sub_domain.dat > step3.txt
cat step3.txt

Send output of auth_string to http://reg.i2p/add and http://stats.i2p/i2p/addkey.html

regaddralias

Generate authentication string to register an alias address for existing domain on reg.i2p and stats.i2p

./regaddralias domain-oldkeys.dat domain-newkeys.i2p domain > auth_string.txt
cat auth_string.txt

Send output of auth_string to http://reg.i2p/add and http://stats.i2p/i2p/addkey.html

x25519

Generate key pair with output in base64 encoding. Now the x25519 keys are used for authentication with an encrypted LeaseSet.

famtool

this is program for works with family of routers in i2p-network.

usage: ./famtool [-h] [-v] [-g -n family -c family.crt -k family.pem] [-s -n family -k family.pem -i router.keys -f router.info] [-V -c family.crt -f router.info]

generate a new family signing key for family called ``i2pfam'' ./famtool -g -n i2pfam -c myfam.crt -k myfam.pem

sign a router info with family signing key ./famtool -s -n i2pfam -k myfam.pem -i router.keys -f router.info

verify signed router.info ./famtool -V -n i2pfam -c myfam.pem -f router.info

Example of usage

$ ./famtool -g -n i2pfam -c myfam.crt -k myfam.pem
family i2pfam made
$ cat myfam.crt
-----BEGIN CERTIFICATE-----
MIIB3TCCAYOgAwIBAgIBADAKBggqhkjOPQQDAjB4MQswCQYDVQQGEwJYWDELMAkG
A1UECAwCWFgxCzAJBgNVBAcMAlhYMR4wHAYDVQQKDBVJMlAgQW5vbnltb3VzIE5l
dHdvcmsxDzANBgNVBAsMBmZhbWlseTEeMBwGA1UEAwwVaTJwZmFtLmZhbWlseS5p
MnAubmV0MB4XDTIzMDczMTE5MjQ1MFoXDTMzMDcyODE5MjQ1MFoweDELMAkGA1UE
BhMCWFgxCzAJBgNVBAgMAlhYMQswCQYDVQQHDAJYWDEeMBwGA1UECgwVSTJQIEFu
b255bW91cyBOZXR3b3JrMQ8wDQYDVQQLDAZmYW1pbHkxHjAcBgNVBAMMFWkycGZh
bS5mYW1pbHkuaTJwLm5ldDBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABLejNp1Y
1tnMGFaUIuzNpNL8B9KvaeSSh+OWhRcHn2x1D8TPCVA4IMS0jiMIodCcdyTmz0Qg
SXsWDqT2CbBMENQwCgYIKoZIzj0EAwIDSAAwRQIgU58CeHXlluPZNxpmxb7HSHsJ
STCA8C946oas+8uLU+MCIQDe6Km/h8w+oCh+j6UHobN0EAVtQPQGwkq2XXs1jqX2
bQ==
-----END CERTIFICATE-----
$ cat myfam.pem
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIAFA82vZzZN8nZIOVnadSS73G2NNc5pUsh4qmpK2M0nsoAoGCCqGSM49
AwEHoUQDQgAEt6M2nVjW2cwYVpQi7M2k0vwH0q9p5JKH45aFFwefbHUPxM8JUDgg
xLSOIwih0Jx3JObPRCBJexYOpPYJsEwQ1A==
-----END EC PRIVATE KEY-----

i2pd-tools's People

Contributors

borned-mind avatar curbengh avatar da2x avatar freeacetone avatar ill5-com avatar l-n-s avatar majestrate avatar majorpakhom avatar markovskij avatar mikalv avatar nonlin-lin-chaos-order-etc-etal avatar orignal avatar r4sas avatar soux4cx4fx56x69 avatar wipedlifepotato avatar xanoni avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

i2pd-tools's Issues

крч нада сделать чтоб под бустом 1.74 тож собиралось под Ubuntu 20.04.x, буст 1.71 не хотит ставиться

git submodule update
Подмодуль по пути «i2pd»: забрано состояние «3c076654794c619eed228adcac075e9c1dea732f»
exit status: 0
whoami: vak; vak: vak; pwd: /home/vak/vcs/S2/i2pdtools; date: +2021-12-08 21:29:22 UTC nanoseconds:013414446 ADC; host: vakhost
Ok
sudo make -j7
make -C i2pd mk_obj_dir libi2pd.a
make[1]: вход в каталог «/media/vak/home_5dec2020/user/git/S2/i2pdtools/i2pd»
...
make[1]: выход из каталога «/media/vak/home_5dec2020/user/git/S2/i2pdtools/i2pd»
...
g++ -o regaddralias regaddralias.o  i2pd/libi2pd.a -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lssl -lcrypto -lz -lrt -lpthread
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)»:
/usr/include/boost/date_time/date_parsing.hpp:67: неопределённая ссылка на «boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()»
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::simple_format<char>, char>::format_month(boost::gregorian::greg_month const&, std::ostream&)»:
/usr/include/boost/date_time/date_formatting.hpp:44: неопределённая ссылка на «boost::gregorian::greg_month::as_short_string() const»
/usr/bin/ld: /usr/include/boost/date_time/date_formatting.hpp:49: неопределённая ссылка на «boost::gregorian::greg_month::as_long_string() const»
collect2: error: ld returned 1 exit status
make: *** [Makefile:50: keygen] Ошибка 1
make: *** Ожидание завершения заданий…
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)»:
/usr/include/boost/date_time/date_parsing.hpp:67: неопределённая ссылка на «boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()»
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::simple_format<char>, char>::format_month(boost::gregorian::greg_month const&, std::ostream&)»:
/usr/include/boost/date_time/date_formatting.hpp:44: неопределённая ссылка на «boost::gregorian::greg_month::as_short_string() const»
/usr/bin/ld: /usr/include/boost/date_time/date_formatting.hpp:49: неопределённая ссылка на «boost::gregorian::greg_month::as_long_string() const»
collect2: error: ld returned 1 exit status
make: *** [Makefile:53: keyinfo] Ошибка 1
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)»:
/usr/include/boost/date_time/date_parsing.hpp:67: неопределённая ссылка на «boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()»
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::simple_format<char>, char>::format_month(boost::gregorian::greg_month const&, std::ostream&)»:
/usr/include/boost/date_time/date_formatting.hpp:44: неопределённая ссылка на «boost::gregorian::greg_month::as_short_string() const»
/usr/bin/ld: /usr/include/boost/date_time/date_formatting.hpp:49: неопределённая ссылка на «boost::gregorian::greg_month::as_long_string() const»
collect2: error: ld returned 1 exit status
make: *** [Makefile:59: regaddr] Ошибка 1
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)»:
/usr/include/boost/date_time/date_parsing.hpp:67: неопределённая ссылка на «boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()»
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::simple_format<char>, char>::format_month(boost::gregorian::greg_month const&, std::ostream&)»:
/usr/include/boost/date_time/date_formatting.hpp:44: неопределённая ссылка на «boost::gregorian::greg_month::as_short_string() const»
/usr/bin/ld: /usr/include/boost/date_time/date_formatting.hpp:49: неопределённая ссылка на «boost::gregorian::greg_month::as_long_string() const»
collect2: error: ld returned 1 exit status
make: *** [Makefile:62: regaddr_3ld] Ошибка 1
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)»:
/usr/include/boost/date_time/date_parsing.hpp:67: неопределённая ссылка на «boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()»
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::simple_format<char>, char>::format_month(boost::gregorian::greg_month const&, std::ostream&)»:
/usr/include/boost/date_time/date_formatting.hpp:44: неопределённая ссылка на «boost::gregorian::greg_month::as_short_string() const»
/usr/bin/ld: /usr/include/boost/date_time/date_formatting.hpp:49: неопределённая ссылка на «boost::gregorian::greg_month::as_long_string() const»
collect2: error: ld returned 1 exit status
make: *** [Makefile:71: offlinekeys] Ошибка 1
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)»:
/usr/include/boost/date_time/date_parsing.hpp:67: неопределённая ссылка на «boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()»
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::simple_format<char>, char>::format_month(boost::gregorian::greg_month const&, std::ostream&)»:
/usr/include/boost/date_time/date_formatting.hpp:44: неопределённая ссылка на «boost::gregorian::greg_month::as_short_string() const»
/usr/bin/ld: /usr/include/boost/date_time/date_formatting.hpp:49: неопределённая ссылка на «boost::gregorian::greg_month::as_long_string() const»
collect2: error: ld returned 1 exit status
make: *** [Makefile:74: b33address] Ошибка 1
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «unsigned short boost::date_time::month_str_to_ushort<boost::gregorian::greg_month>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)»:
/usr/include/boost/date_time/date_parsing.hpp:67: неопределённая ссылка на «boost::gregorian::greg_month::get_month_map_ptr[abi:cxx11]()»
/usr/bin/ld: i2pd/libi2pd.a(Profiling.o): в функции «boost::date_time::month_formatter<boost::gregorian::greg_month, boost::date_time::simple_format<char>, char>::format_month(boost::gregorian::greg_month const&, std::ostream&)»:
/usr/include/boost/date_time/date_formatting.hpp:44: неопределённая ссылка на «boost::gregorian::greg_month::as_short_string() const»
/usr/bin/ld: /usr/include/boost/date_time/date_formatting.hpp:49: неопределённая ссылка на «boost::gregorian::greg_month::as_long_string() const»
collect2: error: ld returned 1 exit status
make: *** [Makefile:77: regaddralias] Ошибка 1
exit status: 2
pwd: /home/vak/vcs/S2/i2pdtools; date: +2021-12-08 21:30:11 UTC nanoseconds:544859709 ADC

ubuntu 20.04.x

g++ --version
g++ (Ubuntu 9.4.0-1ubuntu1~20.04) 9.4.0

"bad key file format"

hello. i ran i2pd-vain for a few hours with only a pattern argument and on the 9th attempt i got the result:

Found address: ***********
Hashes calculated: 187548083168

however, when running i2pd-keyinfo against the newly generated private.dat file, i get the message "bad key file format."

any idea what went wrong? i'm running it again now on the off-chance i get a usable result

Doesn't build on Debian 9

famtool.cpp:59:39: error: invalid use of incomplete type ‘struct evp_pkey_st’
       int keyType = EVP_PKEY_type(pkey->type);
                                       ^~
In file included from /usr/include/openssl/bn.h:32:0,
                 from i2pd/libi2pd/Crypto.h:6,
                 from famtool.cpp:8:

Also throws a lot of "pedantic" warnings about semicolon

:In file included from libi2pd/Crypto.cpp:9:0:
libi2pd/TunnelBase.h:69:4: warning: extra ‘;’ [-Wpedantic]
   };                                               
    ^  

Build fails: undefined reference to EVP_PKEY_base_id

# make
make -C i2pd mk_obj_dir libi2pd.a
make[1]: Entering directory '/home/kevcrumb/github/i2pd-tools/i2pd'
make[1]: 'libi2pd.a' is up to date.
make[1]: Leaving directory '/home/kevcrumb/github/i2pd-tools/i2pd'
g++ -Wall -std=c++17 -O2 -g -DOPENSSL_SUPPRESS_DEPRECATED -Ii2pd/libi2pd -Ii2pd/libi2pd_client -c -o vain.o vain.cpp
g++ -o vain  vain.o i2pd/libi2pd.a -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lssl -lcrypto -lz  -lrt -lpthread
/usr/bin/ld: i2pd/libi2pd.a(FS.o): in function `boost::filesystem::directory_entry::status() const':
/usr/include/boost/filesystem/directory.hpp:150:(.text._ZNK5boost10filesystem15directory_entry6statusEv[_ZNK5boost10filesystem15directory_entry6statusEv]+0x33): undefined reference to `boost::filesystem::directory_entry::get_status(boost::system::error_code*) const'
/usr/bin/ld: i2pd/libi2pd.a(Family.o): in function `i2p::data::Families::LoadCertificate(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
/home/kevcrumb/github/i2pd-tools/i2pd/libi2pd/Family.cpp:52:(.text+0x1b8): undefined reference to `EVP_PKEY_base_id'
collect2: error: ld returned 1 exit status
make: *** [Makefile:50: vain] Error 1


# i2pd --version
i2pd version 2.50.2 (0.9.61)
Boost version 1.83.0
OpenSSL 3.1.4 24 Oct 2023

Void Linux musl

Breakes on build

info:
OS: Debian 11 (bullseye)

Error:

make -C i2pd mk_obj_dir libi2pd.a
make[1]: Entering directory '/path/to/i2pd-tools/i2pd'
make[1]: g++: No such file or directory
Makefile:46: *** recipe commences before first target.  Stop.
make[1]: Leaving directory '/path/to/i2pd-tools/i2pd'
make: *** [Makefile:89: libi2pd.a] Error 2

Vain.

Start vanity generator in 4 threads
Thread 3 binded
Thread 2 binded
Thread 0 binded
Thread 1 binded
Address found fuckayl5z4pmjsw2xjqizh3d3r4zmlajqaff3no3owsus5bmgv3q in 1
Hashes: 662041
outpath for a now: private.dat

$ ./keyinfo private.dat
fuckayl5z4pmjsw2xjqizh3d3r4zmlajqaff3no3owsus5bmgv3q.b32.i2p

image

Doesn't compile against i2pd 2.39

Compiles and works perfectly with i2pd 2.38, but against 2.39 it fails with a linker error - undefined internationalization symbols in libi2pd.

Vain: threads doing extra work

It looks like the threads are processing the same hashes.

I added the output of "almost" found addresses:
if (memcmp(addr, prefix, len-2) == 0) {char addr_tmp[53]; ByteStreamToBase32 ((uint8_t*)hash, 32, addr_tmp, 52); std::cout << "*** thread=" << id_thread << " addr: " << addr_tmp << std::endl;}
then run
./vain aaaaaaaa -t 12
and got
*** thread=8 addr: aaaaaaqagtfxlr5j7t5mmoqejuriexcnw2xxq73mybm2kfyoy4da`
*** thread=0 addr: aaaaaa6ruxpzw6nr7p2vlt4cmed42tqansnv7ql7cxhjqnfp4cba
*** thread=7 addr: aaaaaaj6dnefnavuccwjjrgqtakrgvvquodugmri6vuftuh6c4xq
*** thread=11 addr: aaaaaaqagtfxlr5j7t5mmoqejuriexcnw2xxq73mybm2kfyoy4da
*** thread=3 addr: aaaaaa6ruxpzw6nr7p2vlt4cmed42tqansnv7ql7cxhjqnfp4cba
*** thread=10 addr: aaaaaaj6dnefnavuccwjjrgqtakrgvvquodugmri6vuftuh6c4xq
*** thread=6 addr: aaaaaa6ruxpzw6nr7p2vlt4cmed42tqansnv7ql7cxhjqnfp4cba

I'm assuming it's a misuse of thoughtput variable. In my opinion, the variable should determine the number of hashes to check for one thread and no magic numbers are required. If no one can explain the meaning of the current manipulations with this variable, then can I suggest my edits?

gmake fails with error 1 under FreeBSD 11.1

Summary:
Calling 'gmake' on i2pd-tools results in error 1 under FreeBSD 11.1.

STR:

  1. pkg install git && pkg install gmake && pkg install gcc
  2. git clone the repo
  3. gmake on the repo

Actual results:
2018-05-14 10_31_55-45 32 183 211 - putty

Expected results:
gmake finishes with exit code 0.

I can't understand the registry site 'add' page definition of 'auth string'

I am trying to register my b32 i2pd address as kloshost.i2p but I can't figure out what the page wants as input. It says it wants an input that ends in .i2p but it does not really define what auth string even means, or give any kind of hint about how to use the page. I have an i2pd install with a working b32 service, as well as the i2pd-tools that this Git repo documents. I have had a look at my .dat file with keyinfo -v and I have tried many different iterations of what might work, resulting in nothing.

Please fix your documentation as this is frustrating.

vain successful - keyinfo "bad key file format"

Compiled and running on FreeBSD 12.2

I'm looking for a 7 character vanity address, which usually takes a few hours on my E5-2643v3 processor. But when it finds one and exits, I run keyinfo on the output I get the following error:

./keyinfo keyfile5.dat
bad key file format

I also tried on a windows laptop with the release executable (Ryzen 9 5900HX) , and same thing, 6 character vanity addresses work just fine, but whenever I search for and find a 7 character vanity address I get the same error.

Falls to Compile on Debian Bookworm Stable

root@cloudserver:~# apt update                                                    Hit:1 http://deb.debian.org/debian stable InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

root@cloudserver:~# apt dist-upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

root@cloudserver:~# git clone --recursive https://github.com/purplei2p/i2pd-tools
Cloning into 'i2pd-tools'...
remote: Enumerating objects: 827, done.
remote: Counting objects: 100% (213/213), done.
remote: Compressing objects: 100% (112/112), done.
remote: Total 827 (delta 119), reused 177 (delta 99), pack-reused 614
Receiving objects: 100% (827/827), 269.17 KiB | 3.69 MiB/s, done.                 Resolving deltas: 100% (444/444), done.
Submodule 'i2pd' (https://github.com/PurpleI2P/i2pd) registered for path 'i2pd'   Cloning into '/root/i2pd-tools/i2pd'...                                           remote: Enumerating objects: 36824, done.
remote: Counting objects: 100% (5544/5544), done.
remote: Compressing objects: 100% (427/427), done.
remote: Total 36824 (delta 5215), reused 5337 (delta 5107), pack-reused 31280     
Receiving objects: 100% (36824/36824), 14.72 MiB | 13.41 MiB/s, done.
Resolving deltas: 100% (26235/26235), done.
Submodule path 'i2pd': checked out 'a6bd8275ca496c75c84d7eb890c0071569d28f55'

root@cloudserver:~# cd i2pd-tools/

root@cloudserver:~/i2pd-tools# ./dependencies.sh
sudo: unable to resolve host cloudserver: Name or service not known
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libboost-chrono-dev is already the newest version (1.74.0.3).
libboost-date-time-dev is already the newest version (1.74.0.3).
libboost-filesystem-dev is already the newest version (1.74.0.3).
libboost-program-options-dev is already the newest version (1.74.0.3).
libboost-system-dev is already the newest version (1.74.0.3).
libboost-thread-dev is already the newest version (1.74.0.3).
libssl-dev is already the newest version (3.0.11-1~deb12u2).
zlib1g-dev is already the newest version (1:1.2.13.dfsg-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

root@cloudserver:~/i2pd-tools# make
make -C i2pd mk_obj_dir libi2pd.a
make[1]: Entering directory '/root/i2pd-tools/i2pd'
make[1]: g++: No such file or directory
Makefile:71: *** recipe commences before first target.  Stop.
make[1]: Leaving directory '/root/i2pd-tools/i2pd'
make: *** [Makefile:91: libi2pd.a] Error 2
root@cloudserver:~/i2pd-tools#

root@cloudserver:~/i2pd-tools# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"                                                                   VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

Build instructions for Android

Hey! I've recently spent some time on getting i2pd-tools to compile (and run properly) on android (i needed keyinfo binary). I'd love this issue to be a pull request but I lack skills in C++ so getting this compiled in some way is the biggest I can do :/

I'm putting the way I went to compile static binaries for android here:
p.s. I've only managed to compile arm64-v8a and x86_64 versions, 32bit had some issues after adding -ffunction-sections -fdata-sections -Wl,--gc-sections (and would crash at runtime otherwise (on 64bit, unsure about 32bit)).

First I'm entering a docker container to ensure that I can do a clean build:
docker run --platform linux/amd64 -v /$(pwd)/out:/out -w /build --rm -it debian:stable bash

and then just copy-paste this script into the terminal

#!/bin/bash
set -xe
# I was kind of looking for a combo of versions that would work
# - the ones below exited for reasons I don't remember right
# now - but be aware that you can't just use latest tooling and
# expect it to work. 
# 21.4.7075529
# 22.0.7026061
# 23.0.7599858
# 24.0.8215888
export NDK_VERSION=23.0.7599858
export ANDROID_SDK_ROOT=/opt/android-sdk
export ANDROID_NDK_HOME=$ANDROID_SDK_ROOT/ndk/$NDK_VERSION
export ANDROID_HOME=$ANDROID_SDK_ROOT/ndk/$NDK_VERSION
export BUILD_DIR=$(mktemp -d)
export WGET_DIR="$(mktemp -d)"

cd $BUILD_DIR

apt update
# i2pd-android
apt install -y g++ rename default-jdk gradle wget git cmake file bzip2
# i2pd-tools
apt install -y cmake binutils build-essential debhelper libboost-date-time-dev libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libssl-dev zlib1g-dev libminiupnpc-dev git

(cd "$WGET_DIR" && wget https://dl.google.com/android/repository/commandlinetools-linux-10406996_latest.zip)
unzip $WGET_DIR/commandlinetools-linux-*_latest.zip
yes | ./cmdline-tools/bin/sdkmanager --sdk_root=/opt/android-sdk "build-tools;31.0.0" "cmake;3.18.1" "ndk;$NDK_VERSION"

export I2PD_ANDROID_BRANCH="2.49.0" # use this to prodice i2pd binaries and put them in /out
export I2PD_TOOLS_ANDROID_BRANCH="2.47.0" # use this to produce libraries based on i2pd used in i2pd-tools.

for branch in $I2PD_TOOLS_ANDROID_BRANCH $I2PD_ANDROID_BRANCH;
do
    cd $BUILD_DIR
    git clone --recurse-submodules https://github.com/PurpleI2P/i2pd-android.git -b $branch i2pd-android-$branch

    cd i2pd-android-$branch

    cd binary/jni
    ./build_boost.sh
    ./build_openssl.sh
    ./build_miniupnpc.sh
    $ANDROID_NDK_HOME/ndk-build -j $(nproc --all) NDK_MODULE_PATH=$PWD
done
cd ../libs
mkdir -p /out/android/{arm64-v8a,armeabi-v7a,x86,x86_64}
cp -a arm64-v8a/i2pd /out/android/arm64-v8a/
cp -a armeabi-v7a/i2pd /out/android/armeabi-v7a/
cp -a x86/i2pd /out/android/x86/
cp -a x86_64/i2pd /out/android/x86_64/

cd $BUILD_DIR
git clone --recursive https://github.com/purplei2p/i2pd-tools i2pd-tools-arm64-v8a
# cp -a i2pd-tools-arm64-v8a i2pd-tools-armeabi-v7a
# cp -a i2pd-tools-arm64-v8a i2pd-tools-x86
cp -a i2pd-tools-arm64-v8a i2pd-tools-x86_64
# screw armeabi-v7a and x86
for arch in arm64-v8a x86_64;
do
    cd $BUILD_DIR/i2pd-tools-$arch
    #  -static -ffunction-sections -fdata-sections -Wl,--gc-sections
    # https://github.com/termux/termux-packages/issues/8273#issuecomment-1133861593
    sed 's/LDFLAGS = /LDFLAGS = -static -ffunction-sections -fdata-sections -Wl,--gc-sections /g' -i Makefile
    sed 's/\$(MAKE) -C \$(I2PD_PATH) mk_obj_dir \$(I2PD_LIB)/echo \$(MAKE) -C \$(I2PD_PATH) mk_obj_dir \$(I2PD_LIB)/g' -i Makefile
    sed "s/INCFLAGS = -/INCFLAGS = -I..\/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH\/app\/jni\/openssl\/out\/$arch\/include -I..\/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH\/app\/jni\/boost\/build\/out\/$arch\/include -/g" -i Makefile
    rm -rf i2pd
    ln -s ../i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH/binary/jni/i2pd
    # produce libi2pd.a
    export OBJ_DIR="$(realpath $BUILD_DIR/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH/binary/obj/local/$arch/objs/i2pd/$BUILD_DIR/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH/binary/jni)"
    (
        cd $OBJ_DIR &&
        $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar -r libi2pd.a i2pd/libi2pd/{Base,Blinding,CPU,ChaCha20,Config,Crypto,CryptoKey,Datagram,Destination,ECIESX25519AEADRatchetSession,Ed25519,Elligator,FS,Family,Garlic,Gost,Gzip,HTTP,I2NPProtocol,I2PEndian,Identity,KadDHT,LeaseSet,Log,NTCP2,NetDb,NetDbRequests,Poly1305,Profiling,Reseed,RouterContext,RouterInfo,SSU2,SSU2Session,Signature,Streaming,Timestamp,TransitTunnel,Transports,Tunnel,TunnelConfig,TunnelEndpoint,TunnelGateway,TunnelPool,api,util}.o
    )
    mv $OBJ_DIR/libi2pd.a i2pd/
    # end produce libi2pd.a
    # fix libraries
    sed "s/-lboost_system/..\/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH\/app\/jni\/boost\/build\/out\/$arch\/lib\/libboost_system.a/g" -i Makefile
    sed "s/-lboost_date_time/..\/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH\/app\/jni\/boost\/build\/out\/$arch\/lib\/libboost_date_time.a/g" -i Makefile
    sed "s/-lboost_filesystem/..\/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH\/app\/jni\/boost\/build\/out\/$arch\/lib\/libboost_filesystem.a/g" -i Makefile
    sed "s/-lboost_program_options/..\/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH\/app\/jni\/boost\/build\/out\/$arch\/lib\/libboost_program_options.a/g" -i Makefile
    sed "s/-lcrypto/..\/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH\/app\/jni\/openssl\/out\/$arch\/lib\/libcrypto.a/g" -i Makefile
    sed "s/-lssl/..\/i2pd-android-$I2PD_TOOLS_ANDROID_BRANCH\/app\/jni\/openssl\/out\/$arch\/lib\/libssl.a/g" -i Makefile
    sed "s/-lpthread//g" -i Makefile
    sed "s/-lrt/-ldl/g" -i Makefile # -ldl is ***NOT*** replacement for -lrt - i just need to throw it into ldflags

    for task in b33address famtool i2pbase64 keygen keyinfo offlinekeys regaddr regaddr_3ld regaddralias routerinfo vain verifyhost x25519;
    do
        ndkarch="$arch"
        eabi=""
        [[ "$arch" == "arm64-v8a" ]] && ndkarch="aarch64"
        [[ "$arch" == "armeabi-v7a" ]] && ndkarch="armv7a"
        [[ "$arch" == "armeabi-v7a" ]] && eabi="eabi" # why.
        [[ "$arch" == "x86" ]] && ndkarch="i686"
        [[ "$arch" == "x86_64" ]] && ndkarch="x86_64"

        CC=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/$ndkarch-linux-android"$eabi"21-clang \
        CXX=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/$ndkarch-linux-android"$eabi"21-clang++ \
        make $task -j1
        $ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip $task
        cp $task /out/android/$arch/
    done
done

so my question is - is it possible to make android builds of this tools official?

vain - find multiple addresses

The current behavior is to stop vain after a regex match has been found, however I would like vain to continue to run, perhaps default output file should be the B32 address so that vain keeps running until an interrupt signal is sent?

Not building (make) under FreeBSD

Not building (make) under FreeBSD.

:/usr/local/i2pd-tools# make
make: "/usr/local/i2pd-tools/Makefile" line 11: Missing dependency operator
make: "/usr/local/i2pd-tools/Makefile" line 13: Missing dependency operator
make: "/usr/local/i2pd-tools/Makefile" line 14: warning: duplicate script for target "ifeq" ignored
make: "/usr/local/i2pd-tools/Makefile" line 12: warning: using previous script for "ifeq" defined here
make: "/usr/local/i2pd-tools/Makefile" line 15: Missing dependency operator
make: "/usr/local/i2pd-tools/Makefile" line 16: warning: duplicate script for target "else" ignored
make: "/usr/local/i2pd-tools/Makefile" line 14: warning: using previous script for "else" defined here
make: "/usr/local/i2pd-tools/Makefile" line 16: warning: duplicate script for target "ifeq" ignored
make: "/usr/local/i2pd-tools/Makefile" line 12: warning: using previous script for "ifeq" defined here
make: "/usr/local/i2pd-tools/Makefile" line 17: Need an operator
make: "/usr/local/i2pd-tools/Makefile" line 21: Need an operator
make: "/usr/local/i2pd-tools/Makefile" line 28: Missing dependency operator
make: "/usr/local/i2pd-tools/Makefile" line 29: warning: duplicate script for target "ifeq" ignored
make: "/usr/local/i2pd-tools/Makefile" line 12: warning: using previous script for "ifeq" defined here
make: "/usr/local/i2pd-tools/Makefile" line 29: warning: duplicate script for target "(,Linux)" ignored
make: "/usr/local/i2pd-tools/Makefile" line 12: warning: using previous script for "(,Linux)" defined here
make: "/usr/local/i2pd-tools/Makefile" line 30: Missing dependency operator
make: "/usr/local/i2pd-tools/Makefile" line 31: warning: duplicate script for target "else" ignored
make: "/usr/local/i2pd-tools/Makefile" line 14: warning: using previous script for "else" defined here
make: "/usr/local/i2pd-tools/Makefile" line 31: warning: duplicate script for target "ifeq" ignored
make: "/usr/local/i2pd-tools/Makefile" line 12: warning: using previous script for "ifeq" defined here
make: "/usr/local/i2pd-tools/Makefile" line 31: warning: duplicate script for target "(,Darwin)" ignored
make: "/usr/local/i2pd-tools/Makefile" line 14: warning: using previous script for "(,Darwin)" defined here
make: "/usr/local/i2pd-tools/Makefile" line 32: warning: duplicate script for target "else" ignored
make: "/usr/local/i2pd-tools/Makefile" line 14: warning: using previous script for "else" defined here
make: "/usr/local/i2pd-tools/Makefile" line 32: warning: duplicate script for target "ifeq" ignored
make: "/usr/local/i2pd-tools/Makefile" line 12: warning: using previous script for "ifeq" defined here
make: "/usr/local/i2pd-tools/Makefile" line 32: warning: duplicate script for target "(,Darwin)" ignored
make: "/usr/local/i2pd-tools/Makefile" line 14: warning: using previous script for "(,Darwin)" defined here
make: "/usr/local/i2pd-tools/Makefile" line 33: warning: duplicate script for target "else" ignored
make: "/usr/local/i2pd-tools/Makefile" line 14: warning: using previous script for "else" defined here
make: "/usr/local/i2pd-tools/Makefile" line 33: warning: duplicate script for target "ifeq" ignored
make: "/usr/local/i2pd-tools/Makefile" line 12: warning: using previous script for "ifeq" defined here
make: "/usr/local/i2pd-tools/Makefile" line 33: warning: duplicate script for target "(,Darwin)" ignored
make: "/usr/local/i2pd-tools/Makefile" line 14: warning: using previous script for "(,Darwin)" defined here
...

But gmake starts to collect something, albeit a number of warnings, for example:

libi2pd/Tunnel.h:123:17: warning: 'i2p::tunnel::OutboundTunnel::SendTunnelDataMsg' hides overloaded virtual function [-Woverloaded-virtual]
                        virtual void SendTunnelDataMsg (const std::vector<TunnelMessageBlock>& msgs); // multiple messages

As a result, the assembly ended with an error:

...
c++ -o regaddralias.o -c -Wall -std=c++11 -Wno-misleading-indentation -g -Ii2pd/libi2pd -Ii2pd/libi2pd_client -I/usr/local/include regaddralias.cpp
c++ -o regaddralias regaddralias.o -L/usr/local/lib  i2pd/libi2pd.a -lboost_system -lboost_date_time -lboost_filesystem -lboost_program_options -lssl -lcrypto -lz -lthr -lpthread
c++ -o x25519.o -c -Wall -std=c++11 -Wno-misleading-indentation -g -Ii2pd/libi2pd -Ii2pd/libi2pd_client -I/usr/local/include x25519.cpp
x25519.cpp:61:20: error: variable-sized object may not be initialized
    char b64Public[len_out] = {0};
                   ^~~~~~~
x25519.cpp:62:21: error: variable-sized object may not be initialized
    char b64Private[len_out] = {0};
                    ^~~~~~~
2 errors generated.
gmake: *** [Makefile:92: x25519.o] Error 1
# openssl version
OpenSSL 1.1.1j-freebsd  16 Feb 2021
# /usr/bin/c++ -v
FreeBSD clang version 10.0.1 ([email protected]:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
Target: x86_64-unknown-freebsd12.2
Thread model: posix
InstalledDir: /usr/bin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.