Skip to content

Instantly share code, notes, and snippets.

@agix
agix / Knocky.lua
Last active October 28, 2018 13:04
Nginx + redis + lua + authy script to allow access by IP with one touch
-- apt-get install nginx-extras # to get nginx with lua support
-- apt-get install luarocks
-- apt-get install lua-nginx-redis
-- luarocks install lua-requests
-- In your nginx config file add two lua dict outside server definition
--
-- lua_shared_dict ip_whitelist 1m;
-- lua_shared_dict ip_asklist 1m;
-- server {
--
import struct
import re
import telnetlib
def read_until(s, stop):
res = ''
while not res.endswith(stop):
res += s.recv(1)