Commit e7cd5811 authored by Ahmad Nemati's avatar Ahmad Nemati

init

parent 1c707645
const socksv5 = require('socksv5') const socksv5 = require('socksv5')
const shell = require('shelljs') const shell = require('shelljs')
const cron = require('node-cron');
let authUserList = [] let authUserList = []
const PORT = 3000 const PORT = 3000
...@@ -40,7 +41,7 @@ async function radius(user, pass) { ...@@ -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++) { for (let i = 0; i < authUserList.length; i++) {
if (authUserList[i].user === user && authUserList[i].pass === pass) if (authUserList[i].user === user && authUserList[i].pass === pass)
return true return true
...@@ -48,3 +49,25 @@ async function radius(user, pass) { ...@@ -48,3 +49,25 @@ async function radius(user, pass) {
return false 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)
}
}
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
"hashmap": "^2.3.0", "hashmap": "^2.3.0",
"http-errors": "~1.6.2", "http-errors": "~1.6.2",
"morgan": "~1.9.0", "morgan": "~1.9.0",
"node-cron": "^2.0.3",
"pug": "2.0.0-beta11", "pug": "2.0.0-beta11",
"shelljs": "^0.8.3", "shelljs": "^0.8.3",
"socksv5": "0.0.6" "socksv5": "0.0.6"
......
let a=' salm Access-Request of id 149 to 54.38.189.114 port 1812' 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