A etool package for security monitoring
Project description
安装
使用 pip 安装 etool:
pip install -U etool
功能与使用示例
网络
测试网络速度
from etool import ManagerSpeed
ManagerSpeed.network() # 网络测试
ManagerSpeed.disk() # 硬盘测试
ManagerSpeed.memory() # 内存测试
ManagerSpeed.gpu_memory() # GPU测试
屏幕与文件分享
分享屏幕
from etool import ManagerShare
ManagerShare.screen_share() # 分享屏幕
分享文件
from etool import ManagerShare
ManagerShare.share_file() # 分享文件
办公
PDF处理
from etool import ManagerPdf
# 功能升级,代码重构中
docx处理
from etool import ManagerDocx
word_path = 'ex1.docx' # docx文件路径
result_path = 'result' # 保存路径
ManagerDocx.replace_words(word_path, '1', '2') # 替换文档中的文字
ManagerDocx.change_forward(word_path, 'result.docx') # 更改文档格式
ManagerDocx.get_pictures(word_path, result_path) # 提取docx中的图片至result文件夹
邮件发送
from etool import ManagerEmail
ManagerEmail.send_email(
sender='1234567890@qq.com',
password='1234567890',
recipient='1234567890@qq.com',
subject='测试邮件',
message='测试邮件内容',
file_path='test.txt',
image_path='test.webp'
) # 发送邮件
图片处理
from etool import ManagerImage
pics = ['pic1.webp', 'pic2.webp'] # 图片路径列表
ManagerImage.merge_LR(pics) # 左右拼接
ManagerImage.merge_UD(pics) # 上下拼接
ManagerImage.fill_image('pic1_UD.webp') # 填充图片
ManagerImage.cut_image('pic1_UD_fill.webp') # 裁剪图片
ManagerImage.rename_images('tests', remove=True) # 重命名图片
表格处理
from etool import ManagerExcel
excel_path = 'ex1.xlsx' # excel文件路径
save_path = 'result.xlsx' # 保存路径
ManagerExcel.excel_format(excel_path, save_path) # 复制ex1.xlsx的样式到result.xlsx
二维码生成
from etool import ManagerQrcode
qr_path = 'qr.png' # 保存路径
ManagerQrcode.generate_english_qrcode(words='https://www.baidu.com', qr_path) # 生成不含中文的二维码
ManagerQrcode.generate_qrcode(words='百度', qr_path) # 生成含中文的二维码
ManagerQrcode.decode_qrcode(qr_path) # 解码二维码
ipynb转换
from etool import ManagerIpynb
ipynb_dir = 'ipynb_dir' # ipynb文件夹路径
md_dir = 'md' # md文件夹路径
ManagerIpynb.merge_notebooks(ipynb_dir) # 合并ipynb文件
ManagerIpynb.convert_notebook_to_markdown(ipynb_dir+'.ipynb', md_dir) # 将ipynb文件转换为md文件
其他
任务调度
from etool import ManagerScheduler
def job():
print("job")
raise Exception("error")
def func_success():
print("success")
def func_failure():
print("failure")
ManagerScheduler.pocwatch(job, 2, func_success, func_failure)
"""
- `job`: 任务函数
- `schedule_time`: 执行时间
- `func_success`: 任务成功时的回调函数
- `func_failure`: 任务失败时的回调函数
`schedule_time`的格式如下:
如果是数字则默认单位是秒,每间隔`schedule_time`秒执行一次,例如`120`,则每2分钟执行一次。
如果是字符串则默认是时间点,请遵从`HH:MM`的格式,例如`08:00`,每天在这个时间点执行一次。
如果是列表,则默认是多个时间点,例如`["08:00", "12:00", "16:00"]`,每天在这些时间点执行一次。
如果传入的是字典,则解析字典的键:
如果字典的键为数字,则默认是日期,对应字典的值遵从上方数字、字符串、列表的判断。
如果字典的键为字符串,则默认是星期几(以周一为例,支持的写法包括:`1`、`monday`、`Monday`、`MONDAY`、`mon`、`mon.`、`m`,以此类推),对应字典的值遵从上方数字、字符串、列表的判断。
例如下面是1号的8点、2号的8点、12点、16点、3号每隔一个小时执行一次、每周一的8点执行一次。
schedule_time = {
1: "08:00",
2: ["08:00", "12:00", "16:00"],
3: 216000,
"1": "08:00",
}
"""
密码生成
from etool import ManagerPassword
print(ManagerPassword.generate_pwd_list(ManagerPassword.results['all_letters'] + ManagerPassword.results['digits'], 2))
# 生成2位密码的所有可能(可用于密码爆破)
print(ManagerPassword.random_pwd(8))
# 随机生成8位密码(随机加密)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
etool-1.3.5.tar.gz
(28.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
etool-1.3.5-py3-none-any.whl
(29.4 kB
view details)
File details
Details for the file etool-1.3.5.tar.gz.
File metadata
- Download URL: etool-1.3.5.tar.gz
- Upload date:
- Size: 28.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e6b983aa47189fc214e5023c77a82e1393e26334ba8a8287d9265ee7fc0ff26
|
|
| MD5 |
b1f7208ed33fea0c96cede2f849b8908
|
|
| BLAKE2b-256 |
1cd1b2ebf202d56e73392e84bd2b8b425067736305bcf1ab93ae408c4452495b
|
File details
Details for the file etool-1.3.5-py3-none-any.whl.
File metadata
- Download URL: etool-1.3.5-py3-none-any.whl
- Upload date:
- Size: 29.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.9.21
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c9f6270b1a38d7e1f3f3f49e1cbd15ea4ba835513dd013dd0610ab15f7675250
|
|
| MD5 |
f86091f4610816edd4725cc56080804b
|
|
| BLAKE2b-256 |
372d28712e034bf98faead247060d0f1215aee7a875ea26420ffe7b8a925fabe
|