patching socks5
This commit is contained in:
parent
4463100e1d
commit
e3653112a6
3 changed files with 12 additions and 9 deletions
|
@ -77,7 +77,6 @@ union abstract_packet {
|
|||
} fmt;
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct buffer_packet {
|
||||
enum BP_MODE mode;
|
||||
uint8_t ap_count;
|
||||
|
@ -87,7 +86,6 @@ struct buffer_packet {
|
|||
char ip[6000];
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct udp_target {
|
||||
struct sockaddr_in addr;
|
||||
socklen_t addrlen;
|
||||
|
|
12
src/socks5.c
12
src/socks5.c
|
@ -57,15 +57,15 @@ void socks5_create_dns_client(struct evt_core_ctx* ctx, char* proxy_host, char*
|
|||
s5ctx->cr.cmd = CMD_CONNECT;
|
||||
s5ctx->cr.rsv = 0x00;
|
||||
s5ctx->cr.atyp = ATYP_DOMAINNAME;
|
||||
s5ctx->cr.dst_addr_len = domainLength;
|
||||
s5ctx->cr.dst_addr = addr;
|
||||
s5ctx->cr.dest_addr.dns.len = domainLength;
|
||||
strcpy((char*)&s5ctx->cr.dest_addr.dns.str, addr);
|
||||
s5ctx->cr.port = htons(port);
|
||||
|
||||
// 3.3 Generate client request buffer
|
||||
s5ctx->cr_size = 0;
|
||||
fill_buffer(&s5ctx->cr_size, s5ctx->cr_buffer, &s5ctx->cr, 5*sizeof(uint8_t));
|
||||
fill_buffer(&s5ctx->cr_size, s5ctx->cr_buffer, s5ctx->cr.dst_addr, s5ctx->cr.dst_addr_len*sizeof(char));
|
||||
fill_buffer(&s5ctx->cr_size, s5ctx->cr_buffer, &s5ctx->cr.port, sizeof(uint16_t));
|
||||
fill_buffer2(&s5ctx->cr_size, s5ctx->cr_buffer, &s5ctx->cr, &s5ctx->cr.dest_addr.dns.str);
|
||||
fill_buffer(&s5ctx->cr_size, s5ctx->cr_buffer, &s5ctx->cr.dest_addr.dns.str, s5ctx->cr.dest_addr.dns.len);
|
||||
fill_buffer2(&s5ctx->cr_size, s5ctx->cr_buffer, &s5ctx->cr.port, &s5ctx->cr + 1);
|
||||
|
||||
reg_fdinfo = evt_core_add_fd (ctx, &fdinfo);
|
||||
}
|
||||
|
@ -430,7 +430,9 @@ send_hs_error:
|
|||
}
|
||||
|
||||
int on_socks5_server_recv_client_req(struct evt_core_ctx* ctx, struct evt_core_fdinfo* fdinfo) {
|
||||
struct socks5_ctx* s5ctx = fdinfo->other;
|
||||
|
||||
if (s5ctx->cr_cursor )
|
||||
|
||||
return EVT_CORE_FD_UNFINISHED;
|
||||
}
|
||||
|
|
|
@ -78,27 +78,30 @@ static char* rep_msg[] = {
|
|||
* https://tools.ietf.org/html/rfc1928
|
||||
*/
|
||||
|
||||
#pragma pack(1)
|
||||
struct client_handshake {
|
||||
uint8_t ver;
|
||||
uint8_t nmethods;
|
||||
uint8_t methods[255];
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct server_handshake {
|
||||
uint8_t ver;
|
||||
uint8_t method;
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct client_request {
|
||||
uint8_t ver;
|
||||
uint8_t cmd;
|
||||
uint8_t rsv;
|
||||
uint8_t atyp;
|
||||
uint8_t dst_addr_len;
|
||||
char* dst_addr;
|
||||
union socks5_addr dest_addr;
|
||||
uint16_t port;
|
||||
};
|
||||
|
||||
#pragma pack(1)
|
||||
struct server_reply {
|
||||
uint8_t ver;
|
||||
uint8_t rep;
|
||||
|
|
Loading…
Reference in a new issue