WIP extracting useful info

This commit is contained in:
Quentin 2020-02-21 18:46:50 +01:00
parent 967810e9d1
commit 3a3e61aac5
3 changed files with 16 additions and 0 deletions

View file

@ -98,6 +98,15 @@ void evt_core_mv_fd(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, st
fdinfo->cat->cb(ctx, fdinfo);
}
gboolean evt_core_fdinfo_url_set(struct evt_core_fdinfo* fdinfo, char* url) {
char *new_url = strdup(url);
if (new_url == NULL) return FALSE;
free(fdinfo->url);
fdinfo->url = new_url;
return TRUE;
}
void evt_core_mv_fd2(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo, char* to_cat) {
struct evt_core_cat* cat = evt_core_get_from_cat (ctx, to_cat);
if (cat == NULL) {

View file

@ -64,3 +64,4 @@ struct evt_core_fdinfo* evt_core_get_from_url(struct evt_core_ctx* ctx, char* ur
void evt_core_free_app_ctx_simple(void* v);
struct evt_core_cat* evt_core_get_from_cat(struct evt_core_ctx* ctx, char* name);
struct evt_core_fdinfo* evt_core_get_first_from_cat(struct evt_core_ctx* ctx, char* name);
gboolean evt_core_fdinfo_url_set(struct evt_core_fdinfo* fdinfo, char* url);

View file

@ -31,7 +31,13 @@ int faketor_control_listen(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdi
int faketor_socks5_server_success(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
printf("success!\n");
struct socks5_ctx *s5ctx = fdinfo->other;
char buffer[1024];
sprintf(buffer, "socket:%s:%d", s5ctx->cr.dest_addr.dns.str, s5ctx->cr.port);
evt_core_fdinfo_url_set(fdinfo, buffer);
printf("new socket name: %s\n", fdinfo->url);
return EVT_CORE_FD_EXHAUSTED;
}