mirror of
https://github.com/bol-van/zapret.git
synced 2024-11-26 12:10:53 +03:00
tpws: debug log data before and after 2nd TLS record
This commit is contained in:
parent
fa6f6822a1
commit
cde3ca15c2
@ -8,6 +8,13 @@
|
|||||||
#include "protocol.h"
|
#include "protocol.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
|
|
||||||
|
#define PKTDATA_MAXDUMP 32
|
||||||
|
|
||||||
|
void packet_debug(const uint8_t *data, size_t sz)
|
||||||
|
{
|
||||||
|
hexdump_limited_dlog(data, sz, PKTDATA_MAXDUMP); VPRINT("\n");
|
||||||
|
}
|
||||||
|
|
||||||
static bool dp_match(struct desync_profile *dp, const struct sockaddr *dest, const char *hostname, t_l7proto l7proto)
|
static bool dp_match(struct desync_profile *dp, const struct sockaddr *dest, const char *hostname, t_l7proto l7proto)
|
||||||
{
|
{
|
||||||
bool bHostlistsEmpty;
|
bool bHostlistsEmpty;
|
||||||
@ -327,6 +334,7 @@ void tamper_out(t_ctrack *ctrack, const struct sockaddr *dest, uint8_t *segment,
|
|||||||
if (l>=2)
|
if (l>=2)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
size_t dlen;
|
||||||
// length is checked in IsTLSClientHello and cannot exceed buffer size
|
// length is checked in IsTLSClientHello and cannot exceed buffer size
|
||||||
if ((tpos-5)>=l) tpos=5+1;
|
if ((tpos-5)>=l) tpos=5+1;
|
||||||
VPRINT("making 2 TLS records at pos %zu\n",tpos);
|
VPRINT("making 2 TLS records at pos %zu\n",tpos);
|
||||||
@ -337,6 +345,11 @@ void tamper_out(t_ctrack *ctrack, const struct sockaddr *dest, uint8_t *segment,
|
|||||||
phton16(segment+tpos+3,l-(tpos-5));
|
phton16(segment+tpos+3,l-(tpos-5));
|
||||||
phton16(segment+3,tpos-5);
|
phton16(segment+3,tpos-5);
|
||||||
*size += 5;
|
*size += 5;
|
||||||
|
VPRINT("-2nd TLS record: ");
|
||||||
|
dlen = tpos<16 ? tpos : 16;
|
||||||
|
packet_debug(segment+tpos-dlen,dlen);
|
||||||
|
VPRINT("+2nd TLS record: ");
|
||||||
|
packet_debug(segment+tpos,*size-tpos);
|
||||||
// fix split positions after tlsrec. increase split pos by tlsrec header size (5 bytes)
|
// fix split positions after tlsrec. increase split pos by tlsrec header size (5 bytes)
|
||||||
if (multisplit_pos)
|
if (multisplit_pos)
|
||||||
for(i=0;i<*multisplit_count;i++)
|
for(i=0;i<*multisplit_count;i++)
|
||||||
|
@ -28,3 +28,5 @@ void tamper_in(t_ctrack *ctrack, const struct sockaddr *client, uint8_t *segment
|
|||||||
void rst_in(t_ctrack *ctrack, const struct sockaddr *client);
|
void rst_in(t_ctrack *ctrack, const struct sockaddr *client);
|
||||||
// local leg closed connection (timeout waiting response ?)
|
// local leg closed connection (timeout waiting response ?)
|
||||||
void hup_out(t_ctrack *ctrack, const struct sockaddr *client);
|
void hup_out(t_ctrack *ctrack, const struct sockaddr *client);
|
||||||
|
|
||||||
|
void packet_debug(const uint8_t *data, size_t sz);
|
||||||
|
@ -24,8 +24,6 @@
|
|||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "hostlist.h"
|
#include "hostlist.h"
|
||||||
|
|
||||||
#define PKTDATA_MAXDUMP 32
|
|
||||||
|
|
||||||
// keep separate legs counter. counting every time thousands of legs can consume cpu
|
// keep separate legs counter. counting every time thousands of legs can consume cpu
|
||||||
static int legs_local, legs_remote;
|
static int legs_local, legs_remote;
|
||||||
/*
|
/*
|
||||||
@ -93,11 +91,6 @@ static bool socks_send_rep_errno(uint8_t ver, int fd, int errn)
|
|||||||
return ver==5 ? socks5_send_rep_errno(fd,errn) : socks4_send_rep_errno(fd, errn);
|
return ver==5 ? socks5_send_rep_errno(fd,errn) : socks4_send_rep_errno(fd, errn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void packet_debug(const uint8_t *data, size_t sz)
|
|
||||||
{
|
|
||||||
hexdump_limited_dlog(data, sz, PKTDATA_MAXDUMP); VPRINT("\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static bool cork(int fd, int enable)
|
static bool cork(int fd, int enable)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user