mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-11 07:46:10 +01:00
some conversion fixes
This commit is contained in:
@@ -59,7 +59,7 @@ class secMiddleware:
|
||||
# final_json = json.dumps(final_dic)
|
||||
# return HttpResponse(final_json)
|
||||
|
||||
if type(value) == str or type(value) == unicode:
|
||||
if type(value) == str or type(value) == bytes:
|
||||
pass
|
||||
else:
|
||||
continue
|
||||
|
||||
@@ -31,7 +31,7 @@ class CyberCPLogFileWriter:
|
||||
def readLastNFiles(numberOfLines,fileName):
|
||||
try:
|
||||
|
||||
lastFewLines = subprocess.check_output(["tail", "-n",str(numberOfLines),fileName])
|
||||
lastFewLines = str(subprocess.check_output(["tail", "-n",str(numberOfLines),fileName]).decode("utf-8"))
|
||||
|
||||
return lastFewLines
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from . import CyberCPLogFileWriter as logging
|
||||
from plogical import CyberCPLogFileWriter as logging
|
||||
import argparse
|
||||
from random import randint
|
||||
|
||||
|
||||
@@ -192,7 +192,6 @@ class ProcessUtilities(multi.Thread):
|
||||
else:
|
||||
command = '%s-u %s %s' % (ProcessUtilities.token, user, command)
|
||||
logging.writeToFile(ProcessUtilities.token + command)
|
||||
command = command.replace('sudo', '')
|
||||
sock.sendall(command.encode('utf-8'))
|
||||
|
||||
data = ""
|
||||
@@ -201,16 +200,10 @@ class ProcessUtilities(multi.Thread):
|
||||
currentData = sock.recv(32)
|
||||
if len(currentData) == 0 or currentData == None:
|
||||
break
|
||||
data = data + currentData
|
||||
data = data + currentData.decode("utf-8")
|
||||
|
||||
sock.close()
|
||||
|
||||
# if user == None:
|
||||
# pass
|
||||
# else:
|
||||
# cmd = 'deluser %s cyberpanel' % (user)
|
||||
# ProcessUtilities.executioner(cmd)
|
||||
|
||||
logging.writeToFile(data)
|
||||
|
||||
return data
|
||||
@@ -243,11 +236,9 @@ class ProcessUtilities(multi.Thread):
|
||||
def outputExecutioner(command, user=None):
|
||||
try:
|
||||
if getpass.getuser() == 'root':
|
||||
return subprocess.check_output(shlex.split(command))
|
||||
return subprocess.check_output(shlex.split(command).decode("utf-8"))
|
||||
|
||||
if type(command) == str or type(command) == unicode:
|
||||
pass
|
||||
else:
|
||||
if type(command) == list:
|
||||
command = " ".join(command)
|
||||
|
||||
return ProcessUtilities.sendCommand(command, user)[:-1]
|
||||
@@ -256,7 +247,7 @@ class ProcessUtilities(multi.Thread):
|
||||
|
||||
def customPoen(self):
|
||||
try:
|
||||
if type(self.extraArgs['command']) == str or type(self.extraArgs['command']) == unicode:
|
||||
if type(self.extraArgs['command']) == str or type(self.extraArgs['command']) == bytes:
|
||||
command = self.extraArgs['command']
|
||||
else:
|
||||
command = " ".join(self.extraArgs['command'])
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from . import CyberCPLogFileWriter as logging
|
||||
from plogical import CyberCPLogFileWriter as logging
|
||||
import argparse
|
||||
|
||||
class serverLogs:
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
import subprocess
|
||||
import shlex
|
||||
|
||||
print (subprocess.check_output(shlex.split('ls -la')).decode("utf-8"))
|
||||
@@ -1,7 +1,7 @@
|
||||
from .CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
from .installUtilities import installUtilities
|
||||
from plogical.CyberCPLogFileWriter import CyberCPLogFileWriter as logging
|
||||
from plogical.installUtilities import installUtilities
|
||||
import argparse
|
||||
from .processUtilities import ProcessUtilities
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from xml.etree import ElementTree
|
||||
|
||||
class tuning:
|
||||
|
||||
@@ -3,21 +3,19 @@ import os
|
||||
import os.path
|
||||
import sys
|
||||
import django
|
||||
PACKAGE_PARENT = '..'
|
||||
SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
|
||||
sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
|
||||
#PACKAGE_PARENT = '..'
|
||||
#SCRIPT_DIR = os.path.dirname(os.path.realpath(os.path.join(os.getcwd(), os.path.expanduser(__file__))))
|
||||
#sys.path.append(os.path.normpath(os.path.join(SCRIPT_DIR, PACKAGE_PARENT)))
|
||||
|
||||
sys.path.append('/usr/local/CyberCP')
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "CyberCP.settings")
|
||||
|
||||
try:
|
||||
django.setup()
|
||||
except:
|
||||
pass
|
||||
django.setup()
|
||||
|
||||
import shutil
|
||||
import argparse
|
||||
from . import installUtilities
|
||||
from . import sslUtilities
|
||||
from plogical import installUtilities
|
||||
from plogical import sslUtilities
|
||||
from os.path import join
|
||||
from os import listdir, rmdir
|
||||
from shutil import move
|
||||
@@ -25,12 +23,12 @@ from multiprocessing import Process
|
||||
import subprocess
|
||||
import shlex
|
||||
from plogical.mailUtilities import mailUtilities
|
||||
from . import CyberCPLogFileWriter as logging
|
||||
from .dnsUtilities import DNS
|
||||
from .vhost import vhost
|
||||
from .applicationInstaller import ApplicationInstaller
|
||||
from .acl import ACLManager
|
||||
from .processUtilities import ProcessUtilities
|
||||
from plogical import CyberCPLogFileWriter as logging
|
||||
from plogical.dnsUtilities import DNS
|
||||
from plogical.vhost import vhost
|
||||
from plogical.applicationInstaller import ApplicationInstaller
|
||||
from plogical.acl import ACLManager
|
||||
from plogical.processUtilities import ProcessUtilities
|
||||
from ApachController.ApacheController import ApacheController
|
||||
from ApachController.ApacheVhosts import ApacheVhost
|
||||
from managePHP.phpManager import PHPManager
|
||||
|
||||
Reference in New Issue
Block a user