from run import app, sql, url from flask import request, render_template import json from lib.writeRes import writeResTask from config.config import visitDay import platform, datetime, psutil, re, requests import socket from .login import cklogin url.append({"title": "控制面板", "href": "#"}) NAThost = '未获取' netIP = '未获取' PCname = socket.gethostname() try: ipContent = requests.get('http://pv.sohu.com/cityjson?ie=utf-8').text ipContentJson = json.loads('{' + re.findall(r'{(.+?)}', ipContent)[0] + "}") netIP = ipContentJson.get('cip') except: pass try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(('8.8.8.8', 80)) NAThost = s.getsockname()[0] except: pass finally: s.close() ResTask = writeResTask() visitDay = visitDay
from flask import request, render_template, redirect, send_file, send_from_directory, url_for, session, make_response import time from run import app, url import json import os import time, random from lib.task import taskset from .login import cklogin url.append({ "title": "计划任务", "href": "/Task", }) task = taskset() @app.route('/Task', methods=['GET', 'POST']) @cklogin() def TaskHome(): return render_template('Task.html') @app.route('/CreatTask', methods=['POST']) @cklogin() def CreatTask(): data = request.values.to_dict() if data['type'] == 'week': if data['week'] == '7': data['week'] = '0' elif data['type'] == 'month': if data['day'][0] == '0': data['day'] = data['day'][1:]
import paramiko import threading import time, random, json from flask import request, redirect, render_template from run import app, sql, url from .login import cklogin url.append({ "title": "SHELL", "children": [{ "title": "web shell", "href": "/ssh" }, { "title": "批量主机", "href": "/BatchExec" }] }) sshListDict = {} sshTimeout = {} def checkSSH(): t = [] for k, v in sshTimeout.items(): if time.time() > (v + 180): t.append(k) for i in t: sshListDict[i].close() del sshListDict[i] del sshTimeout[i]
from flask import request, render_template, redirect, send_file, send_from_directory, url_for, session, make_response import time from run import app, url import json import os from PIL import Image import zipfile import base64 import chardet import shutil import traceback from lib import extract from config.config import workPath from .login import cklogin url.append({"title": "文件管理器", "href": "/file"}) sep = os.path.sep #当前系统分隔符 @app.route('/file', methods=['GET', 'POST']) @cklogin() def file(): return render_template('file.html', nowPath=b64encode_(workPath), sep=b64encode_(sep), workPath=b64encode_(workPath)) #返回文件目录 @app.route('/GetFile', methods=['POST']) @cklogin() def GetFile():
from flask import request, render_template, redirect, url_for, session import time from run import app, sql, url import json import os import base64 import traceback from .login import cklogin url.append({ "title": "快捷操作", "children": [ { "title": "快捷按钮", "href": "/linkButton" }, { "title": "快捷文件", "href": "/linkFile" }, ] }) @app.route('/linkButton', methods=['GET', 'POST']) def linkButton(): if request.method == 'GET': #返回HTML网页 return render_template('linkButton.html') else: #返回按钮数据
from flask import request, render_template, redirect, url_for, session, Response from run import app, url import base64, platform, os, time, json, subprocess from .login import cklogin SYSTEMDEB = None if 'LINUX' in platform.platform().upper(): SYSTEMDEB = True if SYSTEMDEB: url.append({ "title": "软件管理", "children": [{ "title": "nginx", "href": "/plugins/nginx" }, { "title": "mysql", "href": "/plugins/mysql" }] }) #---------------------------nginx------------------------------------------------# NGINXSTATUS = None @app.route('/plugins/nginx', methods=['GET', 'POST']) @cklogin() def pluginsNginx(): global NGINXSTATUS if request.method == 'GET': if not NGINXSTATUS: status = subprocess.Popen('whereis nginx',
import platform if 'WINDOWS' in platform.platform().upper(): from flask import render_template, Response,request import time import math import json,subprocess from run import app,url from .login import cklogin from PIL import ImageGrab,Image import pyautogui url.append({'title': 'Windows远程', 'href': '/control/windows'}) RATE = 2 @app.route('/control/windows') @cklogin() def controlWindows(): return render_template('controlWin.html') def getScreen(): while True: time.sleep(0.08) try: img = ImageGrab.grab() except : return (b'--frame\r\nContent-Type: image/jpeg\r\n\r\n \r\n') img = img.resize((int(img.size[0]/RATE),int(img.size[1]/RATE)), Image.ANTIALIAS) img.save('temp/1.jpg') with open('temp/1.jpg','rb') as c: yield (b'--frame\r\nContent-Type: image/jpeg\r\n\r\n' + c.read() + b'\r\n') @app.route('/control/screen') @cklogin() def controlScreen(): return Response(getScreen(),mimetype='multipart/x-mixed-replace; boundary=frame')
import psutil from flask import request,render_template,redirect,send_file, send_from_directory,url_for,session,make_response from run import app,url import json import platform,os,datetime,sys from .login import cklogin import zipfile,time,os import random url.append( { "title": "进程监控", "href": "/Process", }) wink = ['SYSTEM', 'SYSTEMIDLEPROCESS', 'SMSS.EXE', 'CSRSS.EXE', 'WININIT.EXE', 'WINLOGON.EXE', 'SERVICES.EXE', 'LSASS.EXE', 'SVCHOST.EXE', 'DWM.EXE', 'MEMORYCOMPRESSION', 'TASKHOSTW.EXE', 'RUNTIMEBROKER.EXE', 'EXPLORER.EXE', 'SHELLEXPERIENCEHOST.EXE', 'APPLICATIONFRAMEHOST.EXE', 'SYSTEMSETTINGS.EXE', 'WMIPRVSE.EXE', 'PLUGIN_HOST.EXE', 'SPOOLSV.EXE','DASHOST.EXE','SIHOST.EXE','CONHOST.EXE','DLLHOST.EXE','TASKLIST.EXE', 'NVCONTAINER.EXE','SEARCHUI.EXE','REGISTRY','FONTDRVHOST.EXE','IGFXCUISERVICE.EXE', 'NVTELEMETRYCONTAINER.EXE','SECURITYHEALTHSERVICE.EXE','PRESENTATIONFONTCACHE.EXE', 'SEARCHINDEXER.EXE','IGFXEM.EXE','IGFXHK.EXE','CTFMON.EXE','SMARTSCREEN.EXE','CTFMON.EXE', 'SETTINGSYNCHOST.EXE','WINDOWSINTERNAL.COMPOSABLESHELL.EXPERIENCES.TEXTINPUT.INPUTAPP.EXE', 'CHSIME.EXE','AUDIODG.EXE','USYSDIAG.EXE','SEARCHPROTOCOLHOST.EXE','SEARCHFILTERHOST.EXE'] ps = ['SFTP-SERVER', 'LOGIN', 'NM-DISPATCHER', 'IRQBALANCE', 'QMGR', 'WPA_SUPPLICANT', 'LVMETAD', 'AUDITD', 'MASTER', 'DBUS-DAEMON', 'TAPDISK', 'SSHD', 'INIT', 'KSOFTIRQD', 'KWORKER', 'KMPATHD', 'KMPATH_HANDLERD', 'PYTHON', 'KDMFLUSH', 'BIOSET', 'CROND', 'KTHREADD', 'MIGRATION', 'RCU_SCHED', 'KJOURNALD', 'IPTABLES', 'SYSTEMD', 'NETWORK', 'DHCLIENT', 'SYSTEMD-JOURNALD', 'NETWORKMANAGER', 'SYSTEMD-LOGIND', 'SYSTEMD-UDEVD', 'POLKITD', 'TUNED', 'RSYSLOGD', 'BASH','YDSERVICE','SYSTEMD']