Add support for a configurable whois server

This commit is contained in:
Baptiste Jonglez 2014-01-27 22:13:23 +01:00
parent 6b7dfbb7a9
commit ca7eb2b9ac
2 changed files with 6 additions and 1 deletions

2
lg.cfg
View File

@ -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'

5
lg.py
View File

@ -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):