- 前言
- 软件下载
- 代码展示
- H T M L HTML HTML 前端部分
- 1.客户端主页
- 2.拍照、截图
- P y t h o n Python Python 后端部分
- 1. / m a i n . p y /main.py /main.py
- 2. / V e r y C o n t r o l / u r l s . p y /VeryControl/urls.py /VeryControl/urls.py
- 最后
前排提醒:这篇文章有点儿长,如果直接想看效果可以来此下载,代码看看就行了。
_..._ .-'''-. .-'''-.
.-'_..._''. ' _ ' _ .---.
.----. .----. __.....__ .' .' './ /` '. _..._ / /` '. | |
/ /.-'' '. .-. .- / .' . | ' .' '. . | ' | |
' '. /' // .-''"'-. `. .-,.--. / / . ' | ' | '. .-. . .| .-,.--. | ' | '| |
| |' // /________ | .-. | / / | | / / | ' ' | .' |_ | .-. | / / | |
| || || || | | | / / | | `. ` ..' / | | | | .' || | | | `. ` ..' / | |
'. `' .' .-------------'| | | | / / . ' '-...-'` | | | |'--. .-'| | | | '-...-'` | |
/ '-.____...---.| | '- ` / '. . | | | | | | | | '- | |
/ `. .' | | / '. `._____.-'/ | | | | | | | | | |
'----' `''-...... -' | | / / `-.______ / | | | | | '.'| | '---'
|_| |`-' / ` | | | | | / |_|
'..' '--' '--' `'-'
我最近多少有点儿闲得慌,前两天出去玩儿了一圈,路上就一直盘算着这事儿,前两天做了个雏形,今天完善好了,分享给大家一起看着玩儿。
这个程序感觉还凑合,制作了一个网页端。虽然设计不咋样吧(我是初学者),但是至少能在手机、电脑等各种设备上成功访问并进行远程命令执行。
用到的语言是 P y t h o n Python Python 和 H T M L HTML HTML,使用了 D j a n g o Django Django 框架,及一些其他的小功能。
软件截图:
软件下载建议阅读里面的注意事项,很重要。
可能CSDN资源还没有通过审核,可以使用下面的仓库看程序。
软件下载地址:https://download.csdn.net/download/PanDaoxi2020/86265805
有一个开源的地址:https://pandaoxi.coding.net/public/pandaoxi/Projects/git/files/master/Very_Control
让我们一起来看看这个小项目的源代码叭~
H T M L HTML HTML 前端部分H T M L HTML HTML 部分主要是客户端的一些东西,直接在网页上访问,并传回相应的内容给后端 A P I API API 。
1.客户端主页最基本的内容,可以直接在主页填写命令的表单,然后 P O S T POST POST 给后端的 A P I API API /run。
{ c o m m a n d = 普通执行命令 e c h o = 输入命令,并返回输出内容 c o d e = 执行批处理命令 r u n f = 运行应用程序(需要应用程序提交工具) begin{cases} & text command=普通执行命令 \ & text echo=输入命令,并返回输出内容 \ & text code=执行批处理命令 \ & text runf=运行应用程序(需要应用程序提交工具) \ end{cases} ⎩ ⎨ ⎧command=普通执行命令echo=输入命令,并返回输出内容code=执行批处理命令runf=运行应用程序(需要应用程序提交工具)
2.拍照、截图Very Control
这两个功能的页面基本相同。
摄像头捕获
该功能可能会比较卡顿;如果不能正常显示出摄像头图像,可能是因为被控制设备的摄像头无法访问。
回到主页 重新拍照
P y t h o n Python Python 后端部分Screen Shot ![]()
回到主页 重新截图
目录树:
D:.
│ db.sqlite3
│ main.py
│ manage.py
│
└─VeryControl
asgi.py
settings.py
urls.py
wsgi.py
__init__.py
我特意给它做了一个应用程序版的,内置 第
1.3.0.0
1.3.0.0
1.3.0.0 的服务器版本 它会自己更新,不用管它。
这个程序的主要功能是:
- 绘制 L O G O LOGO LOGO 。
- 生成服务器,使得前端可以访问。
- 检查是否有更新,如果没有直接运行服务器;如果有,就强制更新。
第三条性质感觉有那么一种 W i n d o w s Windows Windows 的传奇色彩~
# Copyright 2022 by PanDaoxi. All rights reserved.
from socket import socket, AF_INET, SOCK_DGRAM
from os import system, name
from time import strftime, sleep
from colorama import init, Fore, Back
from requests import get
# 版本信息
version = "1.3.0.0 [2022-7-22 Update]"
# 更新文件的名称和网络地址
updateFiles = {
"./manage.py": "https://pandaoxi.coding.net/p/pandaoxi/d/Projects/git/raw/master/Very_Control/manage.py",
__file__: "https://pandaoxi.coding.net/p/pandaoxi/d/Projects/git/raw/master/Very_Control/main.py",
"./VeryControl/asgi.py": "https://pandaoxi.coding.net/p/pandaoxi/d/Projects/git/raw/master/Very_Control/VeryControl/asgi.py",
"./VeryControl/settings.py": "https://pandaoxi.coding.net/p/pandaoxi/d/Projects/git/raw/master/Very_Control/VeryControl/settings.py",
"./VeryControl/urls.py": "https://pandaoxi.coding.net/p/pandaoxi/d/Projects/git/raw/master/Very_Control/VeryControl/urls.py",
"./VeryControl/wsgi.py": "https://pandaoxi.coding.net/p/pandaoxi/d/Projects/git/raw/master/Very_Control/VeryControl/wsgi.py",
}
# 用户代理
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36 Edg/103.0.1264.44",
}
# 获取IP地址
def getIP():
try:
sock = socket(AF_INET, SOCK_DGRAM)
sock.connect(("8.8.8.8", 80))
ip = sock.getsockname()[0]
finally:
sock.close()
retuhttps://blog.csdn.net/PanDaoxi2020/article/details/rn ip
# 如果发现更新就一个一个地给文件更新为最新版本
def update():
for i in updateFiles.keys():
with open(i, "wb") as f:
f.write(get(updateFiles[i], headers=headers).content)
sleep(0.3)
if __name__ == "__main__" and name == "nt":
# 获取最新版本号
temp = get('https://pandaoxi.coding.net/p/pandaoxi/d/Projects/git/raw/master/Very_Control/VeryControl/VERSION',headers=headers)
temp.encoding = 'utf-8'
latest = temp.text
# 如果不一样就更新
if latest != version:
print('Please wait a moment, we are updating the software for you ...')
update() # 你挡都挡不住!
system('cls')
# 画一只 楼狗(logo)
print(
""" _..._ .-'''-. .-'''-.
.-'_..._''. ' _ ' _ .---.
.----. .----. __.....__ .' .' './ /` '. _..._ / /` '. | |
/ /.-'' '. .-. .- / .' . | ' .' '. . | ' | |
' '. /' // .-''"'-. `. .-,.--. / / . ' | ' | '. .-. . .| .-,.--. | ' | '| |
| |' // /________ | .-. | / / | | / / | ' ' | .' |_ | .-. | / / | |
| || || || | | | / / | | `. ` ..' / | | | | .' || | | | `. ` ..' / | |
'. `' .' .-------------'| | | | / / . ' '-...-'` | | | |'--. .-'| | | | '-...-'` | |
/ '-.____...---.| | '- ` / '. . | | | | | | | | '- | |
/ `. .' | | / '. `._____.-'/ | | | | | | | | | |
'----' `''-...... -' | | / / `-.______ / | | | | | '.'| | '---'
|_| |`-' / ` | | | | | / |_|
'..' '--' '--' `'-' nn"""
)
# 配置 colorama
init(autoreset=True)
# 欢迎信息及服务器地址(高亮标红)
print(
"Welcome to Very_Control (Version %s) !nControlled end:" % version,
Fore.RED + "http://%s:%s/n" % (getIP(), strftime("%Y")),
)
# 运行服务器
system("python manage.py runserver %s:%s" % (getIP(), strftime("%Y")))
# 如果服务器运行期间出现BUG,这样就不会退出了。
input()
2.
/
V
e
r
y
C
o
n
t
r
o
l
/
u
r
l
s
.
p
y
/VeryControl/urls.py
/VeryControl/urls.py
这是服务器的核心,我们靠它进行一系列的控制。
from django.urls import path as site
from django.shortcuts import HttpResponse
from os import system, remove, environ
from base64 import a85decode, b64encode
from sys import path
from requests import get
from pyautogui import screenshot
from tkinter import Tk
from time import strftime, sleep
from cv2 import VideoCapture, imwrite
def getVersion():
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.66 Safari/537.36 Edg/103.0.1264.44",
}
temp = get(
"https://pandaoxi.coding.net/p/pandaoxi/d/Projects/git/raw/master/Very_Control/VeryControl/VERSION",
headers=headers,
)
temp.encoding = "utf-8"
retuhttps://blog.csdn.net/PanDaoxi2020/article/details/rn temp.text
# 求最大公因数
def gcd(a, b):
if b == 0:
retuhttps://blog.csdn.net/PanDaoxi2020/article/details/rn a
else:
retuhttps://blog.csdn.net/PanDaoxi2020/article/details/rn gcd(b, a % b)
# 适配图片比例
def change(a, b):
x = gcd(a, b)
a /= x
b /= x
while a < 500 or b < 500:
a *= 2
b *= 2
retuhttps://blog.csdn.net/PanDaoxi2020/article/details/rn (a, b)
# 拍照
def get_photo():
cap = VideoCapture(0)
f, frame = cap.read()
imwrite("./photo.png", frame)
with open("./photo.png", "rb") as f:
temp = b64encode(f.read()).decode()
remove("./photo.png")
cap.release()
retuhttps://blog.csdn.net/PanDaoxi2020/article/details/rn "data:image/png;base64,%s" % temp
# 主页
def main(request):
retuhttps://blog.csdn.net/PanDaoxi2020/article/details/rn HttpResponse(
"""Very Control
当前软件信息:
版本: %s
开发者:PanDaoxi
开源地址:点击这里去访问!
开发者邮箱(欢迎意见反馈和技术支持):
其他功能:截取屏幕tt查看被控制者信息tt捕获摄像头tt发送消息tt阅读官方通知
页面加载较慢是正常现象,请耐心等候。
%s
n" % i retuhttps://blog.csdn.net/PanDaoxi2020/article/details/rn HttpResponse( """回到主页tt重新截图
%st%s
n" % (i, environ[i]) try: remove("temp.txt") except: pahttps://blog.csdn.net/PanDaoxi2020/article/details/ss system("tasklist>>temp.txt") with open("temp.txt", "r", encoding="utf-8") as f: s2 = f.read().splitlines() remove("temp.txt") s3 = "" for i in s2: s3 += "%s
n" % i retuhttps://blog.csdn.net/PanDaoxi2020/article/details/rn HttpResponse( """运行的进程(如需对齐可以看此网页的源代码) %s
该功能可能会比较卡顿;如果不能正常显示出摄像头图像,可能是因为被控制设备的摄像头无法访问。
回到主页tt重新拍照




