首页
壁纸
留言板
友链
更多
统计归档
Search
1
TensorBoard:训练日志及网络结构可视化工具
12,477 阅读
2
主板开机跳线接线图【F_PANEL接线图】
5,246 阅读
3
Linux使用V2Ray 原生客户端
4,066 阅读
4
NVIDIA 显卡限制功率
2,405 阅读
5
海康威视监控摄像头使用指南
2,273 阅读
好物分享
实用教程
linux使用
wincmd
学习笔记
mysql
java学习
nginx
综合面试题
大数据
网络知识
放码过来
python
javascript
java
opencv
蓝桥杯
leetcode
深度学习
开源模型
相关知识
数据集和工具
模型轻量化
语音识别
计算机视觉
杂七杂八
硬件科普
主机安全
嵌入式设备
其它
bug处理
登录
/
注册
Search
标签搜索
好物分享
学习笔记
linux
MySQL
nvidia
typero
内网穿透
webdav
vps
java
cudann
gcc
cuda
树莓派
v2ray
CNN
图像去雾
ssh安全
nps
暗通道先验
jupiter
累计撰写
330
篇文章
累计收到
61
条评论
首页
栏目
好物分享
实用教程
linux使用
wincmd
学习笔记
mysql
java学习
nginx
综合面试题
大数据
网络知识
放码过来
python
javascript
java
opencv
蓝桥杯
leetcode
深度学习
开源模型
相关知识
数据集和工具
模型轻量化
语音识别
计算机视觉
杂七杂八
硬件科普
主机安全
嵌入式设备
其它
bug处理
页面
壁纸
留言板
友链
统计归档
搜索到
56
篇与
的结果
2021-10-29
PyAutoGUI—通过python控制鼠标与键盘实现图形界面自动化
简介基本信息PyAutoGUI是一个Python语言的键鼠自动化库,简单来说和按键精灵的功能一样。但是因为是Python的类库,所以可以使用Python代码配合一些其他类库完成更加强大的功能坐标轴系统pyautogui的鼠标函数使用x,y坐标,原点在屏幕左上角,向右x坐标增加,向下y坐标增加,所有坐标都是正整数,没有负数坐标。如图所示:功能使用1.获取屏幕宽高pyautogui.size() #返回屏幕宽高像素数的元组 #例如,如果屏幕分辨率为1920*1080,那么左上角的坐标为(0,0), #右下角的坐标是(1919,1079)2.控制鼠标确定鼠标当前位置pyautogui.position() #确定鼠标当前位置,返回x,y坐标的元组移动pyautogui.moveTo(x,y[,duration = t]) # 将鼠标移动到屏幕指定位置, #x,y是目标位置的横纵坐标,duration指定鼠标光标移动到目标位置 #所需要的秒数,t可以为整数或浮点数,省略duration参数表示 #立即将光标移动到指定位置(在PyAutoGUI函数中,所有的duration #关键字参数都是可选的) #Attention:所有传入x,y坐标的地方,都可以用坐标x,y #的元组或列表替代,(x,y)/[x,y] pyautogui.moveRel(x,y[,duration = t]) #相对于当前位置移动光标, #这里的x,y不再是目标位置的坐标,而是偏移量, #如,pyautogui.moveRel(100,0,duration=0.25) #表示光标相对于当前所在位置向右移动100个像素点击:按下鼠标按键,然后放开,同时不移动位置pyautogui.mouseDown() #按下鼠标按键(左键) pyautogui.mouseUp() #释放鼠标按键(左键) pyautogui.click() #向计算机发送虚拟的鼠标点击(click()函数只是前面两个函数调用的方便封装) #默认在当前光标位置,使用鼠标左键点击 pyautogui.click([x,y,button='left/right/middle']) #在(x,y)处点击鼠标左键、右键、中键 #但不推荐使用这种方法,下面这种方法效果更好 #pyautogui.moveTo(x,y,duration=t) #pyautogui.click() pyautogui.doubleClick() #双击鼠标左键 pyautogui.rightClick() #单击鼠标右键 pyautogui.middleClick() #单击鼠标中键拖动:按住一个键不放,同时移动鼠标pyautogui.dragTo(x,y[,duration=t) #将鼠标拖动到指定位置 #x,y:x坐标,y坐标 pyautogui.dragRel(x,y[,duration=t]) #将鼠标拖动到相对当前位置的位置 #x,y:水平移动,垂直移动滚动pyautogui.scroll() #控制窗口上下滚动(滚动发生在鼠标的当前位置) #正数表示向上滚动,负数表示向下滚动, #滚动单位的大小需要具体尝试3.控制键盘输入字符串pyautogui.typewrite(s[,duration=t]) #向文本框发送字符串 #可选的duration参数在输入单个字符之间添加短暂的时间暂停 #Attention:只能用于输入英文输入键字符串不是所有的键都很容易用单个文本字符来表示。例如,如何把Shift键或左箭头键表示为单个字符串?在PyAutoGUI中,这些键表示为短的字符串值,如'esc'表示Esc键,'enter'表示Enter,我们把这些字符串称之为键字符串。pyautogui.typewrite([键盘键字符串]) #除了单个字符串,还可以向typewrite()函数传递键字符串的列表 #如 pyautogui.typewrite(['a','b','left','left','X','Y']) #按'a'键,'b'键,然后按左箭头两次,然后按'X'和'Y' #输出结果为XYab pyautogui.keyDown() #根据传入的键字符串,向计算机发送虚拟的按键(按下) pyautogui.keyUp() #根据传入的键字符串,向计算机发送虚拟的释放(释放) pyautogui.press() #前面两个函数的封装,模拟完整的击键(按下并释放)举例:pyautogui.keyDown('shift');pyautogui.press('4');pyautogui.keyUp('shift') #按下Shift,按下并释放4,然后释放Shift完整的键字符串如下:键盘键字符串 含义 'a','b','c','A','C','1','2','3', 单个字符的键 '!','@','#'等 'enter' 回车 ‘esc' ESC键 'shiftleft','shiftright' 左右Shift键 'altleft','altright' 左右Alt键 'ctrlleft','ctrlright' 左右Ctrl键 ‘tab'(or '\t') Tab键 'backspace','delete' Backspace键和Delete键 'pageup','pagedown' Page Up 和Page Down键 'home','end' Home键和End键 'up','down','left','right' 上下左右箭头键 'f1','f2','f3'等 F1至F12键 'volumemute','volumeup',volumedown' 静音,放大音量和减小音量键 'pause' 暂停键 'capslock','numlock','scrolllock' Caps Lock,Num Lock和 Scroll Lock键 'insert' Insert键 'printscreen' Prtsc或Print Screen键 'winleft','winright' 左右Win键(在windows上) 'command' Command键(在OS X上) 'option' Option键(在OS X上)快捷键组合pyautogui.hotkey() #接收多个字符串参数,顺序按下,再按相反的顺序释放举例:pyautogui.hotkey('ctrl','c') #按住Ctrl键,然后按C键,然后释放C键和Ctrl键 相当于 pyautogui.keyDown('ctrl') pyautogui.keyDown('c') pyautogui.keyUp('c') pyautogui.keyUp('ctrl')参考资料Python键鼠操作自动化库PyAutoGUI简介PyAutoGUI——图形用户界面自动化
2021年10月29日
596 阅读
0 评论
0 点赞
2021-08-27
Ubuntu上使用shell脚本实现鼠标自动点击-xdotool
1.鼠标点击器xdotool介绍xdotool作为鼠标精灵类的软件,功能越来越强大。它可以通过命令的方式模拟键盘的输入及鼠标的活动、移动或改变窗口。2.xdotool的安装2.1在Ubuntu下安装:sudo apt-get install xdotool2.2在CenterOS下安装:sudo yum install xdotool3.xdotool基本用法在xdotool安装好后,就可以使用相关的功能啦!比如,获取鼠标位置、移动鼠标、单击鼠标左键、双击,获取键盘输入……你可以打开terminal终端(Ctrl+Alt+T)直接测试相关命令。3.1获取鼠标位置将鼠标移动你想要获取的屏幕位置,在terminal中输入以下命令,可以得到鼠标位置的X,Y坐标值。 xdotool getmouselocation 3.2移动鼠标xdotool mousemove 153 63 #将鼠标移动到(X,Y)坐标为(153,63)的位置;3.3单击鼠标左键、双击xdotool的click命令控制鼠标的活动。在命令中,“1”代表鼠标左键,“2”则是滚轮,“3”则是右键。xdotool click 1 #单击左键 xdotool click 1 click 1 #双击左键3.4睡眠等待sleep 1 # 等待1秒3.5组合操作移动鼠标并单击xdotool mousemove x y click 13.6获取键盘输入模拟击键使用命令xdotool key [name of the key]如果你想要连接两个键,可以在它们之间使用“+”操作符。例如,切换窗口组合键 Alt+Tab。xdotool key alt+Tab要想让xdotool帮你输入,可以使用以下命令:xdotool type ''参考资料Ubuntu上,使用shell脚本实现鼠标自动点击,打开并设置桌面软件:https://blog.csdn.net/dongfang12n/article/details/79995857
2021年08月27日
1,397 阅读
0 评论
0 点赞
2021-08-26
最简单的 rtmp 推流服务器搭建方法
一开始想到要弄一个简单的 rtmp 服务器是为了给同学上课投射屏幕用。因为我用的是 Linux ,没法用国产的那些课室软件给他们投放屏幕,于是只好出此下策了。我使用的系统是 CentOS 7 和 Ubuntu 16.04 ,所以就想到最简单的方式搭建:使用现成的 Docker 镜像。因为重新编译安装 nginx 对我来说不太现实,会直接影响到我的开发环境。先安装好 dockerCentOS 7 :sudo yum install dockerUbuntu 16.04 :sudo apt-get install docker.io安装好之后执行 systemctl status docker 查看一下 docker 有没有被启动,没有的话执行 sudo systemctl start docker 启动。如果想日后自动启动 docker ,可以执行 sudo systemctl enable docker。docker 需要使用 root 权限来操作,如果嫌麻烦可以把自己加入 docker 的用户组里,或者直接 su root 。这里我直接使用 tiangolo/nginx-rtmp 来搭建 rtmp 服务器。sudo docker pull tiangolo/nginx-rtmp等下载完成之后就可以启动这个镜像sudo docker run -d -p 1935:1935 --name nginx-rtmp tiangolo/nginx-rtmp然后就可以直接使用 OBS 推流了。在推流的地址上填写 rtmp://你电脑的 ip 地址/live,密钥随便填写。然后可以开始串流了。在可以看串流的客户端上(例如 vlc )打开网络串流,地址就是 rtmp://你电脑的 ip 地址/live/你的密钥。因为 CentOS 和 Ubuntu 都有防火墙,如果没法推流或者接收推流的话,有可能是因为防火墙的问题。这时最好让防火墙打开 1935 端口的访问,或者直接关掉防火墙(一般是叫做 firewall 的服务或者 ufirewall )。参考资料大概是最简单的 rtmp 推流服务器搭建方法:https://zhuanlan.zhihu.com/p/52631225
2021年08月26日
619 阅读
0 评论
0 点赞
2021-02-28
ubuntu安装和配置aria2
ubuntu安装和配置aria2安装 sudo apt-get install aria2配置sudo mkdir /etc/aria2 #新建文件夹 sudo touch /etc/aria2/aria2.session #新建session文件 sudo chmod 777 /etc/aria2/aria2.session #设置aria2.session可写 sudo vim /etc/aria2/aria2.conf #创建配置文件配置文件内容# 文件的保存路径(可使用绝对路径或相对路径), 默认: 当前启动位置 dir=/mnt/sdb1/download # 启用磁盘缓存, 0为禁用缓存, 需1.16以上版本, 默认:16M disk-cache=32M # 文件预分配方式, 能有效降低磁盘碎片, 默认:prealloc # 预分配所需时间: none < falloc ? trunc < prealloc # falloc和trunc则需要文件系统和内核支持 # NTFS建议使用falloc, EXT3/4建议trunc, MAC 下需要注释此项 file-allocation=trunc # 断点续传 continue=true ## 下载连接相关 ## # 最大同时下载任务数, 运行时可修改, 默认:5 max-concurrent-downloads=10 # 同一服务器连接数, 添加时可指定, 默认:1 max-connection-per-server=16 # 最小文件分片大小, 添加时可指定, 取值范围1M -1024M, 默认:20M # 假定size=10M, 文件为20MiB 则使用两个来源下载; 文件为15MiB 则使用一个来源下载 min-split-size=10M # 单个任务最大线程数, 添加时可指定, 默认:5 split=16 # 整体下载速度限制, 运行时可修改, 默认:0 max-overall-download-limit=0 # 单个任务下载速度限制, 默认:0 #max-download-limit=0 # 整体上传速度限制, 运行时可修改, 默认:0 max-overall-upload-limit=80 # 单个任务上传速度限制, 默认:0 #max-upload-limit=1000 # 禁用IPv6, 默认:false disable-ipv6=false #检查证书 check-certificate=false ## 进度保存相关 ## # 从会话文件中读取下载任务 input-file=/etc/aria2/aria2.session # 在Aria2退出时保存`错误/未完成`的下载任务到会话文件 save-session=/etc/aria2/aria2.session # 定时保存会话, 0为退出时才保存, 需1.16.1以上版本, 默认:0 #save-session-interval=60 ## RPC相关设置 ## # 启用RPC, 默认:false enable-rpc=true # 允许所有来源, 默认:false rpc-allow-origin-all=true # 允许非外部访问, 默认:false rpc-listen-all=true # 事件轮询方式, 取值:[epoll, kqueue, port, poll, select], 不同系统默认值不同 #event-poll=select # RPC监听端口, 端口被占用时可以修改, 默认:6800 rpc-listen-port=6800 # 设置的RPC授权令牌, v1.18.4新增功能, 取代 --rpc-user 和 --rpc-passwd 选项 rpc-secret=123456 # 设置的RPC访问用户名, 此选项新版已废弃, 建议改用 --rpc-secret 选项 #rpc-user=<USER> # 设置的RPC访问密码, 此选项新版已废弃, 建议改用 --rpc-secret 选项 #rpc-passwd=<PASSWD> ## BT/PT下载相关 ## # 当下载的是一个种子(以.torrent结尾)时, 自动开始BT任务, 默认:true follow-torrent=true # BT监听端口, 当端口被屏蔽时使用, 默认:6881-6999 #listen-port=51413 # 单个种子最大连接数, 默认:55 #bt-max-peers=55 # 打开DHT功能, PT需要禁用, 默认:true enable-dht=true # 打开IPv6 DHT功能, PT需要禁用 #enable-dht6=false # DHT网络监听端口, 默认:6881-6999 #dht-listen-port=6881-6999 # 本地节点查找, PT需要禁用, 默认:false #bt-enable-lpd=true # 种子交换, PT需要禁用, 默认:true enable-peer-exchange=true # 每个种子限速, 对少种的PT很有用, 默认:50K #bt-request-peer-speed-limit=50K # 客户端伪装, PT需要 peer-id-prefix=-TR2770- user-agent=Transmission/2.77 # 当种子的分享率达到这个数时, 自动停止做种, 0为一直做种, 默认:1.0 seed-ratio=0.1 # 强制保存会话, 即使任务已经完成, 默认:false # 较新的版本开启后会在任务完成后依然保留.aria2文件 #force-save=false # BT校验相关, 默认:true #bt-hash-check-seed=true # 继续之前的BT任务时, 无需再次校验, 默认:false bt-seed-unverified=true # 保存磁力链接元数据为种子文件(.torrent文件), 默认:false bt-save-metadata=true bt-tracker=udp://tracker.coppersurfer.tk:6969/announce,udp://tracker.opentrackr.org:1337/announce,udp://tracker.leechers-paradise.org:6969/announce,udp://p4p.arenabg.com:1337/announce,udp://9.rarbg.to:2710/announce,udp://9.rarbg.me:2710/announce,udp://tracker.internetwarriors.net:1337/announce,udp://exodus.desync.com:6969/announce,udp://tracker.cyberia.is:6969/announce,udp://retracker.lanta-net.ru:2710/announce,udp://tracker.tiny-vps.com:6969/announce,udp://open.stealth.si:80/announce,udp://tracker.torrent.eu.org:451/announce,udp://tracker3.itzmx.com:6961/announce,udp://tracker.moeking.me:6969/announce,udp://bt1.archive.org:6969/announce,udp://ipv4.tracker.harry.lu:80/announce,udp://bt2.archive.org:6969/announce,udp://zephir.monocul.us:6969/announce,udp://valakas.rollo.dnsabr.com:2710/announce,udp://tracker.zerobytes.xyz:1337/announce,udp://tracker.uw0.xyz:6969/announce,udp://tracker.lelux.fi:6969/announce,udp://tracker.kamigami.org:2710/announce,udp://tracker.ds.is:6969/announce,udp://retracker.akado-ural.ru:80/announce,udp://opentracker.i2p.rocks:6969/announce,udp://opentor.org:2710/announce,udp://explodie.org:6969/announce,udp://tracker-udp.gbitt.info:80/announce,udp://chihaya.de:6969/announce,udp://www.loushao.net:8080/announce,udp://u.wwwww.wtf:1/announce,udp://tracker.yoshi210.com:6969/announce,udp://tracker.teambelgium.net:6969/announce,udp://tracker.swateam.org.uk:2710/announce,udp://tracker.skyts.net:6969/announce,udp://tracker.jae.moe:6969/announce,udp://tracker.army:6969/announce,udp://tr2.ysagin.top:2710/announce,udp://t3.leech.ie:1337/announce,udp://t1.leech.ie:1337/announce,udp://retracker.sevstar.net:2710/announce,udp://retracker.netbynet.ru:2710/announce,udp://qg.lorzl.gq:2710/announce,udp://aaa.army:8866/announce,udp://tracker6.dler.org:2710/announce,udp://tracker4.itzmx.com:2710/announce,udp://tracker2.itzmx.com:6961/announce,udp://tracker.filemail.com:6969/announce,udp://tracker.dler.org:6969/announce,udp://tr.bangumi.moe:6969/announce,udp://bt2.54new.com:8080/announce配置系统服务vim /etc/systemd/system/aria2c.service[Unit] Description=Aria2c [Service] TimeoutStartSec=0 ExecStart=/usr/bin/aria2c --conf-path=/etc/aria2/aria2.conf ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=42s [Install] WantedBy=multi-user.target启动与开机自启# 更新配置 systemctl daemon-reload # 启动服务 systemctl start aria2c # 设置开机启动 systemctl enable aria2c参考资料ubuntu安装aria2:https://www.jianshu.com/p/1178a669c308ubuntu Aria2 AriaNg安装:https://blog.csdn.net/macwinwin/article/details/106985341
2021年02月28日
883 阅读
0 评论
0 点赞
2021-02-28
cloudreve私有云盘配置后台运行
cloudreve私有云盘配置后台运行在/usr/lib/systemd/system目录下创建一个服务cloudreve.servicesudo vim /etc/systemd/system/cloudreve.service输入如下内容:[Unit] Description=Cloudreve Documentation=https://docs.cloudreve.org [Service] TimeoutStartSec=0 ExecStart=/data/cloudreve/cloudreve ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=on-failure RestartSec=5s [Install] WantedBy=multi-user.target更新重启服务# 更新配置 systemctl daemon-reload # 启动服务 systemctl start cloudreve # 设置开机启动 systemctl enable cloudreve 管理命令# 启动服务 systemctl start cloudreve # 停止服务 systemctl stop cloudreve # 重启服务 systemctl restart cloudreve # 查看状态 systemctl status cloudreve参考资料cloudreve私有云盘配置后台运行:https://blog.csdn.net/longzhoufeng/article/details/108958091
2021年02月28日
1,629 阅读
0 评论
0 点赞
2021-02-20
python实现阿里云域名ipv4和ipv6 ddns
1.前言首先得有一个阿里云的域名:https://www.aliyun.com/minisite/goods?userCode=jdjc69nf然后你的IP必须是公网IP,不然解析了也没用。本文章讲怎样通过阿里云的SDK来添加修改域名解析,检查本机IP与解析的IP是否一致,不一致自动修改解析,达到动态解析的目的,主要用于家庭宽带这些动态IP的地方。2.安装阿里云SDK和其他第三方库pip install aliyun-python-sdk-core-v3 pip install aliyun-python-sdk-domain pip install aliyun-python-sdk-alidns pip install requests3.获取accessKeyId和accessSecret可以在阿里云控制台个人中心直接获取,但是一般建议使用RAM角色来进行权限控制,这样这个accessKey和accessSecret就只能操作域名,不能操作其他的资源,相对会比较安全。关于RAM快速入门:https://help.aliyun.com/document_detail/28637.html?source=5176.11533457&userCode=jdjc69nf4.源码下载-官方4.1 下载地址gitee:https://gitee.com/zeruns/aliddns_Pythongithub:https://github.com/zeruns/-Python-aliddns_ipv4-ipv6将aliddns.py文件下载下来。然后用notepad++或其他编辑器打开,按照注释提示修改并保存。然后运行一下看看有没有问题:打开cmd输入python 脚本目录4.2源码备份from aliyunsdkcore.client import AcsClient from aliyunsdkcore.acs_exception.exceptions import ClientException from aliyunsdkcore.acs_exception.exceptions import ServerException from aliyunsdkalidns.request.v20150109.DescribeSubDomainRecordsRequest import DescribeSubDomainRecordsRequest from aliyunsdkalidns.request.v20150109.DescribeDomainRecordsRequest import DescribeDomainRecordsRequest import requests from urllib.request import urlopen import json ipv4_flag = 1 # 是否开启ipv4 ddns解析,1为开启,0为关闭 ipv6_flag = 1 # 是否开启ipv6 ddns解析,1为开启,0为关闭 accessKeyId = "accessKeyId" # 将accessKeyId改成自己的accessKeyId accessSecret = "accessSecret" # 将accessSecret改成自己的accessSecret domain = "4v7p.top" # 你的主域名 name_ipv4 = "ipv4.test" # 要进行ipv4 ddns解析的子域名 name_ipv6 = "ipv6.test" # 要进行ipv6 ddns解析的子域名 client = AcsClient(accessKeyId, accessSecret, 'cn-hangzhou') def update(RecordId, RR, Type, Value): # 修改域名解析记录 from aliyunsdkalidns.request.v20150109.UpdateDomainRecordRequest import UpdateDomainRecordRequest request = UpdateDomainRecordRequest() request.set_accept_format('json') request.set_RecordId(RecordId) request.set_RR(RR) request.set_Type(Type) request.set_Value(Value) response = client.do_action_with_exception(request) def add(DomainName, RR, Type, Value): # 添加新的域名解析记录 from aliyunsdkalidns.request.v20150109.AddDomainRecordRequest import AddDomainRecordRequest request = AddDomainRecordRequest() request.set_accept_format('json') request.set_DomainName(DomainName) request.set_RR(RR) # https://blog.zeruns.tech request.set_Type(Type) request.set_Value(Value) response = client.do_action_with_exception(request) if ipv4_flag == 1: request = DescribeSubDomainRecordsRequest() request.set_accept_format('json') request.set_DomainName(domain) request.set_SubDomain(name_ipv4 + '.' + domain) response = client.do_action_with_exception(request) # 获取域名解析记录列表 domain_list = json.loads(response) # 将返回的JSON数据转化为Python能识别的 ip = urlopen('https://api-ipv4.ip.sb/ip').read() # 使用IP.SB的接口获取ipv4地址 ipv4 = str(ip, encoding='utf-8') print("获取到IPv4地址:%s" % ipv4) if domain_list['TotalCount'] == 0: add(domain, name_ipv4, "A", ipv4) print("新建域名解析成功") elif domain_list['TotalCount'] == 1: if domain_list['DomainRecords']['Record'][0]['Value'].strip() != ipv4.strip(): update(domain_list['DomainRecords']['Record'][0]['RecordId'], name_ipv4, "A", ipv4) print("修改域名解析成功") else: # https://blog.zeruns.tech print("IPv4地址没变") elif domain_list['TotalCount'] > 1: from aliyunsdkalidns.request.v20150109.DeleteSubDomainRecordsRequest import DeleteSubDomainRecordsRequest request = DeleteSubDomainRecordsRequest() request.set_accept_format('json') request.set_DomainName(domain) # https://blog.zeruns.tech request.set_RR(name_ipv4) response = client.do_action_with_exception(request) add(domain, name_ipv4, "A", ipv4) print("修改域名解析成功") print("本程序版权属于zeruns,博客:https://blog.zeruns.tech") if ipv6_flag == 1: request = DescribeSubDomainRecordsRequest() request.set_accept_format('json') request.set_DomainName(domain) request.set_SubDomain(name_ipv6 + '.' + domain) response = client.do_action_with_exception(request) # 获取域名解析记录列表 domain_list = json.loads(response) # 将返回的JSON数据转化为Python能识别的 ip = urlopen('https://api-ipv6.ip.sb/ip').read() # 使用IP.SB的接口获取ipv6地址 ipv6 = str(ip, encoding='utf-8') print("获取到IPv6地址:%s" % ipv6) if domain_list['TotalCount'] == 0: add(domain, name_ipv6, "AAAA", ipv6) print("新建域名解析成功") elif domain_list['TotalCount'] == 1: if domain_list['DomainRecords']['Record'][0]['Value'].strip() != ipv6.strip(): update(domain_list['DomainRecords']['Record'][0]['RecordId'], name_ipv6, "AAAA", ipv6) print("修改域名解析成功") else: # https://blog.zeruns.tech print("IPv6地址没变") elif domain_list['TotalCount'] > 1: from aliyunsdkalidns.request.v20150109.DeleteSubDomainRecordsRequest import DeleteSubDomainRecordsRequest request = DeleteSubDomainRecordsRequest() request.set_accept_format('json') request.set_DomainName(domain) request.set_RR(name_ipv6) # https://blog.zeruns.tech response = client.do_action_with_exception(request) add(domain, name_ipv6, "AAAA", ipv6) print("修改域名解析成功")6.设置定时任务6.1 Linux操作使用crontab -e写入定时任务即可。例如:6.2 windows操作右键点击电脑左下角,再点击计算机管理点击任务计划程序,再点击创建任务,输入要设置的任务名称。新建触发器,执行间隔可以自己设置,持续时间改成无限期。新建操作,这一步很重要,配置错误就会导致脚本文件执行不成功!!!最后确认就行。参考资料Python实现阿里云域名DDNS支持ipv4和ipv6:https://developer.aliyun.com/article/755182
2021年02月20日
787 阅读
0 评论
0 点赞
2021-02-02
宝塔面板安装ImgURL图床[转载]
宝塔面板安装ImgURL图床[转载]ImgURL是一个开源、免费的图床程序,ImgURL 2.x之后对环境要求更高,尤其是ImageMagick组件的支持,很多朋友不清楚怎样安装这个组件,这篇文章分享宝塔面板安装ImgURL 2.x图床的过程(包括ImgURL 2.x需要的各种组件)准备工作已经安装宝塔面板在宝塔后台创建一个站点下载ImgURL 2.x 上传到站点根目录并解压设置伪静态如果您宝塔面板安装的Apache则不需要再设置伪静态,直接跳过这个步骤,如果使用的Nginx环境,请继续往下看。找到对应的站点 - 点击后面设置按钮 - 伪静态 - 添加下面的伪静态规则location / { try_files $uri $uri/ /index.php?$query_string; } location ~* \.(db3|json)$ { deny all; } location ~* ^/(temp|upload|imgs|data|application|static|system)/.*.(php|php5)$ { return 403; }安装fileinfo & imagemagick在宝塔后台 - 软件管理 - 找到您站点对应的PHP版本 - 设置PHP - 安装扩展 - 勾选fileinfo和imagemagick,如下截图。安装ImgURL 2.x其它所需扩展宝塔默认已经支持,重点是安装fileinfo和imagemagick,扩展安装完毕后就可以访问您自己的域名安装ImgURL了,如果正常会看到ImgURL安装界面。其它说明如果安装遇到任何问题,请留言反馈或到 3T官方社区 进行反馈ImgURL更多使用说明请参考帮助文档:https://dwz.ovh/imgurldoc开源不易,如果您觉得ImgURL还不错,请访问这里捐赠参考资料宝塔面板安装ImgURL图床:https://www.xiaoz.me/archives/12081
2021年02月02日
930 阅读
0 评论
0 点赞
2021-01-28
nps 服务端安装和配置
nps 服务端安装和配置0.说明项目github地址https://github.com/ehang-io/nps前置条件一个有公网IP的服务器上,系统为Linux/Windows均可。1. 服务端安装和启动1.1 下载安装所需文件mkdir nps cd nps wget https://github.com/ehang-io/nps/releases/download/v0.26.9/linux_amd64_server.tar.gz1.2 解压tar xzvf linux_amd64_server.tar.gz1.3 安装./nps install备注:安装完成后相关配置文件和web文件夹位于/etc/nps中1.4 修改相关配置注意:配置文件不是解压出来的文件夹中的conf文件,而是/etc/nps中的配置文件配置文件所在位置打开配置文件cd /etc/nps cd conf # 可以看到该文件夹中有一个nps.conf文件便是待修改的配置文件 vim nps.conf修改配置文件(仅仅修改带注释的部分即可)appname = nps #Boot mode(dev|pro) runmode = dev #HTTP(S) proxy port, no startup if empty http_proxy_ip=0.0.0.0 http_proxy_port=80 #vhttp端口 https_proxy_port=443 #vhttps端口 https_just_proxy=true #default https certificate setting https_default_cert_file=conf/server.pem https_default_key_file=conf/server.key ##bridge bridge_type=tcp bridge_port=8024 #客户端连接端口 bridge_ip=0.0.0.0 # Public password, which clients can use to connect to the server # After the connection, the server will be able to open relevant ports and parse related domain names according to its own configuration file. public_vkey=123 #Traffic data persistence interval(minute) #Ignorance means no persistence #flow_store_interval=1 # log level LevelEmergency->0 LevelAlert->1 LevelCritical->2 LevelError->3 LevelWarning->4 LevelNotice->5 LevelInformational->6 LevelDebug->7 log_level=7 #log_path=nps.log #Whether to restrict IP access, true or false or ignore #ip_limit=true #p2p #p2p_ip=127.0.0.1 #p2p_port=6000 #p2p隧道端口 #web web_host=a.o.com web_username=admin web_password=123 web_port = 8080 #web管理端口 web_ip=0.0.0.0 web_base_url= web_open_ssl=false web_cert_file=conf/server.pem web_key_file=conf/server.key # if web under proxy use sub path. like http://host/nps need this. #web_base_url=/nps #Web API unauthenticated IP address(the len of auth_crypt_key must be 16) #Remove comments if needed #auth_key=test auth_crypt_key =1234567812345678 #allow_ports=9001-9009,10001,11000-12000 #Web management multi-user login allow_user_login=false allow_user_register=false allow_user_change_username=false #extension allow_flow_limit=false allow_rate_limit=false allow_tunnel_num_limit=false allow_local_proxy=false allow_connection_num_limit=false allow_multi_ip=false system_info_display=false #cache http_cache=false http_cache_length=100 #get origin ip http_add_origin_header=false #pprof debug options #pprof_ip=0.0.0.0 #pprof_port=9999 #client disconnect timeout disconnect_timeout=60保持配置文件1.5 启动npsnps start2.服务端使用2.1 登录后台,添加客户端默认用户名:admin默认密码:1232.2 查看客户端连接命令2.3 客户端连接见博客:nps客户端使用连接上的状态如下图所示:3. 为客户端配置隧道TCP隧道然后通过`服务器IP:50080即可访问该`客户端位于60080端口的服务。
2021年01月28日
820 阅读
0 评论
0 点赞
2021-01-28
nps客户端使用
nps客户端使用1.进入github releases安装页面下载对应版本的客户端并解压地址:https://github.com/cnlh/nps/releases2.windows系统临时启动#进入npc文件所在的目录 cd npc文件所在的目录 #启动客户端,比如服务端公网IP为1.1.1.1,服务端配置文件中tcpport为8024 ./npc -server=1.1.1.1:8024 -vkey=客户端的密钥注册服务(开机启动,守护进程)用 nps 自带的命令,很方便的注册到服务中,使用管理员身份运行cmdnpc.exe install -server=1.2.3.4:8024 -vkey=客户端的密钥常用命令# 启动 npc start # 停止 npc stop # 卸载 npc uninstall3.linux系统./#进入npc文件所在的目录 cd npc文件所在的目录 #启动客户端,比如服务端公网IP为1.1.1.1,服务端配置文件中tcpport为8284 npc.exe -server=1.1.1.1:8284 -vkey=客户端的密钥
2021年01月28日
813 阅读
0 评论
0 点赞
2021-01-16
Ubuntu上安装tinyproxy搭建HTTP代理服务器
0.什么是TinyProxy它是一个代理服务器,用来实现http或https代理,windows系统一直在用ccproxy, 非windows系统,怎么开放个http代理呢?那就是TinyProxy。1.TinyProxy安装sudo apt-get update apt-get install tinyproxy2.配置参数文件vi /etc/tinyproxy.conf修改下面两个部分:Port 8888 #预设是8888 Port,你可以更改 Allow 127.0.0.1 #将127.0.0.1改成你自己的IP #例如你的IP 是1.2.3.4,你改成Allow 1.2.3.4,那只有你才可以连上这个Proxy #若你想任何IP都可以脸到Proxy在Allow前面打#注释3.TinyProxy打开与关闭service tinyproxy start/restart/stop4.连接测试在另一台客户机上输入curl -x <IP>:<PORT> www.baidu.com其中IP和PORT是代理服务器的IP和代理端口,如果出现百度的源代码,则证明代理配置成功。参考资料Ubuntu上安装tinyproxy搭建HTTP代理服务器:https://blog.csdn.net/weixin_41010318/article/details/85015976腾讯云Ubuntu搭建TinyProxy代理服务器:https://cloud.tencent.com/developer/article/1004731
2021年01月16日
986 阅读
0 评论
0 点赞
2021-01-08
搭建web IDE--Code-server
搭建web IDE--Code-server原理基础code-server是一款基于VScode的在线编辑器,主要用于在Linux服务器环境下,实现任何设备通过浏览器即可访问VScode, 进而实现在远程编程.官方文档GIthub官方安装教程文档:https://github.com/cdr/code-server/blob/v3.8.0/doc/install.mdDebian, Ubuntucurl -fOL https://github.com/cdr/code-server/releases/download/v3.8.0/code-server_3.8.0_amd64.deb sudo dpkg -i code-server_3.8.0_amd64.deb sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yamlFedora, CentOS, RHEL, SUSEcurl -fOL https://github.com/cdr/code-server/releases/download/v3.8.0/code-server-3.8.0-amd64.rpm sudo rpm -i code-server-3.8.0-amd64.rpm sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yamlArch Linux# Installs code-server from the AUR using yay. yay -S code-server sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml # Installs code-server from the AUR with plain makepkg. git clone https://aur.archlinux.org/code-server.git cd code-server makepkg -si sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yamlDebian, Ubuntucurl -fOL https://github.com/cdr/code-server/releases/download/v3.8.0/code-server_3.8.0_amd64.deb sudo dpkg -i code-server_3.8.0_amd64.deb sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yamlFedora, CentOS, RHEL, SUSEcurl -fOL https://github.com/cdr/code-server/releases/download/v3.8.0/code-server-3.8.0-amd64.rpm sudo rpm -i code-server-3.8.0-amd64.rpm sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yamlArch Linux# Installs code-server from the AUR using yay. yay -S code-server sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yaml # Installs code-server from the AUR with plain makepkg. git clone https://aur.archlinux.org/code-server.git cd code-server makepkg -si sudo systemctl enable --now code-server@$USER # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yamlmacOSbrew install code-server brew services start code-server # Now visit http://127.0.0.1:8080. Your password is in ~/.config/code-server/config.yamlDocker# This will start a code-server container and expose it at http://127.0.0.1:8080. # It will also mount your current directory into the container as `/home/coder/project` # and forward your UID/GID so that all file system operations occur as your user outside # the container. # # Your $HOME/.config is mounted at $HOME/.config within the container to ensure you can # easily access/modify your code-server config in $HOME/.config/code-server/config.json # outside the container. mkdir -p ~/.config docker run -it --name code-server -p 127.0.0.1:8080:8080 \ -v "$HOME/.config:/home/coder/.config" \ -v "$PWD:/home/coder/project" \ -u "$(id -u):$(id -g)" \ -e "DOCKER_USER=$USER" \ codercom/code-server:latest
2021年01月08日
616 阅读
0 评论
0 点赞
1
...
3
4