mirror of
https://github.com/bol-van/zapret2.git
synced 2026-03-13 22:03:09 +00:00
AI fixes
This commit is contained in:
@@ -389,7 +389,8 @@ function syndata(ctx, desync)
|
||||
dis.payload = blob(desync, desync.arg.blob, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00")
|
||||
apply_fooling(desync, dis)
|
||||
if desync.arg.tls_mod then
|
||||
dis.payload = tls_mod_shim(desync, dis.payload, desync.arg.tls_mod, nil)
|
||||
local pl = tls_mod_shim(desync, dis.payload, desync.arg.tls_mod, nil)
|
||||
if pl then desync.payload = pl end
|
||||
end
|
||||
if b_debug then DLOG("syndata: "..hexdump_dlog(dis.payload)) end
|
||||
if rawsend_dissect_ipfrag(dis, desync_opts(desync)) then
|
||||
@@ -449,7 +450,8 @@ function fake(ctx, desync)
|
||||
end
|
||||
local fake_payload = blob(desync, desync.arg.blob)
|
||||
if desync.reasm_data and desync.arg.tls_mod then
|
||||
fake_payload = tls_mod_shim(desync, fake_payload, desync.arg.tls_mod, desync.reasm_data)
|
||||
local pl = tls_mod_shim(desync, fake_payload, desync.arg.tls_mod, desync.reasm_data)
|
||||
if pl then fake_payload = pl end
|
||||
end
|
||||
-- check debug to save CPU
|
||||
if b_debug then DLOG("fake: "..hexdump_dlog(fake_payload)) end
|
||||
|
||||
11
nfq2/lua.c
11
nfq2/lua.c
@@ -3350,7 +3350,6 @@ static int luacall_tls_mod(lua_State *L)
|
||||
int argc=lua_gettop(L);
|
||||
|
||||
size_t fake_tls_len;
|
||||
bool bRes;
|
||||
const uint8_t *fake_tls = (uint8_t*)lua_reqlstring(L,1,&fake_tls_len);
|
||||
const char *modlist = lua_reqstring(L,2);
|
||||
|
||||
@@ -3370,8 +3369,10 @@ static int luacall_tls_mod(lua_State *L)
|
||||
uint8_t *newtls = lua_newuserdata(L, maxlen);
|
||||
|
||||
memcpy(newtls, fake_tls, newlen);
|
||||
bRes = TLSMod(&mod, payload, payload_len, newtls, &newlen, maxlen);
|
||||
lua_pushlstring(L,(char*)newtls,newlen);
|
||||
if (TLSMod(&mod, payload, payload_len, newtls, &newlen, maxlen))
|
||||
lua_pushlstring(L,(char*)newtls,newlen);
|
||||
else
|
||||
lua_pushnil(L);
|
||||
|
||||
lua_remove(L,-2);
|
||||
}
|
||||
@@ -3379,11 +3380,9 @@ static int luacall_tls_mod(lua_State *L)
|
||||
{
|
||||
// no mod. push it back
|
||||
lua_pushlstring(L,(char*)fake_tls,fake_tls_len);
|
||||
bRes = true;
|
||||
}
|
||||
lua_pushboolean(L, bRes);
|
||||
|
||||
LUA_STACK_GUARD_RETURN(L,2)
|
||||
LUA_STACK_GUARD_RETURN(L,1)
|
||||
}
|
||||
|
||||
struct userdata_zs
|
||||
|
||||
@@ -649,9 +649,11 @@ bool TLSAdvanceToHostInSNI(const uint8_t **ext, size_t *elen, size_t *slen)
|
||||
// u8 data+2 - server name type. 0=host_name
|
||||
// u16 data+3 - server name length
|
||||
if (*elen < 5 || (*ext)[2] != 0) return false;
|
||||
uint16_t nll = pntoh16(*ext);
|
||||
*slen = pntoh16(*ext + 3);
|
||||
if (nll<(*slen+3) || *slen > *elen-5) return false;
|
||||
*ext += 5; *elen -= 5;
|
||||
return *slen <= *elen;
|
||||
return true;
|
||||
}
|
||||
static bool TLSExtractHostFromExt(const uint8_t *ext, size_t elen, char *host, size_t len_host)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user