Expand description
bloodhound-export — write SharpHound-compatible BloodHound JSON from a Rust in-memory representation of an AD collection.
Extracted from ADhammer so any tool that collects AD data in Rust — an LDAP scraper, an NTDS.dit walker, a live-RPC enumerator — can emit BloodHound-ingestible JSON without pulling the whole ADhammer stack.
§Model
Build up a Snapshot:
ⓘ
use bloodhound_export::{Snapshot, DomainInfo, AdObject, export_zip};
use std::collections::HashMap;
use std::path::Path;
let mut u = AdObject::default();
u.dn = "CN=alice,CN=Users,DC=corp,DC=local".into();
u.attrs.insert("sAMAccountName".into(), vec!["alice".into()]);
u.attrs.insert("objectClass".into(), vec!["user".into()]);
u.attrs.insert("userAccountControl".into(), vec!["66048".into()]);
// (populate .bin with objectSid + nTSecurityDescriptor as raw bytes)
let snap = Snapshot::new(
DomainInfo {
domain_dn: "DC=corp,DC=local".into(),
netbios: Some("CORP".into()),
..Default::default()
},
vec![u],
);
export_zip(&snap, Path::new("bloodhound.zip")).unwrap();§Output
export_files returns the 4 JSON files SharpHound produces:
<domain>_users.json, <domain>_computers.json, <domain>_groups.json,
<domain>_domains.json (+ MetaTag / Version header per BH ingestion protocol v5).
export_zip wraps those into a single zip that BloodHound’s UI ingests directly.
§Compatibility
Targets BloodHound Community Edition ingest format v5 / SharpHound v2.x JSON. Emits Meta
Nodesshape; ACE edges are computed fromnTSecurityDescriptorif present in the per-object.binmap, usingwindows_sddlfor SD parsing.
Modules§
- rid
- Well-known RIDs used inside the exporter.
- uac
- userAccountControl bit flags (subset the exporter and its callers act on).
Structs§
- AdObject
- A generic collected AD object: distinguished name + multi-valued string attributes,
plus raw binary blobs (
objectSid,nTSecurityDescriptor,objectGUID,sIDHistory) that require caller-side parsing before display. - Domain
Info - Basic domain-level metadata a caller must supply once per snapshot.
- Guid
- Re-export the SID/GUID types so callers don’t need a separate
windows-sddldep. 16-byte GUID stored in the mixed-endian on-wire layout, normalized to a comparable byte array. Renderedaaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee. - Sid
- Re-export the SID/GUID types so callers don’t need a separate
windows-sddldep. Windows Security Identifier. Stored canonically;DisplayyieldsS-1-5-.... - Snapshot
- An immutable point-in-time capture of a directory. Callers build this from whatever
collection they run; the exporter walks its
objectsto emit BloodHound JSON.
Functions§
- export_
files - Build the full set of BloodHound JSON files (filename, bytes) for a snapshot.
- export_
zip - Export a snapshot to a single BloodHound
.zipatpath.