From aa034382805b8e99a7d4f79be2d16d8ef1053cde Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Fri, 30 Mar 2018 01:51:20 +1100 Subject: [PATCH] Added proper wandows support --- config.json | 1 + libs/config.py | 5 +++-- libs/config.pyc | Bin 525 -> 583 bytes main.py | 28 +++++++++++++++++++--------- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/config.json b/config.json index 057e9c9..089fcf8 100644 --- a/config.json +++ b/config.json @@ -5,5 +5,6 @@ "colour_good":"green", "colour_pretty":"cyan", "colour_default":"reset", + "colour_none":"", "country_codes":"codes.csv" } diff --git a/libs/config.py b/libs/config.py index 9b0820d..886d42b 100644 --- a/libs/config.py +++ b/libs/config.py @@ -1,9 +1,10 @@ import files as f import json +import os -def readConf(): +def readConf(fileLoc): try: - jsonData = json.loads(f.openFile("config.json").read()) + jsonData = json.loads(f.openFile(os.path.expanduser(fileLoc)).read()) except Exception as e: print e jasonData = "" diff --git a/libs/config.pyc b/libs/config.pyc index 40e9332b010ed4716322133179aebdbc6dbd3edf..df88d28014c9a94887299b3822fd052efb051644 100644 GIT binary patch delta 317 zcmXX>u};G<5PfGmEm$ouB8oak43!wzkr-e=8PWlitxAHZsnV);C6E#^l$9asXY?1? z;dc-#65Juqe$UU(r}N#bc{c<7)wiqfw=BnhC_c{_{H&0Nlq*cBVt@I{Fv!!ga9}~P;eT-z(sH!)WDi#yDrv$x*^1K)l<2oDAhY_gouTOu~JzEXv2lq$*avT(+Nw2l5oUOn1{+ uc|FfJeX7o+QQu<%X&TW!MPw-!Hwa0pPi4SVMoYy@_cmL~Y=>o!c&T5w;x>o? delta 291 zcmXX=Jxjw-6g}tVMQThDTq6zzAvlPmV^K<-I@H0^tt6==%8T^9p+bX0T^&k(g0sKF z)&JrT(ECC!ob%4T@7#}X{h^cKw;z42Kj#_tq2wJ3?D;M^eN%V`<^gizJ`JQ?{z*(a zw@*XCt#^-wUI%bMML313>)8^O#ugCK01xI2+J$(Eu(|;of*WFdmn$?1hL~-z-!rjC zGVvs<&9Z#FtZZ#$G>{(bel8L%YE>+9cPL`C&WaaT)~36!9nxI;e;W&d0S7#0$cU-0 f%5q>?J{NZC&!5s$B$Nu!E;wqhRKMq~F=O=)Bgin< diff --git a/main.py b/main.py index dc49551..7d0a5fd 100755 --- a/main.py +++ b/main.py @@ -1,10 +1,11 @@ #!/usr/bin/python2.7 import whois -import readline import signal import dns.resolver import json import warnings +import os +import platform from dns import reversename from ipwhois.net import Net from ipwhois.asn import IPASN @@ -13,15 +14,8 @@ from libs import config from libs import colours as gc from libs import cc -running = 1 -prompt = ': ' -indent = '~ ' -whoisrecs = ["NotFound", "DomainName", "Registrar", "Status", "UpdatedDate", "CreationDate", "ExpirationDate", "RegistrantName", "RegistrantEmail", "EligibilityName", "EligibilityType", "EligibilityID", "RegistrantID", "NameServer"] -#ipData = ["asn_country_code", "asn_description"] -ipData = {"asn_country_code":"Country", "asn_description":"Owner"} - # Loaded from the config file -jsonData = config.readConf() +jsonData = config.readConf("~/config.json") subdomains = jsonData["subdomains"] dnsrecords = jsonData["dnsrecords"] @@ -32,6 +26,22 @@ colour_default = gc.getColour(jsonData["colour_default"]) CSVFile = jsonData["country_codes"] # Endconfig block +if platform.system().lower() == "linux": + import readline +else: + #do windows stuff here + colour_attn = "" + colour_good = "" + colour_pretty = "" + colour_default = "" + +running = 1 +prompt = ': ' +indent = '~ ' +whoisrecs = ["NotFound", "DomainName", "Registrar", "Status", "UpdatedDate", "CreationDate", "ExpirationDate", "RegistrantName", "RegistrantEmail", "EligibilityName", "EligibilityType", "EligibilityID", "RegistrantID", "NameServer"] +#ipData = ["asn_country_code", "asn_description"] +ipData = {"asn_country_code":"Country", "asn_description":"Owner"} + CountryDict = cc.parseCSV(cc.openCSV(CSVFile)) def domainWhois(inData):