twpt-cli
Version:
ThreatWinds Pentest CLI - Container-based pentesting toolkit
40 lines (33 loc) • 1.4 kB
JavaScript
const fs = require('fs');
const path = require('path');
const BINARY_NAME = 'twpt-cli';
// Check if running on Linux
if (process.platform !== 'linux') {
console.error(`❌ twpt-cli is only supported on Linux systems`);
console.error(` Your platform: ${process.platform}`);
console.error(` Please use a Linux system to install and run twpt-cli`);
process.exit(1);
}
function getLinuxArch() {
const arch = process.arch;
if (arch === 'x64') return 'linux-amd64';
if (arch === 'arm64') return 'linux-arm64';
throw new Error(`Unsupported Linux architecture: ${arch}. Only x64 and arm64 are supported.`);
}
const platform = getLinuxArch();
const sourcePath = path.join(__dirname, 'dist', `${BINARY_NAME}-${platform}`);
const targetPath = path.join(__dirname, BINARY_NAME);
if (fs.existsSync(sourcePath)) {
fs.copyFileSync(sourcePath, targetPath);
fs.chmodSync(targetPath, 0o755);
console.log(`✅ ${BINARY_NAME} binary installed for ${platform}`);
console.log('');
console.log('📋 Next steps:');
console.log(' 1. Run "twpt-cli install" to complete the setup');
console.log(' 2. Docker will be installed automatically if needed');
console.log(' 3. The Threatwinds Pentest container will be configured and started');
} else {
console.error(`❌ Binary not found for ${platform}`);
console.error(` Expected file: ${sourcePath}`);
process.exit(1);
}