Advanced Security Testing and Analysis Framework with AI capabilities
npm install @feardread/security-agentAdvanced Security Testing and Analysis Framework with AI capabilities
A comprehensive security testing toolkit that combines traditional security tools with AI-powered analysis for vulnerability assessment, code analysis, network scanning, and more.



``bash`
npm install -g security-agent
`bash`
npm install security-agent
`bash`
git clone https://github.com/yourusername/security-agent.git
cd security-agent
npm install
npm link # For global CLI access
Start the interactive command-line interface:
`bash`
security-agentor
security-agent start
This launches the full-featured interactive shell with command history, auto-completion, and real-time feedback.
Run individual commands directly:
`bashCheck network information
security-agent exec network-info
$3
Execute multiple commands from a JSON file:
`bash
Create example batch file
security-agent example -o my-commands.jsonRun batch commands
security-agent batch my-commands.json
`Example batch file (
my-commands.json):
`json
[
{
"command": "network-info",
"args": []
},
{
"command": "scan-ports",
"args": ["localhost", "80,443"]
},
{
"command": "ai-status",
"args": []
}
]
`$3
Use Security Agent as a library in your Node.js applications:
`javascript
const securityAgent = require('security-agent');// Initialize agent
const { agent, controller } = securityAgent.initialize();
// Execute commands
async function runSecurity() {
try {
// Check network info
await securityAgent.executeCommand('network-info');
// Scan ports
await securityAgent.executeCommand('scan-ports', ['localhost', '80,443']);
// Get status
const status = securityAgent.getStatus();
console.log('Agent Status:', status);
// Execute batch
const results = await securityAgent.executeBatch([
{ command: 'network-info', args: [] },
{ command: 'check-ip', args: [] }
]);
console.log('Batch Results:', results);
} catch (error) {
console.error('Error:', error.message);
} finally {
// Cleanup
securityAgent.shutdown();
}
}
runSecurity();
`$3
Use the agent controller in your Express application:
`javascript
const express = require('express');
const securityAgent = require('security-agent');const app = express();
app.use(express.json());
// Custom route handler
app.post('/api/security/scan', async (req, res) => {
try {
const { target, ports } = req.body;
const result = await securityAgent.executeCommand('scan-ports', [target, ports]);
res.json({ success: true, result });
} catch (error) {
res.status(500).json({ success: false, error: error.message });
}
});
// Or use the built-in controller
const agentController = securityAgent.getController();
app.post('/api/agent/execute', async (req, res) => {
const handler = {
success: (res, data) => res.json(data),
error: (res, message, code) => res.status(code).json({ error: message })
};
const logger = console;
return agentController.executeCommand(req, res, handler, logger);
});
app.listen(3000, () => {
console.log('Server running on port 3000');
});
`CLI Commands Reference
$3
-
help - Show help information
- status - Display system and module status
- version - Show version information
- history - View command history
- tips - Show tips and tricks
- exit - Exit the agent$3
-
ai-setup - Configure AI provider (openai/anthropic)
- ai-status - Show AI module status
- ai-analyze - Analyze code for security issues
- ai-scan - Quick security scan
- ai-ask - Ask AI a security question
- chat - Start interactive AI chat session$3
-
scan-ports - Scan network ports
- network-info - Display network information
- security-audit - Run comprehensive security audit
- check-deps - Check for vulnerable dependencies$3
-
search-cve - Search CVE database
- check-cwe - Check CWE details
- check-package - Check package vulnerabilities
- scan-deps [path] - Scan project dependencies$3
-
analyze-code - Analyze code file
- analyze-project - Analyze entire project
- refactor-file - Refactor JavaScript file
- html-to-react - Convert HTML to React$3
-
scrape - Scrape webpage
- analyze-headers - Analyze security headers
- test-endpoint - Test API endpoint$3
-
ls [path] - List files
- cd - Change directory
- pwd - Show current directory
- cat - Display file contents
- find - Search for files$3
-
check-ip - Check current public IP
- configure-proxifly - Configure Proxifly
- list-proxies - List available proxies
- select-proxy - Activate proxy
- proxy-status - Show proxy status$3
-
service-start - Start background service
- service-stop - Stop background service
- service-status - Show all services status
- service-list - List available servicesConfiguration
$3
Create a
.env file in your project root:`env
AI Configuration
OPENAI_API_KEY=your_openai_key_here
ANTHROPIC_API_KEY=your_anthropic_key_hereProxy Configuration
PROXIFLY_API_KEY=your_proxifly_key
PROXY5_USERNAME=your_username
PROXY5_PASSWORD=your_passwordDebug Mode
DEBUG=false
`$3
Configure AI providers interactively:
`bash
security-agent exec ai-setup openai YOUR_API_KEY
or
security-agent exec ai-setup anthropic YOUR_API_KEY
`API Reference
$3
####
initialize()
Initialize and return agent with controller
`javascript
const { agent, controller } = securityAgent.initialize();
`####
executeCommand(command, args)
Execute a single command programmatically
`javascript
await securityAgent.executeCommand('scan-ports', ['localhost', '80,443']);
`####
executeBatch(commands)
Execute multiple commands in batch
`javascript
const results = await securityAgent.executeBatch([
{ command: 'network-info', args: [] },
{ command: 'check-ip', args: [] }
]);
`####
getStatus()
Get agent and module status
`javascript
const status = securityAgent.getStatus();
console.log(status.initialized, status.modules);
`####
getCommands()
Get all available commands
`javascript
const commands = securityAgent.getCommands();
`####
commandExists(command)
Check if a command exists
`javascript
const exists = securityAgent.commandExists('scan-ports');
`####
shutdown()
Shutdown agent and cleanup
`javascript
securityAgent.shutdown();
`Examples
$3
`javascript
const securityAgent = require('security-agent');async function runAudit(target) {
const { agent } = securityAgent.initialize();
console.log('Running security audit...');
const commands = [
{ command: 'scan-ports', args: [target, '1-1000'] },
{ command: 'security-audit', args: [] },
{ command: 'check-deps', args: [] },
{ command: 'scan-deps', args: ['./'] }
];
const results = await securityAgent.executeBatch(commands);
results.forEach(result => {
console.log(
${result.command}: ${result.success ? 'ā' : 'ā'});
});
securityAgent.shutdown();
}runAudit('example.com');
`$3
`javascript
const securityAgent = require('security-agent');async function reviewCode(filePath) {
await securityAgent.executeCommand('ai-setup', ['openai', process.env.OPENAI_API_KEY]);
console.log('Analyzing code with AI...');
await securityAgent.executeCommand('ai-analyze', [filePath]);
console.log('Getting security recommendations...');
await securityAgent.executeCommand('ai-improve', [filePath]);
securityAgent.shutdown();
}
reviewCode('./src/app.js');
`$3
`javascript
const securityAgent = require('security-agent');async function monitorCVEs(packages) {
const { agent } = securityAgent.initialize();
for (const pkg of packages) {
console.log(
Checking ${pkg}...);
await securityAgent.executeCommand('check-package', [pkg]);
}
await securityAgent.executeCommand('export-cve', ['./cve-report.json']);
securityAgent.shutdown();
}monitorCVEs(['express', 'axios', 'lodash']);
`Module Architecture
Security Agent uses a modular architecture:
`
security-agent/
āāā index.js # Main entry point
āāā agent.js # Core agent class
āāā controllers/ # API controllers
ā āāā agentController.js
āāā routes/ # Express routes
ā āāā agent.js
āāā modules/
ā āāā security/ # Security modules
ā āāā ai/ # AI modules
ā āāā code/ # Code analysis
ā āāā network/ # Network tools
ā āāā analyze/ # Analysis tools
ā āāā utils/ # Utilities
āāā bin/
āāā cli.js # CLI interface
`Development
$3
`bash
npm test
npm run test:watch
npm run test:coverage
`$3
`bash
npm run lint
npm run lint:fix
`$3
`bash
npm run docs
`Contributing
Contributions are welcome! Please follow these steps:
1. Fork the repository
2. Create a feature branch (
git checkout -b feature/amazing-feature)
3. Commit your changes (git commit -m 'Add amazing feature')
4. Push to the branch (git push origin feature/amazing-feature`)This project is licensed under the MIT License - see the LICENSE file for details.
- š§ Email: your.email@example.com
- š Issues: GitHub Issues
- š Documentation: Full Docs
This tool is designed for authorized security testing only. Users are responsible for ensuring they have permission to test any systems. Unauthorized access to computer systems is illegal.
- Built with Node.js
- Uses various open-source security tools
- AI integration with OpenAI and Anthropic
---
Made with ā¤ļø for the security community