Installation Guide¶
Get TrojanHorse.js up and running in your environment.
System Requirements¶
Node.js Environment¶
- Node.js: 16.0.0 or higher
- NPM: 7.0.0 or higher (or Yarn 1.22.0+)
- Operating System: Windows, macOS, Linux
- Memory: Minimum 512MB RAM, 2GB recommended
- Storage: 100MB available space
Browser Environment¶
- Modern Browsers: Chrome 90+, Firefox 88+, Safari 14+, Edge 90+
- ES6 Support: Required for ES module builds
- Web Crypto API: Required for security features
- CORS Support: Required for threat feed access
Installation Methods¶
NPM Installation¶
Standard Installation¶
Global CLI Installation¶
CDN Installation¶
unpkg CDN¶
<!-- Latest version -->
<script src="https://unpkg.com/trojanhorse-js@latest/dist/trojanhorse.browser.min.js"></script>
<!-- Specific version -->
<script src="https://unpkg.com/trojanhorse-js@1.0.0/dist/trojanhorse.browser.min.js"></script>
jsDelivr CDN¶
<!-- Latest version -->
<script src="https://cdn.jsdelivr.net/npm/trojanhorse-js@latest/dist/trojanhorse.browser.min.js"></script>
<!-- ES Modules -->
<script type="module">
import { TrojanHorse } from 'https://cdn.jsdelivr.net/npm/trojanhorse-js@latest/dist/trojanhorse.browser.esm.js';
</script>
Docker Installation¶
Pull Official Image¶
# Pull from Docker Hub
docker pull sc4rfurry/trojanhorse-js:latest
# Or from GitHub Container Registry
docker pull ghcr.io/sc4rfurry/trojanhorse-js:latest
Run Container¶
# Basic container run
docker run -p 3000:3000 sc4rfurry/trojanhorse-js:latest
# With environment variables
docker run -p 3000:3000 \
-e ALIENVAULT_API_KEY=your-key \
-e ABUSEIPDB_API_KEY=your-key \
sc4rfurry/trojanhorse-js:latest
From Source¶
# Clone repository
git clone https://github.com/sc4rfurry/TrojanHorse.js.git
cd TrojanHorse.js
# Install dependencies
npm install
# Build project
npm run build:all
# Run tests
npm test
Package Formats¶
TrojanHorse.js is distributed in multiple formats:
| Format | File | Use Case |
|---|---|---|
| CommonJS | dist/trojanhorse.js | Node.js applications |
| ES Modules | dist/trojanhorse.esm.js | Modern bundlers (Webpack, Rollup) |
| UMD | dist/trojanhorse.umd.js | Universal module definition |
| Browser (Minified) | dist/trojanhorse.browser.min.js | CDN, static sites |
| Browser (ES Modules) | dist/trojanhorse.browser.esm.js | Modern browsers |
| Browser (IIFE) | dist/trojanhorse.browser.iife.js | Legacy browser support |
| TypeScript | dist/types/ | Type definitions |
Environment Setup¶
API Keys Configuration¶
- Get API Keys from threat intelligence providers:
- AlienVault OTX
- AbuseIPDB
- VirusTotal
-
Create Configuration File:
-
Environment Variables (Recommended):
Interactive Setup¶
Verification¶
Node.js Verification¶
// test-installation.js
import { TrojanHorse } from 'trojanhorse-js';
const trojan = new TrojanHorse({
sources: ['urlhaus'] // Free source, no API key needed
});
// Test basic functionality
trojan.scout('example.com').then(threats => {
console.log('✅ Installation successful!');
console.log(`Found ${threats.length} threats`);
}).catch(error => {
console.error('❌ Installation issue:', error.message);
});
Browser Verification¶
<!DOCTYPE html>
<html>
<head>
<title>TrojanHorse.js Test</title>
</head>
<body>
<h1>TrojanHorse.js Installation Test</h1>
<div id="result">Testing...</div>
<script src="https://unpkg.com/trojanhorse-js@latest/dist/trojanhorse.browser.min.js"></script>
<script>
const trojan = new TrojanHorse({ sources: ['urlhaus'] });
trojan.scout('example.com').then(threats => {
document.getElementById('result').innerHTML =
`✅ Installation successful! Found ${threats.length} threats`;
}).catch(error => {
document.getElementById('result').innerHTML =
`❌ Installation issue: ${error.message}`;
});
</script>
</body>
</html>
Docker Verification¶
Troubleshooting¶
Common Installation Issues¶
Node.js Version Issues¶
NPM Permission Issues¶
# Fix NPM permissions (macOS/Linux)
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
# Or use NPM's permission fix
npm config set prefix ~/.npm-global
export PATH=~/.npm-global/bin:$PATH
Network/Proxy Issues¶
# Configure NPM proxy
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
# Clear NPM cache
npm cache clean --force
TypeScript Issues¶
# Install TypeScript globally
npm install -g typescript
# Or add to project
npm install --save-dev typescript @types/node
Build Issues¶
Missing Dependencies¶
Build Tool Issues¶
# Update build tools
npm update rollup jest eslint
# Or reinstall build dependencies
npm install --only=dev
Runtime Issues¶
API Key Problems¶
- Verify API keys are valid and not expired
- Check API rate limits and quotas
- Ensure environment variables are properly set
Network Connectivity¶
- Test internet connection
- Check firewall settings
- Verify DNS resolution for threat feed URLs
Memory Issues¶
# Increase Node.js memory limit
node --max-old-space-size=4096 your-script.js
# Or set environment variable
export NODE_OPTIONS="--max-old-space-size=4096"
Getting Help¶
If installation issues persist:
- Check System Requirements: Ensure you meet minimum requirements
- Clear NPM Cache:
npm cache clean --force - Update Dependencies:
npm update - Check GitHub Issues: Known Issues
- Community Support: Discord Server
Next Steps¶
After successful installation:
- 📖 Quick Start Guide - Get up and running in minutes
- ⚙️ Configuration - Customize for your needs
- 🏗️ Architecture - Understand the system design
- 🚀 Deployment - Deploy to production
Ready to protect your digital fortress? Continue to the Quick Start Guide to begin threat hunting!