Add new obfuscation package

This commit is contained in:
9seconds
2026-02-23 10:12:25 +01:00
parent 432e530f68
commit d0065d35c2
11 changed files with 695 additions and 0 deletions
@@ -0,0 +1,33 @@
package obfuscation
import (
"encoding/binary"
"testing"
"github.com/stretchr/testify/assert"
)
func FuzzGenerateHandshakeFrame(f *testing.F) {
f.Fuzz(func(t *testing.T, arg int16) {
frame := generateHandshake(int(arg))
assert.NotEqualValues(t, 0xef, frame.data[0])
firstBytes := binary.LittleEndian.Uint32(frame.data[:4])
assert.NotEqualValues(t, 0x44414548, firstBytes)
assert.NotEqualValues(t, 0x54534f50, firstBytes)
assert.NotEqualValues(t, 0x20544547, firstBytes)
assert.NotEqualValues(t, 0x4954504f, firstBytes)
assert.NotEqualValues(t, 0x02010316, firstBytes)
assert.NotEqualValues(t, 0xeeeeeeee, firstBytes)
assert.NotEqualValues(t, 0xdddddddd, firstBytes)
assert.NotEqualValues(
t,
0,
frame.data[4]|frame.data[5]|frame.data[6]|frame.data[7])
assert.Equal(t, hfConnectionType[:], frame.connectionType())
assert.EqualValues(t, arg, frame.dc())
})
}