Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help needed in testing a tox client,I need some dummy toxids to test . #936

Closed
blprasad opened this issue Jun 24, 2018 · 11 comments
Closed
Labels
P3 Low priority
Milestone

Comments

@blprasad
Copy link

Though it's not a real issue. I am seeking help here because, I don't know where to seek.
I am experimenting with toxic client. I am trying to add few Tox Id's to my client for testing.I just want to show them in a menu in contacts list. How and where do I get some dummy tox Ids for testing.
I only got two machines on which I run a toxic client on each, these two client's Ids are only added to each other.If I want to add more Tox Ids on each of them how do I do that? I want to show some dummy ids and their corresponding names in a menu.As I could not get more tox Ids I cannot test the menu.

Thanks in advance

@iphydf
Copy link
Member

iphydf commented Jun 24, 2018

You can start multiple toxes on one machine. You can also use tox-testbot (https://github.com/tox-user/tox-testbot). Run it with testbot.py -b 10 to spawn 10 test bots you can add. They will start doing random things, but you can remove the code that does that if you don't need it.

@blprasad
Copy link
Author

iphydf, thanks for input

@blprasad
Copy link
Author

If I try running multiple instances of toxic client , I am getting same tox Id on both the instances.
But I need different tox Ids. I still need to look at testbot.py and how it works.

@blprasad blprasad reopened this Jun 25, 2018
@blprasad
Copy link
Author

I am facing problem while running tesbot.py , I think I need to run PyTox before I start testbot.py. I am facing problem in running PyTox ,because docker is not supported on my 32 bit system.

@iphydf
Copy link
Member

iphydf commented Jun 25, 2018

You can build pytox from source without docker. Let me know if you run into problems trying to build it.

https://github.com/TokTok/py-toxcore-c

@blprasad
Copy link
Author

How do I build it?, It seems Makefile dependent on docker ,here is what it got .
root@prasad-laptop:py-toxcore-c-master# make run
docker stop pytox
make: docker: Command not found
make: [kill] Error 127 (ignored)
docker rm pytox
make: docker: Command not found
make: [kill] Error 127 (ignored)
docker build -t pytox_image .
make: docker: Command not found
make: *** [build] Error 127

please guide me,if I am missing something!!!
I tried to issues gcc on pytox sources, I get compile errors which may need to be sorted out.

@iphydf
Copy link
Member

iphydf commented Jun 26, 2018

Run: python setup.py install

If that works, feel free to send a pull request to update the docs to mention this as an alternative.

@tox-user
Copy link
Member

If I remember correctly I was able to build pytox with:

python setup.py build

Then you can go to build/lib.linux-x86_64-2.7 then copy pytox.so and paste it into testbot's directory.

I just added a new -e parameter to testbot that allows you to specify your Tox ID that bots will add. Example:

testbot.py -b 10 -e YOUR_TOX_ID_HERE

@blprasad
Copy link
Author

It's not working for me,it's throwing headers missing error .I am thinking alternative.
I tried to compile qtox, that also has dependencies to be installed.For now I am getting some tox IDs by installing tox on my mobile devices.Closing it for now please keep suggesting.🙂

@nurupo
Copy link
Member

nurupo commented Jun 28, 2018

#include <stdio.h>
#include <string.h>
#include <ctype.h>

#include <sodium.h>

int main()
{
    unsigned char public_key[crypto_box_PUBLICKEYBYTES];
    unsigned char secret_key[crypto_box_SECRETKEYBYTES];
    crypto_box_keypair(public_key, secret_key);

    char tox_file[] = "\x00\x00\x00\x00\x1f\x1b\xed\x15\x44\x00\x00\x00\x01\x00\xce\x01\x00\x00\x00\x00";
    fwrite(tox_file, sizeof(tox_file) - 1, 1, stderr);
    fwrite(public_key, sizeof(public_key), 1, stderr);
    fwrite(secret_key, sizeof(secret_key), 1, stderr);

    char public_key_str[crypto_box_PUBLICKEYBYTES*2 + 1];
    char secret_key_str[crypto_box_SECRETKEYBYTES*2 + 1];
    sodium_bin2hex(public_key_str, sizeof(public_key_str), public_key, sizeof(public_key));
    sodium_bin2hex(secret_key_str, sizeof(secret_key_str), secret_key, sizeof(secret_key));
    for (size_t i = 0; i < sizeof(public_key_str); i ++) {
        public_key_str[i] = toupper(public_key_str[i]);
        secret_key_str[i] = toupper(secret_key_str[i]);
    }
    fprintf(stdout, "Public key: %s\n", public_key_str);
    fprintf(stdout, "Secret key: %s\n", secret_key_str);

    unsigned char checksum[2] = {0};
    for (size_t i = 0; i < crypto_box_PUBLICKEYBYTES; i ++) {
        checksum[i % 2] ^= public_key[i];
    }
    char checksum_str[sizeof(checksum)*2 + 1];
    sodium_bin2hex(checksum_str, sizeof(checksum_str), checksum, sizeof(checksum));
    for (size_t i = 0; i < sizeof(checksum_str); i ++) {
        checksum_str[i] = toupper(checksum_str[i]);
    }
    fprintf(stdout, "Tox Id: %s00000000%s\n", public_key_str, checksum_str);

    return 0;
}
$ gcc -o generate_keypair generate_keypair.c -lsodium -std=c99
$ ./generate_keypair >info 2>tox_savedata
$ cat info 
Public key: 5724FCBEFAA0ECFC9877E7058DF91A03FAF68AF42854446C3D454B4BE0C9386E
Secret key: 170A7606A074205E438DA7FAE70EAAD465483A6EC781DEB096A45ACA83FCDBFF
Tox Id: 5724FCBEFAA0ECFC9877E7058DF91A03FAF68AF42854446C3D454B4BE0C9386E00000000E7DD
$ xxd tox_savedata 
00000000: 0000 0000 1f1b ed15 4400 0000 0100 ce01  ........D.......
00000010: 0000 0000 5724 fcbe faa0 ecfc 9877 e705  ....W$.......w..
00000020: 8df9 1a03 faf6 8af4 2854 446c 3d45 4b4b  ........(TDl=EKK
00000030: e0c9 386e 170a 7606 a074 205e 438d a7fa  ..8n..v..t ^C...
00000040: e70e aad4 6548 3a6e c781 deb0 96a4 5aca  ....eH:n......Z.
00000050: 83fc dbff                          

@blprasad
Copy link
Author

@nurupo
thanks for the input and effort. It is what I needed.It's working as expected.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P3 Low priority
Projects
None yet
Development

No branches or pull requests

4 participants