[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)
80 lines · 2.1 KB
| 1 | package evasion |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | "math" |
| 6 | ) |
| 7 | |
| 8 | // EmbedCarrier embeds a framed chunk into the designated carrier medium. |
| 9 | func EmbedCarrier(chunk []byte, carrier CarrierType, seed int64) ([]byte, error) { |
| 10 | switch carrier { |
| 11 | case CarrierNone, "": |
| 12 | return chunk, nil |
| 13 | |
| 14 | case CarrierBMP: |
| 15 | neededPixels := ((len(chunk)+16)*8)/3 + 100 |
| 16 | dim := int(math.Sqrt(float64(neededPixels))) + 1 |
| 17 | if dim < 64 { |
| 18 | dim = 64 |
| 19 | } |
| 20 | bmpData := GenerateProceduralBMP(dim, dim, seed) |
| 21 | return EmbedBMP(bmpData, chunk) |
| 22 | |
| 23 | case CarrierPNG: |
| 24 | pngData, err := GenerateProceduralPNG(128, 128, seed) |
| 25 | if err != nil { |
| 26 | return nil, fmt.Errorf("failed to generate procedural PNG: %w", err) |
| 27 | } |
| 28 | return EmbedPNGAncillary(pngData, chunk) |
| 29 | |
| 30 | case CarrierWAV: |
| 31 | sampleRate := 44100 |
| 32 | neededSamples := (len(chunk) + 16) * 8 |
| 33 | durationSec := (neededSamples / (sampleRate * 2)) + 2 |
| 34 | if durationSec < 2 { |
| 35 | durationSec = 2 |
| 36 | } |
| 37 | wavData := GenerateProceduralWAV(durationSec, sampleRate, seed) |
| 38 | return EmbedWAV(wavData, chunk) |
| 39 | |
| 40 | case CarrierJPEGZIP: |
| 41 | jpegData, err := GenerateProceduralJPEG(128, 128, seed) |
| 42 | if err != nil { |
| 43 | return nil, fmt.Errorf("failed to generate procedural JPEG: %w", err) |
| 44 | } |
| 45 | return BuildJPEGZIPPolyglot(jpegData, chunk, "contraband_data.bin") |
| 46 | |
| 47 | case CarrierPDFJAR: |
| 48 | pdfData := GenerateProceduralPDF("Contraband Assessment Report", seed) |
| 49 | return BuildPDFJARPolyglot(pdfData, chunk, "contraband_data.bin") |
| 50 | |
| 51 | default: |
| 52 | return nil, fmt.Errorf("unsupported carrier type: %s", carrier) |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | // ExtractCarrier extracts the chunk bytes from the designated carrier medium. |
| 57 | func ExtractCarrier(carrierData []byte, carrier CarrierType) ([]byte, error) { |
| 58 | switch carrier { |
| 59 | case CarrierNone, "": |
| 60 | return carrierData, nil |
| 61 | |
| 62 | case CarrierBMP: |
| 63 | return ExtractBMP(carrierData) |
| 64 | |
| 65 | case CarrierPNG: |
| 66 | return ExtractPNGAncillary(carrierData) |
| 67 | |
| 68 | case CarrierWAV: |
| 69 | return ExtractWAV(carrierData) |
| 70 | |
| 71 | case CarrierJPEGZIP: |
| 72 | return ExtractJPEGZIP(carrierData, "contraband_data.bin") |
| 73 | |
| 74 | case CarrierPDFJAR: |
| 75 | return ExtractPDFJAR(carrierData, "contraband_data.bin") |
| 76 | |
| 77 | default: |
| 78 | return nil, fmt.Errorf("unsupported carrier type: %s", carrier) |
| 79 | } |
| 80 | } |