Template
1
0
mirror of https://github.com/bol-van/zapret2.git synced 2026-03-14 06:13:09 +00:00
This commit is contained in:
bol-van
2026-02-25 08:56:35 +03:00
parent 8e76197dff
commit 697f9fc986
6 changed files with 26 additions and 12 deletions

View File

@@ -98,10 +98,10 @@ function detect_payload_str(ctx, desync)
local data = desync.reasm_data or desync.dis.payload local data = desync.reasm_data or desync.dis.payload
local b = data and string.find(data,desync.arg.pattern,1,true) local b = data and string.find(data,desync.arg.pattern,1,true)
if b then if b then
DLOG("detect_payload_str: detected '"..desync.arg.payload.."'") DLOG("detect_payload_str: detected '"..(desync.arg.payload or '?').."'")
if desync.arg.payload then desync.l7payload = desync.arg.payload end if desync.arg.payload then desync.l7payload = desync.arg.payload end
else else
DLOG("detect_payload_str: not detected '"..desync.arg.payload.."'") DLOG("detect_payload_str: not detected '"..(desync.arg.payload or '?').."'")
if desync.arg.undetected then desync.l7payload = desync.arg.undetected end if desync.arg.undetected then desync.l7payload = desync.arg.undetected end
end end
end end
@@ -1201,7 +1201,7 @@ function rawsend_dissect_segmented(desync, dis, mss, options)
-- stop if failed -- stop if failed
return false return false
end end
discopy.tcp.th_seq = discopy.tcp.th_seq + len discopy.tcp.th_seq = u32add(discopy.tcp.th_seq, len)
pos = pos + len pos = pos + len
end end
return true return true

View File

@@ -803,8 +803,8 @@ static BOOL RemoveTokenPrivs(void)
if (memcmp(&privs->Privileges[k].Luid, &luid_SeChangeNotifyPrivilege, sizeof(LUID))) if (memcmp(&privs->Privileges[k].Luid, &luid_SeChangeNotifyPrivilege, sizeof(LUID)))
privs->Privileges[k].Attributes = SE_PRIVILEGE_REMOVED; privs->Privileges[k].Attributes = SE_PRIVILEGE_REMOVED;
} }
}
bRes = AdjustTokenPrivileges(hToken, FALSE, privs, dwSize, NULL, NULL); bRes = AdjustTokenPrivileges(hToken, FALSE, privs, dwSize, NULL, NULL);
}
free(privs); free(privs);
} }
} }

View File

@@ -2003,7 +2003,7 @@ static uint8_t dpi_desync_icmp_packet(
// invert direction. they are answering to this packet // invert direction. they are answering to this packet
bReverse = !bReverse; bReverse = !bReverse;
DLOG("found conntrack entry. inverted reverse=%u\n",bReverse); DLOG("found conntrack entry. inverted reverse=%u\n",bReverse);
if (ctrack->dp_search_complete) if (ctrack->dp_search_complete && ctrack->dp)
{ {
// RELATED icmp processed within base connection profile // RELATED icmp processed within base connection profile
dp = ctrack->dp; dp = ctrack->dp;

View File

@@ -1905,11 +1905,24 @@ static bool lua_reconstruct_ip6exthdr(lua_State *L, int idx, struct ip6_hdr *ip6
lua_getfield(L,-1, "data"); lua_getfield(L,-1, "data");
if (lua_type(L,-1)!=LUA_TSTRING) goto err; if (lua_type(L,-1)!=LUA_TSTRING) goto err;
if (!(p=(uint8_t*)lua_tolstring(L,-1,&l))) l=0; if (!(p=(uint8_t*)lua_tolstring(L,-1,&l))) l=0;
if (l<6 || (l+2)>left || (type==IPPROTO_AH ? (l>=1024 || ((l+2) & 3)) : (l>=2048 || ((l+2) & 7)))) goto err;
if (l<6 || (l+2)>left) goto err;
if (type==IPPROTO_AH)
{
if (l>=1024 || ((l+2) & 3)) goto err;
memcpy(data+2,p,l); memcpy(data+2,p,l);
l+=2; l+=2;
data[1] = (l>>2)-2;
}
else
{
if (l>=2048 || ((l+2) & 7)) goto err;
memcpy(data+2,p,l);
l+=2;
data[1] = (l>>3)-1;
}
data[0] = next; // may be overwritten later data[0] = next; // may be overwritten later
data[1] = (type==IPPROTO_AH) ? (l>>2)-2 : (l>>3)-1;
if (!preserve_next) *last_proto = type; if (!preserve_next) *last_proto = type;
last_proto = data; // first byte of header holds type last_proto = data; // first byte of header holds type
left -= l; data += l; filled += l; left -= l; data += l; filled += l;

View File

@@ -260,8 +260,8 @@ static int nfq_cb(struct nfq_q_handle *qh, struct nfgenmsg *nfmsg, struct nfq_da
uint32_t mark; uint32_t mark;
struct ifreq ifr_in, ifr_out; struct ifreq ifr_in, ifr_out;
ph = nfq_get_msg_packet_hdr(nfa); if (!(ph = nfq_get_msg_packet_hdr(nfa))) return 0; // should not happen
id = ph ? ntohl(ph->packet_id) : 0; id = ntohl(ph->packet_id);
mark = nfq_get_nfmark(nfa); mark = nfq_get_nfmark(nfa);
ilen = nfq_get_payload(nfa, &data); ilen = nfq_get_payload(nfa, &data);
@@ -666,6 +666,7 @@ static int dvt_main(void)
if (rd < 0) if (rd < 0)
{ {
DLOG_PERROR("recvfrom"); DLOG_PERROR("recvfrom");
if (errno==ENOBUFS) continue;
goto exiterr; goto exiterr;
} }
else if (rd > 0) else if (rd > 0)

View File

@@ -565,7 +565,7 @@ bool TLSFindExtLenOffsetInHandshake(const uint8_t *data, size_t len, size_t *off
} }
bool TLSFindExtLen(const uint8_t *data, size_t len, size_t *off) bool TLSFindExtLen(const uint8_t *data, size_t len, size_t *off)
{ {
if (!TLSFindExtLenOffsetInHandshake(data+5,len-5,off)) if (len<5 || !TLSFindExtLenOffsetInHandshake(data+5,len-5,off))
return false; return false;
*off+=5; *off+=5;
return true; return true;