mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-12 16:26:12 +01:00
further refoctor default render terminal
This commit is contained in:
@@ -18,38 +18,32 @@ import plogical.randomPassword
|
|||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
def terminal(request):
|
def terminal(request):
|
||||||
try:
|
password = plogical.randomPassword.generate_pass()
|
||||||
|
|
||||||
password = plogical.randomPassword.generate_pass()
|
verifyPath = "/home/cyberpanel/" + str(randint(100000, 999999))
|
||||||
|
writeToFile = open(verifyPath, 'w')
|
||||||
|
writeToFile.write(password)
|
||||||
|
writeToFile.close()
|
||||||
|
|
||||||
verifyPath = "/home/cyberpanel/" + str(randint(100000, 999999))
|
## setting up ssh server
|
||||||
writeToFile = open(verifyPath, 'w')
|
path = '/etc/systemd/system/cpssh.service'
|
||||||
writeToFile.write(password)
|
curPath = '/usr/local/CyberCP/WebTerminal/cpssh.service'
|
||||||
writeToFile.close()
|
|
||||||
|
|
||||||
## setting up ssh server
|
if not os.path.exists(path):
|
||||||
path = '/etc/systemd/system/cpssh.service'
|
command = 'mv %s %s' % (curPath, path)
|
||||||
curPath = '/usr/local/CyberCP/WebTerminal/cpssh.service'
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
if not os.path.exists(path):
|
command = 'systemctl start cpssh'
|
||||||
command = 'mv %s %s' % (curPath, path)
|
ProcessUtilities.executioner(command)
|
||||||
ProcessUtilities.executioner(command)
|
|
||||||
|
|
||||||
command = 'systemctl start cpssh'
|
FirewallUtilities.addRule('tcp', '5678', '0.0.0.0/0')
|
||||||
ProcessUtilities.executioner(command)
|
|
||||||
|
|
||||||
FirewallUtilities.addRule('tcp', '5678', '0.0.0.0/0')
|
newFWRule = FirewallRules(name='terminal', proto='tcp', port='5678', ipAddress='0.0.0.0/0')
|
||||||
|
newFWRule.save()
|
||||||
|
|
||||||
newFWRule = FirewallRules(name='terminal', proto='tcp', port='5678', ipAddress='0.0.0.0/0')
|
proc = httpProc(request, 'WebTerminal/WebTerminal.html',
|
||||||
newFWRule.save()
|
{'verifyPath': verifyPath, 'password': password})
|
||||||
|
return proc.render()
|
||||||
proc = httpProc(request, 'WebTerminal/WebTerminal.html',
|
|
||||||
{'verifyPath': verifyPath, 'password': password})
|
|
||||||
return proc.render()
|
|
||||||
|
|
||||||
except BaseException as msg:
|
|
||||||
logging.writeToFile(str(msg))
|
|
||||||
return redirect(loadLoginPage)
|
|
||||||
|
|
||||||
def restart(request):
|
def restart(request):
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user