Commit e7cd5811 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 1c707645
const socksv5 = require('socksv5')
const shell = require('shelljs')
const cron = require('node-cron');
let authUserList = []
const PORT = 3000
......@@ -14,7 +15,7 @@ server.useAuth(socksv5.auth.UserPassword((username, password, cb) => {
async function isAuthUser(user, pass, cb) {
let cashedUser = isUserFoundInCashe(user, pass)
let cashedUser = isUserFoundInCashe(user, pass)
if (cashedUser) {
console.log("user Found in cashe")
cb(true)
......@@ -40,7 +41,7 @@ async function radius(user, pass) {
}
function isUserFoundInCashe(user, pass) {
function isUserFoundInCashe(user, pass) {
for (let i = 0; i < authUserList.length; i++) {
if (authUserList[i].user === user && authUserList[i].pass === pass)
return true
......@@ -48,3 +49,25 @@ async function radius(user, pass) {
return false
}
cron.schedule('*/1 * * * * *', () => {
// requestPing()
checkUser()
});
// cronAmazon.schedule(' */5 * * * *', () => {
//
// // processScedule()
//
//
// });
async function checkUser() {
for (let i = 0; i < authUserList.length; i++) {
let auth = await radius(authUserList[i].user, authUserList[i].pass)
if (!auth)
authUserList.splice(i, 1)
}
}
let a=' salm Access-Request of id 149 to 54.38.189.114 port 1812'
let arr=[]
arr.push(0)
arr.push(1)
arr.push(2)
arr.push(3)
arr.push(4)
arr.push(5)
arr.splice(3,1)
console.log(a.includes("Access-Request"))
console.log(arr)
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