This commit is contained in:
WolverinDEV 2019-07-08 11:07:57 +02:00
parent 225c4d3252
commit 3e59e21a0e
4 changed files with 23 additions and 9 deletions

View File

@ -136,6 +136,7 @@ export async function deploy(platform: string, arch: string, channel: string, ve
console.log("Secret (env key: teaclient_deploy_secret): " + process.env["teaclient_deploy_secret"]);
if(!process.env["teaclient_deploy_secret"]) throw "Missing secret!";
request.post(url, {
formData: {
type: "deploy-build",

View File

@ -183,9 +183,10 @@ export namespace _connection {
callback: error => {
if(error != 0)
if(error != 0) {
reject(this._native_handle.error_message(error));
else {
return;
} else {
resolve();
}

View File

@ -80,7 +80,7 @@ void ProtocolHandler::handleCommandInitIVExpend(ts::Command &cmd) {
string error;
if(!this->crypt_handler.setupSharedSecret(alpha, beta, &server_key, &this->crypto.identity, error)) {
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to setup encryption")), true);
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to setup encryption (I)")), true);
this->handle->close_connection();
log_error(category::connection, tr("Failed to setup crypto ({})"), error);
@ -135,7 +135,7 @@ void ProtocolHandler::handleCommandInitIVExpend2(ts::Command &cmd) {
auto proof = base64::decode(cmd["proof"]);
auto crypto_chain_data = base64::decode(cmd["l"]);
auto crypto_root = cmd[0].has("root") ? base64::decode(cmd["root"]) : string((char*) license::teamspeak::public_root, 32);
auto crypto_root = cmd[0].has("root") ? base64::decode(cmd["root"]) : std::string((char*) license::teamspeak::public_root, 32);
auto crypto_hash = digest::sha256(crypto_chain_data);
/* suspecius, tries the server to hide himself? We dont know */
@ -170,11 +170,17 @@ void ProtocolHandler::handleCommandInitIVExpend2(ts::Command &cmd) {
return;
}
if(crypto_root.length() != 32) {
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("invalid crypto chain root! (Invalid length)")), true);
this->handle->close_connection();
return;
}
auto server_public_key = crypto_chain->generatePublicKey(*(license::teamspeak::LicensePublicKey*) crypto_root.data());
crypto_chain->print();
u_char seed[32 * 2]; //FIXME more secure
u_char public_key[32], private_key[32];
u_char seed[32];
u_char public_key[32], private_key[64]; /* private keys are only 32 bits long, but the SHA512 of the seed is 64 bytes! */
ed25519_create_keypair(public_key, private_key, seed);
/* send clientek response */
@ -206,8 +212,9 @@ void ProtocolHandler::handleCommandInitIVExpend2(ts::Command &cmd) {
}); /* needs to be encrypted at the time! */
}
if(!this->crypt_handler.setupSharedSecretNew(string((char*) this->crypto.alpha, 10), beta, (char*) private_key, server_public_key.data())) {
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to setup encryption")), true);
this->handle->call_connect_result.call(this->handle->errors.register_error(tr("failed to setup encryption (II)")), true);
this->handle->close_connection();
return;
}

View File

@ -103,8 +103,9 @@ const do_connect = () => {
connection.connect({
timeout: 5000,
remote_port: 9987,
//remote_host: "localhost",
remote_host: "ts.teaspeak.de",
//remote_host: "188.40.240.20", /* twerion */
remote_host: "localhost",
//remote_host: "ts.teaspeak.de",
//remote_host: "51.68.181.92",
//remote_host: "94.130.236.135",
//remote_host: "54.36.232.11", /* the beast */
@ -159,6 +160,10 @@ const do_connect = () => {
connection.callback_voice_data = (buffer, client_id, codec_id, flag_head, packet_id) => {
connection.send_voice_data(buffer, codec_id, flag_head);
}
connection.callback_command = (command, arguments1, switches) => {
console.log("Command: %s", command);
}
};
do_connect();