-
-
Save nurupo/c2a4eeaedec65dc4e55ef05e4b369f03 to your computer and use it in GitHub Desktop.
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
#include <stdio.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
int main() | |
{ | |
struct addrinfo *info; | |
getaddrinfo("tox.zodiaclabs.org", "0", NULL, &info); | |
return 0; | |
} |
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
sudo apt-get install toxcore-toktok-dev tor | |
gcc -o socks5-leak-test socks5-leak-test.c -std=gnu99 -lsodium -ltoxcore | |
strace -e trace=socket,connect,close ./socks5-leak-test | |
gcc -o getaddrinfo getaddrinfo.c -std=gnu99 | |
strace -e trace=socket,connect,close ./getaddrinfo |
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
#include <ctype.h> | |
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <unistd.h> | |
#include <sodium/utils.h> | |
#include <tox/tox.h> | |
typedef struct DHT_node { | |
const char *ip; | |
uint16_t port; | |
const char key_hex[TOX_PUBLIC_KEY_SIZE*2 + 1]; | |
unsigned char key_bin[TOX_PUBLIC_KEY_SIZE]; | |
} DHT_node; | |
void self_connection_status_cb(Tox *tox, TOX_CONNECTION connection_status, void *user_data) | |
{ | |
switch (connection_status) { | |
case TOX_CONNECTION_NONE: | |
printf("Offline\n"); | |
break; | |
case TOX_CONNECTION_TCP: | |
printf("Online, using TCP\n"); | |
break; | |
case TOX_CONNECTION_UDP: | |
printf("Online, using UDP\n"); | |
break; | |
} | |
} | |
void bootstrap(Tox *tox) | |
{ | |
DHT_node nodes[] = | |
{ | |
{"178.62.250.138", 33445, "788236D34978D1D5BD822F0A5BEBD2C53C64CC31CD3149350EE27D4D9A2F9B6B", {0}}, | |
{"tox.zodiaclabs.org", 33445, "A09162D68618E742FFBCA1C2C70385E6679604B2D80EA6E84AD0996A1AC8A074", {0}}, | |
{"163.172.136.118", 33445, "2C289F9F37C20D09DA83565588BF496FAB3764853FA38141817A72E3F18ACA0B", {0}}, | |
{"128.199.199.197", 33445, "B05C8869DBB4EDDD308F43C1A974A20A725A36EACCA123862FDE9945BF9D3E09", {0}}, | |
{"biribiri.org", 33445, "F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67", {0}} | |
}; | |
for (size_t i = 0; i < sizeof(nodes)/sizeof(DHT_node); i ++) { | |
sodium_hex2bin(nodes[i].key_bin, sizeof(nodes[i].key_bin), | |
nodes[i].key_hex, sizeof(nodes[i].key_hex)-1, NULL, NULL, NULL); | |
tox_bootstrap(tox, nodes[i].ip, nodes[i].port, nodes[i].key_bin, NULL); | |
tox_add_tcp_relay(tox, nodes[i].ip, nodes[i].port, nodes[i].key_bin, NULL); | |
} | |
} | |
void print_tox_id(Tox *tox) | |
{ | |
uint8_t tox_id_bin[TOX_ADDRESS_SIZE]; | |
tox_self_get_address(tox, tox_id_bin); | |
char tox_id_hex[TOX_ADDRESS_SIZE*2 + 1]; | |
sodium_bin2hex(tox_id_hex, sizeof(tox_id_hex), tox_id_bin, sizeof(tox_id_bin)); | |
for (size_t i = 0; i < sizeof(tox_id_hex)-1; i ++) { | |
tox_id_hex[i] = toupper(tox_id_hex[i]); | |
} | |
printf("Tox ID: %s\n", tox_id_hex); | |
} | |
int main() | |
{ | |
struct Tox_Options *opt = tox_options_new(NULL); | |
tox_options_set_ipv6_enabled(opt, false); | |
tox_options_set_udp_enabled(opt, false); | |
tox_options_set_local_discovery_enabled(opt, false); | |
tox_options_set_proxy_type(opt, TOX_PROXY_TYPE_SOCKS5); | |
tox_options_set_proxy_host(opt, "127.0.0.1"); | |
tox_options_set_proxy_port(opt, 9050); | |
tox_options_set_hole_punching_enabled(opt, false); | |
Tox *tox = tox_new(opt, NULL); | |
tox_options_free(opt); | |
bootstrap(tox); | |
print_tox_id(tox); | |
tox_callback_self_connection_status(tox, self_connection_status_cb); | |
while (1) { | |
tox_iterate(tox, NULL); | |
usleep(tox_iteration_interval(tox) * 1000); | |
} | |
tox_kill(tox); | |
return 0; | |
} |
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
close(3) = 0 | |
close(3) = 0 | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 3 | |
socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 4 | |
connect(4, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) | |
close(4) = 0 | |
close(3) = 0 | |
socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3 | |
connect(3, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3 | |
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.1.1")}, 16) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 3 | |
connect(3, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("23.226.230.47")}, 16) = 0 | |
close(3) = 0 | |
socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 3 | |
connect(3, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "2604:180:1:4fb:0:10:20:d1ac", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable) | |
close(3) = 0 | |
+++ exited with 0 +++ |
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
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
close(3) = 0 | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 4 | |
socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 5 | |
connect(5, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) | |
close(5) = 0 | |
close(4) = 0 | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 4 | |
close(4) = 0 | |
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 4 | |
connect(4, {sa_family=AF_INET, sin_port=htons(9050), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress) | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 5 | |
close(5) = 0 | |
socket(PF_LOCAL, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 5 | |
connect(5, {sa_family=AF_LOCAL, sun_path="/var/run/nscd/socket"}, 110) = -1 ENOENT (No such file or directory) | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 5 | |
connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.1.1")}, 16) = 0 | |
close(5) = 0 | |
close(5) = 0 | |
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5 | |
connect(5, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("23.226.230.47")}, 16) = 0 | |
close(5) = 0 | |
socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 5 | |
connect(5, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "2604:180:1:4fb:0:10:20:d1ac", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable) | |
close(5) = 0 | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 5 | |
close(5) = 0 | |
close(5) = 0 | |
socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 5 | |
connect(5, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.1.1")}, 16) = 0 | |
close(5) = 0 | |
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 5 | |
connect(5, {sa_family=AF_INET, sin_port=htons(0), sin_addr=inet_addr("23.226.230.47")}, 16) = 0 | |
close(5) = 0 | |
socket(PF_INET6, SOCK_DGRAM, IPPROTO_IP) = 5 | |
connect(5, {sa_family=AF_INET6, sin6_port=htons(0), inet_pton(AF_INET6, "2604:180:1:4fb:0:10:20:d1ac", &sin6_addr), sin6_flowinfo=0, sin6_scope_id=0}, 28) = -1 ENETUNREACH (Network is unreachable) | |
close(5) = 0 | |
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 5 | |
connect(5, {sa_family=AF_INET, sin_port=htons(9050), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress) | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 6 | |
close(6) = 0 | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 6 | |
close(6) = 0 | |
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 6 | |
connect(6, {sa_family=AF_INET, sin_port=htons(9050), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress) | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 7 | |
close(7) = 0 | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 7 | |
close(7) = 0 | |
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 7 | |
connect(7, {sa_family=AF_INET, sin_port=htons(9050), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress) | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 8 | |
close(8) = 0 | |
close(8) = 0 | |
socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 8 | |
connect(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.1.1")}, 16) = 0 | |
close(8) = 0 | |
socket(PF_NETLINK, SOCK_RAW, NETLINK_ROUTE) = 8 | |
close(8) = 0 | |
close(8) = 0 | |
socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 8 | |
connect(8, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("192.168.1.1")}, 16) = 0 | |
close(8) = 0 | |
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 8 | |
connect(8, {sa_family=AF_INET, sin_port=htons(9050), sin_addr=inet_addr("127.0.0.1")}, 16) = -1 EINPROGRESS (Operation now in progress) | |
Tox ID: 15EDC07F328BBAB75D8D35A0D3F536683AA0969AA8BA96FCD102D44AC65A971707CF80EB9143 | |
close(4) = 0 | |
close(7) = 0 | |
Online, using TCP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment