@@ -61,6 +61,30 @@ function posdebug(ctx,desync)
6161 DLOG (s )
6262end
6363
64+ -- basic desync function
65+ -- set l7payload to 'arg.payload' if reasm.data or desync.dis.payload contains 'arg.pattern' substring
66+ -- NOTE : this does not set payload on C code side !
67+ -- NOTE : C code will not see payload change. --payload args take only payloads known to C code and cause error if unknown.
68+ -- arg: pattern - substring for search inside reasm_data or desync.dis.payload
69+ -- arg: payload - set desync.l7payload to this if detected
70+ -- arg: undetected - set desync.l7payload to this if not detected
71+ -- test case : nfqws2 --qnum 200 --debug --lua-init=@zapret-lib.lua --lua-init=@zapret-antidpi.lua --lua-init=@zapret-auto.lua --lua-desync=detect_payload_str:pattern=1234:payload=my --lua-desync=fake:blob=0x1234:payload=my
72+ function detect_payload_str (ctx , desync )
73+ if not desync .arg .pattern then
74+ error (" detect_payload_str: missing 'pattern'" )
75+ end
76+ local data = desync .reasm_data or desync .dis .payload
77+ local b = string.find (data ,desync .arg .pattern ,1 ,true )
78+ if b then
79+ DLOG (" detect_payload_str: detected '" .. desync .arg .payload .. " '" )
80+ if desync .arg .payload then desync .l7payload = desync .arg .payload end
81+ else
82+ DLOG (" detect_payload_str: not detected '" .. desync .arg .payload .. " '" )
83+ if desync .arg .undetected then desync .l7payload = desync .arg .undetected end
84+ end
85+ end
86+
87+
6488-- this shim is needed then function is orchestrated. ctx services not available
6589-- have to emulate cutoff in LUA using connection persistent table track.lua_state
6690function instance_cutoff_shim (ctx , desync , dir )
0 commit comments