-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A new function, many typos fixing, and code re-formatting #1
base: master
Are you sure you want to change the base?
Conversation
SRM/__init__.py
Outdated
@@ -0,0 +1 @@ | |||
from SRM import monitor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我记得从python3开始应该就不需要配置__init__.py设置包了吧?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经修改
SRM/monitor.py
Outdated
@@ -1,11 +1,14 @@ | |||
import psutil | |||
import common | |||
# -*- coding: UTF-8 -*- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
从python3就不用说明了。默认utf8
help="限制监听范围,为进程名(如explorer.exe)", default=[]) | ||
argparser.add_argument("-m", "--mail", type=bool, | ||
help="是否发送邮件通知", default=False) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
项目目录下添加一个配置文件吧。在配置文件里进行邮件的配置。尽量避免修改代码
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经修改,详见下列:
- 在SRM包中单独创建了一个MAIL类来使用邮件通知;
- 用户可以通过指令输入相关配置;
start.py
中仅有两行代码
另外,我希望之后能以修饰器的方式注入,目前看来改动较大
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
README中也增加了相关描述
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修饰器也是一种表现形式,前提是需要将事件提出来,再提供事件注册接口,再然后是使用修饰器去注册。我觉得这个思路没问题,就是没时间去做,你可以试一试
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修饰器也是一种表现形式,前提是需要将事件提出来,再提供事件注册接口,再然后是使用修饰器去注册。我觉得这个思路没问题,就是没时间去做,你可以试一试
现在我也没时间了,毕业论文3月10号要交,等这段忙完吧
start.py
Outdated
|
||
print("结果输出到:", os.path.abspath(args.output)) | ||
if args.mail: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个地方可能有问题。因为结束是需要用户出发或者通过其他方式发送INT信号的。
我觉得可以考虑将监控封装成几个标准事件,然后通过传入注册回调的方式实现功能自定义。
比如:
- 被监控进程退出事件(必须是手动指定进程名的模式)
- 被监控进程开启事件(必须是手动指定进程名的模式)
- 第N次扫描事件
然后邮件的内容可能需要简介。咱们可能需要设计一个简单的模板页面,用于邮件的发送。越想越复杂啊。
Hi,
I re-formatted the code of your project, and fixed lots of typos.
Moreover, I added a email notice function, it needs a new package
iMail
.Happy New Years!