endpoint-sentinel
Version:
User-friendly security scanner with interactive setup that scales from beginner to expert
143 lines (131 loc) ⢠4.79 kB
JavaScript
;
/**
* Consent Manager for Ethical Security Scanning
* Handles consent requirements and legal boundaries
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.ConsentManager = void 0;
class ConsentManager {
/**
* Gets the complete consent text for ethical scanning
*/
getConsentText() {
return `
š”ļø ENDPOINT SENTINEL - CONSENT AND TERMS OF USE
š IMPORTANT: Read carefully before proceeding
By using Endpoint Sentinel, you acknowledge and agree to the following:
1. AUTHORIZATION REQUIRED
ā
You have explicit written permission to test the target system
ā
You are authorized by the system owner or are the system owner
ā
You will not scan systems without proper authorization
2. ETHICAL SCANNING PRINCIPLES
ā
Respectful rate limiting (default: 2 requests/second)
ā
No destructive or intrusive testing
ā
Immediate cessation if requested by system administrators
ā
Responsible disclosure of any vulnerabilities found
3. LEGAL COMPLIANCE
ā
You will comply with all applicable laws and regulations
ā
You understand that unauthorized scanning may be illegal
ā
You accept full responsibility for your use of this tool
4. LIABILITY
ā
Use of this tool is at your own risk
ā
The authors are not responsible for any misuse or consequences
ā
You will not hold the developers liable for any damages
5. AUDIT AND LOGGING
ā
All scan activities are logged for security and compliance
ā
Logs may be retained for audit purposes
ā
You consent to activity monitoring and logging
ā ļø WARNING: Unauthorized scanning is illegal and unethical
ā ļø Only scan systems you own or have explicit permission to test
ā ļø When in doubt, obtain written authorization first
By proceeding with the --consent flag, you confirm:
⢠You have read and understood these terms
⢠You have proper authorization for the target system
⢠You will use this tool ethically and responsibly
⢠You accept all terms and conditions above
š Questions? Concerns? Stop and consult with legal counsel first.
`;
}
/**
* Validates that proper consent has been obtained
*/
validateConsent(consentGiven) {
if (!consentGiven) {
return {
isValid: false,
message: 'Explicit consent is required. Use --consent flag after reading terms.'
};
}
return { isValid: true };
}
/**
* Logs consent event for audit purposes
*/
logConsentEvent(target, timestamp = new Date()) {
const auditEntry = {
event: 'consent_granted',
target,
timestamp: timestamp.toISOString(),
userAgent: 'Endpoint-Sentinel/1.0.0',
sessionId: this.generateSessionId()
};
// In production, this would write to a secure audit log
console.log(`[AUDIT] ${JSON.stringify(auditEntry)}`);
}
/**
* Generates a unique session ID for tracking
*/
generateSessionId() {
return `es_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
}
/**
* Gets consent banner for display
*/
getConsentBanner() {
return `
š”ļø ETHICAL SECURITY SCANNING TOOL
ā ļø AUTHORIZATION REQUIRED ā ļø
Only scan systems you own or have explicit permission to test.
Unauthorized scanning may be illegal in your jurisdiction.
Use --consent flag to acknowledge terms and proceed.
Run 'endpoint-sentinel consent' to review full terms.
`;
}
/**
* Checks if target requires special consent (e.g., government, critical infrastructure)
*/
requiresSpecialConsent(target) {
const url = new URL(target);
const hostname = url.hostname.toLowerCase();
// Government domains
if (hostname.endsWith('.gov') || hostname.endsWith('.mil')) {
return {
required: true,
reason: 'Government domains require special authorization'
};
}
// Critical infrastructure patterns
const criticalInfraPatterns = [
/power/i,
/electric/i,
/utility/i,
/water/i,
/hospital/i,
/medical/i,
/bank/i,
/financial/i,
/emergency/i
];
for (const pattern of criticalInfraPatterns) {
if (pattern.test(hostname)) {
return {
required: true,
reason: 'Critical infrastructure domains require special authorization'
};
}
}
return { required: false };
}
}
exports.ConsentManager = ConsentManager;
//# sourceMappingURL=consent.js.map