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