-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbotnet_verify_otp.lua
executable file
·30 lines (24 loc) · 1.05 KB
/
botnet_verify_otp.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
local OTP = require 'otp'
local TOTP = require 'totp'
local basexx = require 'basexx'
local rot13 = require 'rot13'
core.register_fetches("botnet_verify_otp", function(txn, cookie, alreadyauth, useragent)
local cookie = txn:get_var(cookie)
local alreadyauth = txn:get_var(alreadyauth)
local useragent = txn:get_var(useragent)
local clientip = txn.f:src()
if alreadyauth ~= nil and alreadyauth == 1 then return true end
if cookie == nil then return false end
if useragent ~= nil then useragent = "sdfocOSdfjiojicvisdinvc" end
local status, cookiedecode = pcall(rot13.decipher,cookie);
if status == false then return false end
local randomkey = "dxcKfdojsdfxvcOsdfvc"
local INTERVAL = 15;
local DIGITS = 10;
local BASE32_SECRET = basexx.to_base32( clientip..randomkey..useragent )
local DIGEST = "SHA1";
OTP.type = "totp"
local tdata = OTP.new(BASE32_SECRET, DIGITS, DIGEST, 30)
local tv1 = TOTP.verify(tdata, cookiedecode, os.time(), 0)
return tv1
end)