29 lines
1.2 KiB
JavaScript
29 lines
1.2 KiB
JavaScript
const axios = require('axios');
|
|
const BASE_URL = 'https://api0.dev.backone.cloud/api/v1';
|
|
const { backoneFetch } = require('./proxy/backoneClientCore');
|
|
|
|
async function test() {
|
|
const agentUuid = 'F6-2V-DT-8A';
|
|
console.log(`Fetching flows for Agent UUID: ${agentUuid}...`);
|
|
|
|
const flows = await backoneFetch('/data/flows', { settings_limit: 200 }, agentUuid);
|
|
const ips = flows ? flows.map(f => f.local_ip?.address).filter(Boolean) : [];
|
|
|
|
const ips10_6 = ips.filter(ip => ip.startsWith('10.6'));
|
|
const ips192 = ips.filter(ip => ip.startsWith('192.168'));
|
|
const ips10_1 = ips.filter(ip => ip.startsWith('10.1.'));
|
|
|
|
console.log('\n--- Hasil Test untuk Agen', agentUuid, '---');
|
|
console.log(`Total IPs didapat: ${ips.length}`);
|
|
console.log(`Jumlah IP Balaraja (10.6.x.x): ${ips10_6.length}`);
|
|
if (ips10_6.length > 0) console.log('Contoh 10.6.x.x:', ips10_6.slice(0, 5));
|
|
|
|
console.log(`\nJumlah IP Kantor/Lainnya (192.168.x.x): ${ips192.length}`);
|
|
if (ips192.length > 0) console.log('Contoh 192.168.x.x:', ips192.slice(0, 5));
|
|
|
|
console.log(`\nJumlah IP Lainnya (10.1.x.x): ${ips10_1.length}`);
|
|
if (ips10_1.length > 0) console.log('Contoh 10.1.x.x:', ips10_1.slice(0, 5));
|
|
}
|
|
|
|
test();
|