Employees whose device is connected to the factory WiFi
📡
Loading...
All Registered Devices
Devices registered for employee presence tracking
MAC Address
Device Name
Employee
IP Address
Status
Last Seen
Actions
Loading...
⚙️ Factory Agent Setup — How to connect your factory PC▼
How it works: A small Node.js script runs on any always-on Windows PC in your factory.
Every 30 seconds it reads the router's ARP table (arp -a) — no router admin access needed.
It sends the list of connected MAC addresses to this ERP, which matches them against registered employee devices.
Step 1: Make sure Node.js is installed on the factory PC
(nodejs.org → LTS version). Step 2: Save the script below as wifi-agent.js anywhere on the PC. Step 3: Open Command Prompt and run: node wifi-agent.js Step 4: To keep it running after restart, use Windows Task Scheduler or PM2.
⚠️ The script below has the server URL and token pre-filled. Keep this token secret — anyone with it can spoof WiFi presence data.
// wifi-agent.js — RCPL ERP Factory WiFi Scanner
// Run: node wifi-agent.js
// Requires: Node.js 18+ (fetch is built-in)
const { execSync } = require('child_process');
const SERVER = 'https://rightcorrupack.com';
const TOKEN = 'rcpl-wifi-2026';
function parseArp() {
try {
const out = execSync('arp -a', { timeout: 8000 }).toString();
const devices = [];
for (const line of out.split('\n')) {
// Windows arp -a format: " 192.168.1.5 aa-bb-cc-dd-ee-ff dynamic"
const m = line.match(/(\d{1,3}(?:\.\d{1,3}){3})\s+([\da-fA-F]{2}[-:][\da-fA-F]{2}[-:][\da-fA-F]{2}[-:][\da-fA-F]{2}[-:][\da-fA-F]{2}[-:][\da-fA-F]{2})/);
if (!m) continue;
const mac = m[2].replace(/-/g, ':').toLowerCase();
if (mac === 'ff:ff:ff:ff:ff:ff') continue; // skip broadcast
devices.push({ ip: m[1], mac });
}
return devices;
} catch (e) {
console.error('arp error:', e.message);
return [];
}
}
async function sendScan() {
const devices = parseArp();
try {
const r = await fetch(SERVER + '/api/wifi/scan', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Wifi-Token': TOKEN
},
body: JSON.stringify({ devices, scanned_at: new Date().toISOString() })
});
const d = await r.json();
const t = new Date().toLocaleTimeString();
console.log(`[${t}] Scanned ${d.total} devices — ${d.matched} employees matched, ${d.unknown} unknown`);
} catch (e) {
console.error('[scan error]', e.message);
}
}
console.log('RCPL WiFi Agent started — scanning every 30s...');
sendScan();
setInterval(sendScan, 30000);