[SHEHZADE//ABDULLAH ANSARI]
Red Team Consultant @ Google | MS in Cybersecurity @ NYU
● Notice //GitHub (@shehzade) is temporarily suspended pending an automated false-positive review. All tools are hosted on this Code Mirror and available on request (contact); GitHub links will return once reinstated.
PUBLIC MIRRORGo v1.0
Multi-protocol network egress assessment and DLP verification framework featuring automated L4 sweeps, corporate proxy traversal, and covert protocol smuggling across 20+ channels.
$
git clone https://shehzade.io/repos/contraband.git
Copy
Source ZIP (1.93 MB)
44 lines · 995 B
| 1 | package dlp |
| 2 | |
| 3 | import ( |
| 4 | "bytes" |
| 5 | "io" |
| 6 | "math/rand" |
| 7 | "time" |
| 8 | ) |
| 9 | |
| 10 | // Generator provides batch and streaming synthetic DLP generation. |
| 11 | type Generator struct { |
| 12 | cfg GeneratorConfig |
| 13 | rng *rand.Rand |
| 14 | } |
| 15 | |
| 16 | // NewGenerator returns a new Generator instance with the given configuration. |
| 17 | func NewGenerator(cfg GeneratorConfig) *Generator { |
| 18 | seed := cfg.Seed |
| 19 | if seed == 0 { |
| 20 | seed = time.Now().UnixNano() |
| 21 | } |
| 22 | return &Generator{ |
| 23 | cfg: cfg, |
| 24 | rng: rand.New(rand.NewSource(seed)), |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | // GeneratePayload generates a fixed-size payload into a byte slice. |
| 29 | func (g *Generator) GeneratePayload(size int64) ([]byte, error) { |
| 30 | streamer := NewDLPStreamer(size, g.cfg) |
| 31 | defer streamer.Close() |
| 32 | |
| 33 | var buf bytes.Buffer |
| 34 | _, err := io.Copy(&buf, streamer) |
| 35 | if err != nil && err != io.EOF { |
| 36 | return nil, err |
| 37 | } |
| 38 | return buf.Bytes(), nil |
| 39 | } |
| 40 | |
| 41 | // StreamPayload returns an io.Reader that streams the configured volume of DLP data. |
| 42 | func (g *Generator) StreamPayload(size int64) *DLPStreamer { |
| 43 | return NewDLPStreamer(size, g.cfg) |
| 44 | } |