From ca7eb2b9acc3ccf3105672b919def704d43810cf Mon Sep 17 00:00:00 2001 From: Baptiste Jonglez Date: Mon, 27 Jan 2014 22:13:23 +0100 Subject: [PATCH] Add support for a configurable whois server --- lg.cfg | 2 ++ lg.py | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lg.cfg b/lg.cfg index 29678b4..9211d03 100644 --- a/lg.cfg +++ b/lg.cfg @@ -21,4 +21,6 @@ AS_NUMBER = { "h3" : "197422" } +#WHOIS_SERVER = "whois.foo.bar" + SESSION_KEY = '\xd77\xf9\xfa\xc2\xb5\xcd\x85)`+H\x9d\xeeW\\%\xbe/\xbaT\x89\xe8\xa7' diff --git a/lg.py b/lg.py index a0fcc35..7d409d7 100644 --- a/lg.py +++ b/lg.py @@ -96,7 +96,10 @@ def set_session(request_type, hosts, proto, request_args): def whois_command(query): - return subprocess.Popen(['whois', query], stdout=subprocess.PIPE).communicate()[0].decode('utf-8', 'ignore') + server = [] + if app.config.get("WHOIS_SERVER", ""): + server = [ "-h", app.config.get("WHOIS_SERVER") ] + return subprocess.Popen(['whois'] + server + [query], stdout=subprocess.PIPE).communicate()[0].decode('utf-8', 'ignore') def bird_command(host, proto, query):