From 829c8c8b597bca0e8a60f78bc501820c848cb93e Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Mon, 3 Feb 2020 17:30:24 +0500 Subject: [PATCH] make access log fetch compatible with Michael commit --- plogical/virtualHostUtilities.py | 8 ++++---- .../templates/websiteFunctions/launchChild.html | 2 +- .../templates/websiteFunctions/website.html | 2 +- websiteFunctions/website.py | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/plogical/virtualHostUtilities.py b/plogical/virtualHostUtilities.py index 4863db5dd..4bba0b57a 100755 --- a/plogical/virtualHostUtilities.py +++ b/plogical/virtualHostUtilities.py @@ -297,10 +297,10 @@ class virtualHostUtilities: print("0, %s file is symlinked." % (fileName)) return 0 - numberOfTotalLines = int(ProcessUtilities.outputExecutioner('wc -l %s' % (fileName), externalApp).split(" ")[0]) + numberOfTotalLines = int(ProcessUtilities.outputExecutioner('wc -l %s' % (fileName), 'nobody').split(" ")[0]) if numberOfTotalLines < 25: - data = ProcessUtilities.outputExecutioner('cat %s' % (fileName), externalApp) + data = ProcessUtilities.outputExecutioner('cat %s' % (fileName), 'nobody') else: if page == 1: end = numberOfTotalLines @@ -309,7 +309,7 @@ class virtualHostUtilities: start = 1 startingAndEnding = "'" + str(start) + "," + str(end) + "p'" command = "sed -n " + startingAndEnding + " " + fileName - data = ProcessUtilities.outputExecutioner(command, externalApp) + data = ProcessUtilities.outputExecutioner(command, 'nobody') else: end = numberOfTotalLines - ((page - 1) * 25) start = end - 24 @@ -317,7 +317,7 @@ class virtualHostUtilities: start = 1 startingAndEnding = "'" + str(start) + "," + str(end) + "p'" command = "sed -n " + startingAndEnding + " " + fileName - data = ProcessUtilities.outputExecutioner(command, externalApp) + data = ProcessUtilities.outputExecutioner(command, 'nobody') print(data) return data except BaseException as msg: diff --git a/websiteFunctions/templates/websiteFunctions/launchChild.html b/websiteFunctions/templates/websiteFunctions/launchChild.html index b6f2ff99b..301131680 100755 --- a/websiteFunctions/templates/websiteFunctions/launchChild.html +++ b/websiteFunctions/templates/websiteFunctions/launchChild.html @@ -194,7 +194,7 @@ - + diff --git a/websiteFunctions/templates/websiteFunctions/website.html b/websiteFunctions/templates/websiteFunctions/website.html index 7cfdb0164..c54555cc4 100755 --- a/websiteFunctions/templates/websiteFunctions/website.html +++ b/websiteFunctions/templates/websiteFunctions/website.html @@ -176,7 +176,7 @@
DomainType IP Address Time Resource
- + diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 20ce290b1..84886109a 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -1004,7 +1004,7 @@ class WebsiteManager: if output.find("1,None") > -1: final_json = json.dumps( - {'status': 0, 'logstatus': 0, 'error_message': "Not able to fetch logs, see CyberPanel main log file!"}) + {'status': 0, 'logstatus': 0, 'error_message': "Not able to fetch logs, see CyberPanel main log file, Error: %s" % (output)}) return HttpResponse(final_json) ## get log ends here. @@ -1017,11 +1017,11 @@ class WebsiteManager: for items in reversed(data): if len(items) > 10: logData = items.split(" ") - domain = logData[0].strip('"') - ipAddress = logData[1] - time = (logData[4]).strip("[").strip("]") - resource = logData[7].strip('"') - size = logData[10].replace('"', '') + domain = logData[5].strip('"') + ipAddress = logData[0].strip('"') + time = (logData[3]).strip("[").strip("]") + resource = logData[6].strip('"') + size = logData[9].replace('"', '') dic = {'domain': domain, 'ipAddress': ipAddress,
DomainType IP Address Time Resource