Commit 20a7bf32 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 08f203bd
......@@ -8,7 +8,7 @@ const server = dgram.createSocket('udp4');
server.on('message', (msg, rinfo) => {
const packet = radius.decode({ packet: msg, secret });
console.log(packet)
if (packet.code !== 'Access-Request') {
console.error('Invalid packet type: ' + packet.code);
return;
......@@ -19,6 +19,11 @@ console.log(packet)
console.log('Received access request from:', username);
const inputOctets = packet.attributes['Acct-Input-Octets'];
const outputOctets = packet.attributes['Acct-Output-Octets'];
console.log('RX:', inputOctets, 'TX:', outputOctets);
// Perform your user authentication logic here
const isAuthenticated = authenticateUser(username, password);
......@@ -52,5 +57,5 @@ server.bind(port);
function authenticateUser(username, password) {
console.log(username,password)
// Replace this function with your actual authentication logic
return username === 'ali2';
return username === 'ali';
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment