[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)
255 lines · 6.6 KB
| 1 | package common |
| 2 | |
| 3 | import ( |
| 4 | "time" |
| 5 | ) |
| 6 | |
| 7 | // Build metadata injected via Makefile -ldflags |
| 8 | var ( |
| 9 | Version = "1.0.0" |
| 10 | Commit = "standalone" |
| 11 | BuildDate = "2026-11-06T00:00:00Z" |
| 12 | BuiltBy = "shehzade" |
| 13 | ) |
| 14 | |
| 15 | // Magic numbers and framing identifiers |
| 16 | const ( |
| 17 | // MagicHeader is the 4-byte signature "CTRB" (0x43545242) |
| 18 | MagicHeader uint32 = 0x43545242 |
| 19 | MagicICMP uint32 = 0x43545242 |
| 20 | UDPProbeToken = "CTRB_UDP_PROBE\n" |
| 21 | ChunkHeaderSize = 32 // 4B Magic + 16B Token + 4B Seq + 4B Total + 4B Length |
| 22 | ) |
| 23 | |
| 24 | var ( |
| 25 | MagicHeaderBytes = []byte{0x43, 0x54, 0x52, 0x42} |
| 26 | ) |
| 27 | |
| 28 | // Protocol Header Names |
| 29 | const ( |
| 30 | HeaderSessionID = "X-CTRB-Session-ID" |
| 31 | HeaderSequence = "X-CTRB-Sequence" |
| 32 | HeaderTotalChunks = "X-CTRB-Total-Chunks" |
| 33 | HeaderPayloadLength = "X-CTRB-Payload-Length" |
| 34 | HeaderWireHash = "X-CTRB-Wire-Hash" |
| 35 | HeaderPayloadHash = "X-CTRB-Payload-Hash" |
| 36 | HeaderClientIP = "X-CTRB-Client-IP" |
| 37 | HeaderClientHost = "X-CTRB-Client-Host" |
| 38 | HeaderNetworkZone = "X-CTRB-Network-Zone" |
| 39 | HeaderProtocol = "X-CTRB-Protocol" |
| 40 | ) |
| 41 | |
| 42 | // Port Presets |
| 43 | const ( |
| 44 | PortPresetQuick = "quick" |
| 45 | PortPresetStandard = "standard" |
| 46 | PortPresetFull = "full" |
| 47 | |
| 48 | PortMin = 1 |
| 49 | PortMax = 65535 |
| 50 | ) |
| 51 | |
| 52 | // QuickPorts contains the top 25 enterprise firewall egress ports |
| 53 | var QuickPorts = []int{ |
| 54 | 21, 22, 23, 25, 53, 80, 88, 110, 123, 135, |
| 55 | 139, 143, 389, 443, 445, 465, 587, 853, 990, 993, |
| 56 | 995, 1433, 3389, 8080, 8443, |
| 57 | } |
| 58 | |
| 59 | // StandardPorts contains the top 200 enterprise firewall egress ports (sorted and deduplicated) |
| 60 | var StandardPorts = []int{ |
| 61 | 20, 21, 22, 23, 25, 43, 53, 67, 68, 69, |
| 62 | 79, 80, 81, 82, 84, 88, 110, 111, 119, 123, |
| 63 | 135, 137, 138, 139, 143, 161, 162, 179, 194, 389, |
| 64 | 411, 412, 443, 444, 445, 446, 464, 465, 500, 513, |
| 65 | 514, 515, 520, 524, 548, 554, 587, 631, 636, 688, |
| 66 | 853, 854, 873, 902, 989, 990, 992, 993, 995, 1025, |
| 67 | 1026, 1080, 1099, 1194, 1214, 1241, 1352, 1433, 1434, 1512, |
| 68 | 1521, 1522, 1527, 1701, 1723, 1755, 1812, 1813, 1883, 1900, |
| 69 | 1935, 2000, 2049, 2082, 2083, 2086, 2087, 2181, 2222, 2375, |
| 70 | 2376, 2379, 2380, 2483, 2484, 2525, 2526, 2809, 3000, 3128, |
| 71 | 3260, 3268, 3269, 3306, 3389, 3478, 3690, 4000, 4200, 4333, |
| 72 | 4369, 4500, 5000, 5001, 5060, 5061, 5173, 5222, 5223, 5269, |
| 73 | 5353, 5432, 5433, 5555, 5601, 5671, 5672, 5800, 5900, 5901, |
| 74 | 5984, 5985, 5986, 5988, 5989, 6000, 6379, 6443, 6514, 6666, |
| 75 | 6667, 7000, 7001, 7002, 7077, 7474, 8000, 8001, 8008, 8009, |
| 76 | 8080, 8081, 8082, 8083, 8085, 8086, 8087, 8088, 8089, 8090, |
| 77 | 8123, 8181, 8243, 8280, 8333, 8443, 8500, 8600, 8843, 8883, |
| 78 | 8888, 9000, 9001, 9002, 9042, 9080, 9090, 9092, 9093, 9100, |
| 79 | 9200, 9300, 9418, 9443, 9444, 9999, 10000, 10022, 10443, 11211, |
| 80 | 15672, 18080, 18081, 27017, 27018, 28017, 50000, 50070, 51820, 61616, |
| 81 | } |
| 82 | |
| 83 | // 20 Core Protocol Identifiers |
| 84 | const ( |
| 85 | // Web & Modern L7 |
| 86 | ProtoHTTP1 = "http_post" |
| 87 | ProtoHTTP2 = "https_post" |
| 88 | ProtoHTTP3 = "http3_quic" |
| 89 | ProtoWebSocket = "websocket_binary" |
| 90 | ProtoGRPC = "grpc_protobuf" |
| 91 | ProtoWebDAV = "webdav" |
| 92 | |
| 93 | // DNS & Tunneling |
| 94 | ProtoDNSA = "dns_a" |
| 95 | ProtoDNSTXT = "dns_txt" |
| 96 | ProtoDoH = "dns_over_https" |
| 97 | ProtoDoT = "dns_over_tls" |
| 98 | |
| 99 | // File & Mail |
| 100 | ProtoFTP = "ftp" |
| 101 | ProtoFTPS = "ftps" |
| 102 | ProtoSFTP = "sftp" |
| 103 | ProtoSMTP = "smtp" |
| 104 | |
| 105 | // Windows SMB |
| 106 | ProtoSMBFile = "smb_file" |
| 107 | ProtoSMBHash = "smb_hash_capture" |
| 108 | ProtoSMBQUIC = "smb_quic" |
| 109 | |
| 110 | // Native Cloud Storage |
| 111 | ProtoAWSS3 = "aws_s3" |
| 112 | ProtoGCPGCS = "gcp_gcs" |
| 113 | ProtoAzureBlob = "azure_blob" |
| 114 | |
| 115 | // Covert & Infrastructure |
| 116 | ProtoICMPEcho = "icmp_echo" |
| 117 | ProtoNTPTime = "ntp_timestamp" |
| 118 | ProtoSyslog = "syslog" |
| 119 | ProtoMQTT = "mqtt" |
| 120 | |
| 121 | // Compatibility aliases |
| 122 | ProtoSMBTCP = ProtoSMBFile |
| 123 | ProtoICMP = ProtoICMPEcho |
| 124 | ProtoNTP = ProtoNTPTime |
| 125 | ) |
| 126 | |
| 127 | // Protocol Categories |
| 128 | const ( |
| 129 | CategoryAll = "all" |
| 130 | CategoryWeb = "web" |
| 131 | CategoryDNS = "dns" |
| 132 | CategoryFile = "file" |
| 133 | CategoryMail = "mail" |
| 134 | CategorySMB = "smb" |
| 135 | CategoryCloud = "cloud" |
| 136 | CategoryCovert = "covert" |
| 137 | ) |
| 138 | |
| 139 | // CategoryMap maps category names to protocol identifier lists |
| 140 | var CategoryMap = map[string][]string{ |
| 141 | CategoryWeb: {ProtoHTTP1, ProtoHTTP2, ProtoHTTP3, ProtoWebSocket, ProtoGRPC, ProtoWebDAV}, |
| 142 | CategoryDNS: {ProtoDNSA, ProtoDNSTXT, ProtoDoH, ProtoDoT}, |
| 143 | CategoryFile: {ProtoFTP, ProtoFTPS, ProtoSFTP}, |
| 144 | CategoryMail: {ProtoSMTP}, |
| 145 | CategorySMB: {ProtoSMBFile, ProtoSMBHash, ProtoSMBQUIC}, |
| 146 | CategoryCloud: {ProtoAWSS3, ProtoGCPGCS, ProtoAzureBlob}, |
| 147 | CategoryCovert: {ProtoICMPEcho, ProtoNTPTime, ProtoSyslog, ProtoMQTT}, |
| 148 | } |
| 149 | |
| 150 | // uTLS Fingerprint Presets |
| 151 | const ( |
| 152 | TLSFingerprintChrome = "chrome" |
| 153 | TLSFingerprintEdge = "edge" |
| 154 | TLSFingerprintSafari = "safari" |
| 155 | TLSFingerprintFirefox = "firefox" |
| 156 | TLSFingerprintCurl = "curl" |
| 157 | TLSFingerprintDefault = "default" |
| 158 | ) |
| 159 | |
| 160 | var AllTLSFingerprints = []string{ |
| 161 | TLSFingerprintChrome, |
| 162 | TLSFingerprintEdge, |
| 163 | TLSFingerprintSafari, |
| 164 | TLSFingerprintFirefox, |
| 165 | TLSFingerprintCurl, |
| 166 | TLSFingerprintDefault, |
| 167 | } |
| 168 | |
| 169 | // ALPN Constants |
| 170 | const ( |
| 171 | ALPNHTTP1 = "http/1.1" |
| 172 | ALPNHTTP2 = "h2" |
| 173 | ALPNHTTP3 = "h3" |
| 174 | ALPNFTP = "ftp" |
| 175 | ALPNDoT = "dot" |
| 176 | ALPNSMB = "smb" |
| 177 | ALPNMQTT = "mqtt" |
| 178 | ) |
| 179 | |
| 180 | // Cadence Pacing Profiles |
| 181 | const ( |
| 182 | CadenceBurst = "burst" |
| 183 | CadenceSteady = "steady" |
| 184 | CadenceJittered = "jittered" |
| 185 | CadenceOfficeHours = "office-hours" |
| 186 | CadenceLowAndSlow = "low-and-slow" |
| 187 | ) |
| 188 | |
| 189 | var AllCadenceProfiles = []string{ |
| 190 | CadenceBurst, |
| 191 | CadenceSteady, |
| 192 | CadenceJittered, |
| 193 | CadenceOfficeHours, |
| 194 | CadenceLowAndSlow, |
| 195 | } |
| 196 | |
| 197 | // Synthetic DLP Payload Types |
| 198 | const ( |
| 199 | DLPTypePCI = "pci" |
| 200 | DLPTypePII = "pii" |
| 201 | DLPTypeHIPAA = "hipaa" |
| 202 | DLPTypeSecrets = "secrets" |
| 203 | DLPTypeAll = "all" |
| 204 | ) |
| 205 | |
| 206 | var AllDLPTypes = []string{DLPTypePCI, DLPTypePII, DLPTypeHIPAA, DLPTypeSecrets} |
| 207 | |
| 208 | // Procedural Carrier Contexts |
| 209 | const ( |
| 210 | CarrierCSV = "csv" |
| 211 | CarrierJSON = "json" |
| 212 | CarrierSQL = "sql" |
| 213 | CarrierEmail = "email" |
| 214 | CarrierSyslog = "syslog" |
| 215 | CarrierNoise = "noise" |
| 216 | ) |
| 217 | |
| 218 | var AllCarrierTypes = []string{CarrierCSV, CarrierJSON, CarrierSQL, CarrierEmail, CarrierSyslog, CarrierNoise} |
| 219 | |
| 220 | // Evasion Transforms |
| 221 | const ( |
| 222 | TransformRaw = "raw" |
| 223 | TransformBase64 = "base64" |
| 224 | TransformHex = "hex" |
| 225 | TransformGzip = "gzip" |
| 226 | TransformZlib = "zlib" |
| 227 | TransformZstd = "zstd" |
| 228 | TransformAESGCM = "aes_gcm" |
| 229 | ) |
| 230 | |
| 231 | // Steganography Smuggling Types |
| 232 | const ( |
| 233 | StegoNone = "none" |
| 234 | StegoPNG = "png" |
| 235 | StegoJPEG = "jpeg" |
| 236 | StegoPDF = "pdf" |
| 237 | StegoZIP = "zip" |
| 238 | ) |
| 239 | |
| 240 | // Operational Defaults & Tuning |
| 241 | const ( |
| 242 | DefaultConcurrency = 100 |
| 243 | MaxConcurrency = 1000 |
| 244 | DefaultRateLimit = 500 // packets per second |
| 245 | DefaultChunkSize = 1024 * 1024 // 1MB |
| 246 | DefaultThreads = 4 |
| 247 | MaxThreads = 64 |
| 248 | DefaultTCPTimeout = 1500 * time.Millisecond |
| 249 | DefaultWPADTimeout = 3 * time.Second |
| 250 | DefaultReportPort = 8088 |
| 251 | DefaultServerBind = "0.0.0.0" |
| 252 | FixedNTLMChallenge = "1122334455667788" |
| 253 | ) |
| 254 | |
| 255 | var FixedNTLMChallengeBytes = []byte{0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88} |