mirror of
https://github.com/yrutschle/sslh.git
synced 2025-05-31 15:49:17 +03:00
added hardcoded probe for Teamspeak3
This commit is contained in:
parent
75e426c80f
commit
4584e719e1
7
probe.c
7
probe.c
@ -39,6 +39,7 @@ static int is_tls_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_
|
|||||||
static int is_adb_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*);
|
static int is_adb_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*);
|
||||||
static int is_socks5_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*);
|
static int is_socks5_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*);
|
||||||
static int is_quick_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*);
|
static int is_quick_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*);
|
||||||
|
static int is_teamspeak_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item*);
|
||||||
static int is_true(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto) { return 1; }
|
static int is_true(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto) { return 1; }
|
||||||
|
|
||||||
/* Table of protocols that have a built-in probe
|
/* Table of protocols that have a built-in probe
|
||||||
@ -54,6 +55,7 @@ static struct protocol_probe_desc builtins[] = {
|
|||||||
{ "adb", is_adb_protocol },
|
{ "adb", is_adb_protocol },
|
||||||
{ "socks5", is_socks5_protocol },
|
{ "socks5", is_socks5_protocol },
|
||||||
{ "quick50", is_quick_protocol },
|
{ "quick50", is_quick_protocol },
|
||||||
|
{ "teamspeak", is_teamspeak_protocol },
|
||||||
{ "anyprot", is_true }
|
{ "anyprot", is_true }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -304,6 +306,11 @@ static int is_quick_protocol(const char *p, ssize_t len, struct sslhcfg_protocol
|
|||||||
return memmem(p, len, "Q050", 4) ? 1 : 0;
|
return memmem(p, len, "Q050", 4) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int is_teamspeak_protocol(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto)
|
||||||
|
{
|
||||||
|
return memmem(p, len, "TS3INIT1", 8) ? 1 : 0;
|
||||||
|
}
|
||||||
|
|
||||||
static int regex_probe(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto)
|
static int regex_probe(const char *p, ssize_t len, struct sslhcfg_protocols_item* proto)
|
||||||
{
|
{
|
||||||
#ifdef ENABLE_REGEX
|
#ifdef ENABLE_REGEX
|
||||||
|
27
sslh-conf.c
27
sslh-conf.c
@ -1,8 +1,8 @@
|
|||||||
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
|
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
|
||||||
* on Sat Jul 31 23:32:53 2021.
|
* on Sun Aug 1 21:58:56 2021.
|
||||||
|
|
||||||
# conf2struct: generate libconf parsers that read to structs
|
# conf2struct: generate libconf parsers that read to structs
|
||||||
# Copyright (C) 2018-2019 Yves Rutschle
|
# Copyright (C) 2018-2021 Yves Rutschle
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
@ -465,6 +465,7 @@ struct arg_file* sslhcfg_conffile;
|
|||||||
struct arg_str* sslhcfg_adb;
|
struct arg_str* sslhcfg_adb;
|
||||||
struct arg_str* sslhcfg_socks5;
|
struct arg_str* sslhcfg_socks5;
|
||||||
struct arg_str* sslhcfg_quick50;
|
struct arg_str* sslhcfg_quick50;
|
||||||
|
struct arg_str* sslhcfg_teamspeak;
|
||||||
struct arg_str* sslhcfg_anyprot;
|
struct arg_str* sslhcfg_anyprot;
|
||||||
struct arg_end* sslhcfg_end;
|
struct arg_end* sslhcfg_end;
|
||||||
|
|
||||||
@ -1019,6 +1020,15 @@ static struct compound_cl_target sslhcfg_anyprot_targets [] = {
|
|||||||
{ 0 }
|
{ 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static struct compound_cl_target sslhcfg_teamspeak_targets [] = {
|
||||||
|
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "teamspeak" },
|
||||||
|
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
|
||||||
|
{ & table_sslhcfg_protocols[2], 2, .value.def_string = "0" },
|
||||||
|
{ & table_sslhcfg_protocols[4], 0, .value.def_bool = 1 },
|
||||||
|
{ & table_sslhcfg_protocols[9], 0, .value.def_int = 1 },
|
||||||
|
{ 0 }
|
||||||
|
};
|
||||||
|
|
||||||
static struct compound_cl_target sslhcfg_quick50_targets [] = {
|
static struct compound_cl_target sslhcfg_quick50_targets [] = {
|
||||||
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "quick50" },
|
{ & table_sslhcfg_protocols[0], 0, .value.def_string = "quick50" },
|
||||||
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
|
{ & table_sslhcfg_protocols[1], 1, .value.def_string = "0" },
|
||||||
@ -1224,6 +1234,18 @@ static struct compound_cl_arg compound_cl_args[] = {
|
|||||||
.override_const = "quick50",
|
.override_const = "quick50",
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{ /* arg: teamspeak */
|
||||||
|
.regex = "(.+):(\\w+)",
|
||||||
|
.arg_cl = & sslhcfg_teamspeak,
|
||||||
|
.base_entry = & table_sslhcfg [13],
|
||||||
|
.targets = sslhcfg_teamspeak_targets,
|
||||||
|
|
||||||
|
|
||||||
|
.override_desc = & table_sslhcfg_protocols [0],
|
||||||
|
.override_matchindex = 0,
|
||||||
|
.override_const = "teamspeak",
|
||||||
|
},
|
||||||
|
|
||||||
{ /* arg: anyprot */
|
{ /* arg: anyprot */
|
||||||
.regex = "(.+):(\\w+)",
|
.regex = "(.+):(\\w+)",
|
||||||
.arg_cl = & sslhcfg_anyprot,
|
.arg_cl = & sslhcfg_anyprot,
|
||||||
@ -1914,6 +1936,7 @@ int sslhcfg_cl_parse(int argc, char* argv[], struct sslhcfg_item* cfg)
|
|||||||
sslhcfg_adb = arg_strn(NULL, "adb", "<host:port>", 0, 10, "Set up ADB (Android Debug) target"),
|
sslhcfg_adb = arg_strn(NULL, "adb", "<host:port>", 0, 10, "Set up ADB (Android Debug) target"),
|
||||||
sslhcfg_socks5 = arg_strn(NULL, "socks5", "<host:port>", 0, 10, "Set up socks5 target"),
|
sslhcfg_socks5 = arg_strn(NULL, "socks5", "<host:port>", 0, 10, "Set up socks5 target"),
|
||||||
sslhcfg_quick50 = arg_strn(NULL, "quick50", "<host:port>", 0, 10, "Set up QUICK-50 target"),
|
sslhcfg_quick50 = arg_strn(NULL, "quick50", "<host:port>", 0, 10, "Set up QUICK-50 target"),
|
||||||
|
sslhcfg_teamspeak = arg_strn(NULL, "teamspeak", "<host:port>", 0, 10, "Set up Teamspeak3 target"),
|
||||||
sslhcfg_anyprot = arg_strn(NULL, "anyprot", "<host:port>", 0, 10, "Set up default target"),
|
sslhcfg_anyprot = arg_strn(NULL, "anyprot", "<host:port>", 0, 10, "Set up default target"),
|
||||||
sslhcfg_end = arg_end(10)
|
sslhcfg_end = arg_end(10)
|
||||||
|
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
|
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
|
||||||
* on Sat Jul 31 23:32:53 2021.
|
* on Sun Aug 1 21:58:56 2021.
|
||||||
|
|
||||||
# conf2struct: generate libconf parsers that read to structs
|
# conf2struct: generate libconf parsers that read to structs
|
||||||
# Copyright (C) 2018-2019 Yves Rutschle
|
# Copyright (C) 2018-2021 Yves Rutschle
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
12
sslhconf.cfg
12
sslhconf.cfg
@ -232,6 +232,18 @@ cl_groups: (
|
|||||||
{ path: "log_level"; value: 1 }
|
{ path: "log_level"; value: 1 }
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
{ name: "teamspeak"; pattern: "(.+):(\w+)"; description: "Set up Teamspeak3 target";
|
||||||
|
list: "protocols";
|
||||||
|
override: "name";
|
||||||
|
argdesc: "<host:port>";
|
||||||
|
targets: (
|
||||||
|
{ path: "name"; value: "teamspeak" },
|
||||||
|
{ path: "host"; value: "$1" },
|
||||||
|
{ path: "port"; value: "$2" },
|
||||||
|
{ path: "is_udp"; value: "1" },
|
||||||
|
{ path: "log_level"; value: 1 }
|
||||||
|
);
|
||||||
|
},
|
||||||
{ name: "anyprot"; pattern: "(.+):(\w+)"; description: "Set up default target";
|
{ name: "anyprot"; pattern: "(.+):(\w+)"; description: "Set up default target";
|
||||||
list: "protocols";
|
list: "protocols";
|
||||||
override: "name";
|
override: "name";
|
||||||
|
1
test.cfg
1
test.cfg
@ -32,6 +32,7 @@ protocols:
|
|||||||
{ name: "xmpp"; host: "localhost"; port: "9009"; },
|
{ name: "xmpp"; host: "localhost"; port: "9009"; },
|
||||||
{ name: "adb"; host: "localhost"; port: "9010"; },
|
{ name: "adb"; host: "localhost"; port: "9010"; },
|
||||||
{ name: "quick50"; host: "localhost"; is_udp: true; port: "9011"; },
|
{ name: "quick50"; host: "localhost"; is_udp: true; port: "9011"; },
|
||||||
|
{ name: "teamspeak"; host: "localhost"; is_udp: true; port: "9012"; },
|
||||||
{ name: "regex"; host: "ip4-localhost"; is_udp: true; port: "9020";
|
{ name: "regex"; host: "ip4-localhost"; is_udp: true; port: "9020";
|
||||||
udp_timeout: 30;
|
udp_timeout: 30;
|
||||||
regex_patterns: [ "^foo" ];
|
regex_patterns: [ "^foo" ];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user