fase(6): fuzzing module complete

This commit is contained in:
debian
2026-03-05 09:22:55 -05:00
parent d62bd615bf
commit e746dc0497
46 changed files with 1727 additions and 35 deletions

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FuzzResult = void 0;
const Entity_1 = require("../../../../shared/domain/Entity");
class FuzzResult extends Entity_1.Entity {
static create(props, id) {
return new FuzzResult({ ...props, detectedAt: new Date() }, id);
}
static reconstitute(props, id) {
return new FuzzResult(props, id);
}
get sessionId() { return this.props.sessionId; }
get stateId() { return this.props.stateId; }
get selector() { return this.props.selector; }
get payload() { return this.props.payload; }
get strategy() { return this.props.strategy; }
get anomalyType() { return this.props.anomalyType; }
get severity() { return this.props.severity; }
get description() { return this.props.description; }
get detectedAt() { return this.props.detectedAt; }
}
exports.FuzzResult = FuzzResult;

View File

@@ -0,0 +1,96 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FuzzSession = void 0;
const AggregateRoot_1 = require("../../../../shared/domain/AggregateRoot");
const Result_1 = require("../../../../shared/domain/Result");
const FuzzIntensity_1 = require("../value-objects/FuzzIntensity");
const Seed_1 = require("../value-objects/Seed");
const FuzzStarted_1 = require("../events/FuzzStarted");
const FuzzCompleted_1 = require("../events/FuzzCompleted");
const VulnerabilityDetected_1 = require("../events/VulnerabilityDetected");
class FuzzSession extends AggregateRoot_1.AggregateRoot {
constructor(props, id) {
super(props, id);
}
static reconstitute(props, id) {
return new FuzzSession(props, id);
}
static create(request) {
let intensity;
try {
intensity = FuzzIntensity_1.FuzzIntensity.fromString(request.intensity);
}
catch (e) {
return (0, Result_1.Err)(e.message);
}
let seed;
try {
seed = Seed_1.Seed.create(request.seed);
}
catch (e) {
return (0, Result_1.Err)(e.message);
}
const props = {
crawlSessionId: request.crawlSessionId,
intensity,
seed,
status: 'running',
actionsExecuted: 0,
vulnerabilitiesFound: 0,
startedAt: new Date(),
};
const session = new FuzzSession(props);
session.addDomainEvent(new FuzzStarted_1.FuzzStarted(session.id.toString(), {
crawlSessionId: request.crawlSessionId,
intensity: request.intensity,
seed: request.seed,
}));
return (0, Result_1.Ok)(session);
}
get crawlSessionId() { return this.props.crawlSessionId; }
get intensity() { return this.props.intensity; }
get seed() { return this.props.seed; }
get status() { return this.props.status; }
get actionsExecuted() { return this.props.actionsExecuted; }
get vulnerabilitiesFound() { return this.props.vulnerabilitiesFound; }
get startedAt() { return this.props.startedAt; }
get completedAt() { return this.props.completedAt; }
recordVulnerability(result) {
this.props = {
...this.props,
actionsExecuted: this.props.actionsExecuted + 1,
vulnerabilitiesFound: this.props.vulnerabilitiesFound + 1,
};
this.addDomainEvent(new VulnerabilityDetected_1.VulnerabilityDetected(this.id.toString(), {
crawlSessionId: this.props.crawlSessionId,
stateId: result.stateId,
anomalyType: result.anomalyType,
severity: result.severity,
selector: result.selector,
payload: result.payload,
strategy: result.strategy,
}));
}
incrementActions() {
this.props = { ...this.props, actionsExecuted: this.props.actionsExecuted + 1 };
}
complete() {
this.props = { ...this.props, status: 'completed', completedAt: new Date() };
this.addDomainEvent(new FuzzCompleted_1.FuzzCompleted(this.id.toString(), {
crawlSessionId: this.props.crawlSessionId,
actionsExecuted: this.props.actionsExecuted,
vulnerabilitiesFound: this.props.vulnerabilitiesFound,
}));
}
fail(reason) {
this.props = { ...this.props, status: 'failed', completedAt: new Date() };
this.addDomainEvent(new FuzzCompleted_1.FuzzCompleted(this.id.toString(), {
crawlSessionId: this.props.crawlSessionId,
actionsExecuted: this.props.actionsExecuted,
vulnerabilitiesFound: this.props.vulnerabilitiesFound,
failed: true,
reason,
}));
}
}
exports.FuzzSession = FuzzSession;