[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)
56 lines · 1.8 KB
| 1 | package server |
| 2 | |
| 3 | import ( |
| 4 | "time" |
| 5 | |
| 6 | "github.com/shehzade/contraband/pkg/common" |
| 7 | "github.com/shehzade/contraband/pkg/server/state" |
| 8 | ) |
| 9 | |
| 10 | var ( |
| 11 | ErrLedgerClosed = state.ErrLedgerClosed |
| 12 | ErrSessionNotFound = state.ErrSessionNotFound |
| 13 | ErrProbeNotFound = state.ErrProbeNotFound |
| 14 | ErrInvalidChunk = state.ErrInvalidChunk |
| 15 | ErrHashMismatch = state.ErrHashMismatch |
| 16 | ErrSessionIncomplete = state.ErrSessionIncomplete |
| 17 | ) |
| 18 | |
| 19 | type Ledger = state.Ledger |
| 20 | type LedgerObserver = state.LedgerObserver |
| 21 | type MemoryLedger = state.MemoryLedger |
| 22 | type SQLiteLedger = state.SQLiteLedger |
| 23 | |
| 24 | // NewLedger creates a polymorphic Ledger instance. If dbPath is empty or ":memory:", |
| 25 | // it initializes a fast in-memory ledger. Otherwise, it opens a pure-Go SQLite ledger. |
| 26 | func NewLedger(dbPath string) (Ledger, error) { |
| 27 | return state.NewLedger(dbPath) |
| 28 | } |
| 29 | |
| 30 | // NewMemoryLedger initializes a fresh in-memory ledger. |
| 31 | func NewMemoryLedger() *MemoryLedger { |
| 32 | return state.NewMemoryLedger() |
| 33 | } |
| 34 | |
| 35 | // NewSQLiteLedger opens or creates a SQLite database at the specified path. |
| 36 | func NewSQLiteLedger(dbPath string) (*SQLiteLedger, error) { |
| 37 | return state.NewSQLiteLedger(dbPath) |
| 38 | } |
| 39 | |
| 40 | // CloneSession creates a deep copy of a Session struct to prevent data races. |
| 41 | func CloneSession(s *common.Session) *common.Session { |
| 42 | return state.CloneSession(s) |
| 43 | } |
| 44 | |
| 45 | type ReassemblyResult = state.ReassemblyResult |
| 46 | |
| 47 | // ReassembleChunks validates contiguous sequences, constructs the full binary payload, |
| 48 | // computes the rolling SHA-256 hash, and performs cryptographic verification. |
| 49 | func ReassembleChunks(chunks map[uint32][]byte, total uint32, expectedHash string) state.ReassemblyResult { |
| 50 | return state.ReassembleChunks(chunks, total, expectedHash) |
| 51 | } |
| 52 | |
| 53 | // FormatTimeMS returns the duration formatted in milliseconds. |
| 54 | func FormatTimeMS(d time.Duration) float64 { |
| 55 | return state.FormatTimeMS(d) |
| 56 | } |