chore: super deep scanning cleanup - remove obsolete debug files and legacy sqlite db files

This commit is contained in:
rafif committed 2026-07-31 10:40:31 +07:00
1 parent 8cfa5bc198
commit 8e58db970f
8 files changed
-149

No files matched your search

-3
View File
@@ -1,3 +0,0 @@
const db = require('better-sqlite3')('backend/netify_data.db');
console.log('Devices:', db.prepare("SELECT * FROM devices WHERE ip_address = '192.168.9.2'").all());
console.log('Discovery:', db.prepare("SELECT * FROM intel_device_discovery WHERE ip_address = '192.168.9.2'").all());
-22
View File
@@ -1,22 +0,0 @@
const mongoose = require('mongoose');
require('dotenv').config({path: '../.env.local'});
mongoose.connect(process.env.MONGODB_URI).then(async () => {
const db = mongoose.connection;
const highEvents = await db.collection('events').find({
$or: [
{severity: {$in: ['Critical', 'High']}},
{category_label: 'Cybersecurity'}
]
}).toArray();
if (highEvents.length > 0) {
console.log("High Events timestamps:");
highEvents.forEach(e => {
console.log("- event_at:", e.event_at, " | timestamp:", e.timestamp);
});
} else {
console.log("No high events found in array");
}
process.exit(0);
}).catch(e => console.error(e));
-45
View File
@@ -1,45 +0,0 @@
const mongoose = require('mongoose');
const mongoUri = process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/backone_dpi';
mongoose.connect(mongoUri)
.then(async () => {
const db = mongoose.connection.useDb('backone_dpi');
const yesterday = new Date(Date.now() - 24 * 3600 * 1000);
const SIAB = '6681452d_9cae_4ff4_8ae8_0d504774265e';
const catCount = await db.db.collection('appcategorystats').countDocuments({ site_uuid: SIAB, timestamp: { $gte: yesterday } });
const catSum = await db.db.collection('appcategorystats').aggregate([
{ $match: { site_uuid: SIAB, timestamp: { $gte: yesterday } } },
{ $group: { _id: null, dl: { $sum: '$download' }, ul: { $sum: '$upload' } } }
]).toArray();
const sumCount = await db.db.collection('summaries').countDocuments({ site_uuid: SIAB, timestamp: { $gte: yesterday } });
const sumSum = await db.db.collection('summaries').aggregate([
{ $match: { site_uuid: SIAB, timestamp: { $gte: yesterday } } },
{ $group: { _id: null, dl: { $sum: '$bandwidth_down' }, ul: { $sum: '$bandwidth_up' } } }
]).toArray();
const flowCount = await db.db.collection('flows').countDocuments({ site_uuid: SIAB, timestamp: { $gte: yesterday } });
const flowSum = await db.db.collection('flows').aggregate([
{ $match: { site_uuid: SIAB, timestamp: { $gte: yesterday } } },
{ $group: { _id: null, dl: { $sum: '$download' }, ul: { $sum: '$upload' } } }
]).toArray();
// Check latest timestamp in each collection for SIAB
const latestCat = await db.db.collection('appcategorystats').findOne({ site_uuid: SIAB }, { sort: { timestamp: -1 } });
const latestFlow = await db.db.collection('flows').findOne({ site_uuid: SIAB }, { sort: { timestamp: -1 } });
const latestSum = await db.db.collection('summaries').findOne({ site_uuid: SIAB }, { sort: { timestamp: -1 } });
console.log('=== SIAB Site Data Check (Last 24h) ===');
console.log('AppCatStats (24h):', catCount, 'docs | Sum:', JSON.stringify(catSum[0]));
console.log('Summaries (24h) :', sumCount, 'docs | Sum:', JSON.stringify(sumSum[0]));
console.log('Flows (24h) :', flowCount, 'docs | Sum:', JSON.stringify(flowSum[0]));
console.log('');
console.log('=== Latest Timestamps ===');
console.log('Latest AppCat :', latestCat?.timestamp);
console.log('Latest Flow :', latestFlow?.timestamp);
console.log('Latest Summary :', latestSum?.timestamp);
mongoose.disconnect();
})
.catch(e => { console.error('Error:', e.message); process.exit(1); });
-31
View File
@@ -1,31 +0,0 @@
const { Client } = require('ssh2');
const conn = new Client();
conn.on('ready', () => {
const cmd = [
'export PM2=/home/adminbackend/.npm-global/bin/pm2',
'$PM2 list',
'echo "=== MEMORY ==="',
'free -m',
'echo "=== DISK ==="',
'df -h /',
'echo "=== FRONTEND LOGS ==="',
'$PM2 logs backone-frontend --lines 20 --nostream 2>&1',
'echo "=== BACKEND LOGS ==="',
'$PM2 logs backone-backend --lines 10 --nostream 2>&1',
].join(' && ');
conn.exec(cmd, (err, stream) => {
if (err) { console.error(err); conn.end(); return; }
stream.on('data', d => process.stdout.write(d.toString()));
stream.stderr.on('data', d => process.stderr.write(d.toString()));
stream.on('close', () => conn.end());
});
}).connect({
host: '103.185.47.52',
port: 2222,
username: 'adminbackend',
password: 'htEo7x6LsBQiEHHH',
});
conn.on('error', e => console.error('SSH Error:', e.message));
-15
View File
@@ -1,15 +0,0 @@
const mongoose = require('mongoose');
require('dotenv').config({path: '../.env.local'});
mongoose.connect(process.env.MONGODB_URI).then(async () => {
const db = mongoose.connection;
const threats = await db.collection('threats').countDocuments();
const events = await db.collection('events').countDocuments();
const highEvents = await db.collection('events').countDocuments({
$or: [
{severity: {$in: ['Critical', 'High']}},
{category_label: 'Cybersecurity'}
]
});
console.log({threats, events, highEvents});
process.exit(0);
}).catch(e => console.error(e));
-10
View File
@@ -1,10 +0,0 @@
const mongoose = require('mongoose');
require('dotenv').config({path: '../.env.local'});
mongoose.connect(process.env.MONGODB_URI).then(async () => {
const db = mongoose.connection;
const threats = await db.collection('threats').aggregate([{ $group: { _id: '$threat_type', count: { $sum: 1 } } }]).toArray();
console.log('Threat types:', threats);
const events = await db.collection('events').aggregate([{ $group: { _id: '$event_type', count: { $sum: 1 } } }]).toArray();
console.log('Event types:', events);
process.exit(0);
});
-14
View File
@@ -1,14 +0,0 @@
const http = require('http');
http.get('http://localhost:3001/api/dashboard/tls-versions', {
headers: {
'Cookie': 'token=test', // Just checking schema, if it requires auth we might need to mock or use the proxy
}
}, (res) => {
let data = '';
res.on('data', chunk => data += chunk);
res.on('end', () => {
console.log("Response TLS Versions:");
console.log(data.slice(0, 500));
});
});
-9
View File
@@ -1,9 +0,0 @@
"use client";
/**
* ViewportScaler - DEPRECATED / REMOVED.
* Layout responsiveness now relies 100% on native CSS Tailwind media queries.
*/
export function ViewportScaler() {
return null;
}