Skip to content
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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

mtics
Copy link
Collaborator

@mtics mtics commented Jan 21, 2023

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!

SRM/exporter.py Outdated Show resolved Hide resolved
SRM/__init__.py Outdated
@@ -0,0 +1 @@
from SRM import monitor
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我记得从python3开始应该就不需要配置__init__.py设置包了吧?

Copy link
Collaborator Author

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 -*-
Copy link
Owner

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)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

项目目录下添加一个配置文件吧。在配置文件里进行邮件的配置。尽量避免修改代码

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已经修改,详见下列:

  • 在SRM包中单独创建了一个MAIL类来使用邮件通知;
  • 用户可以通过指令输入相关配置;
  • start.py中仅有两行代码

另外,我希望之后能以修饰器的方式注入,目前看来改动较大

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README中也增加了相关描述

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修饰器也是一种表现形式,前提是需要将事件提出来,再提供事件注册接口,再然后是使用修饰器去注册。我觉得这个思路没问题,就是没时间去做,你可以试一试

Copy link
Collaborator Author

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:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方可能有问题。因为结束是需要用户出发或者通过其他方式发送INT信号的。
我觉得可以考虑将监控封装成几个标准事件,然后通过传入注册回调的方式实现功能自定义。
比如:

  1. 被监控进程退出事件(必须是手动指定进程名的模式)
  2. 被监控进程开启事件(必须是手动指定进程名的模式)
  3. 第N次扫描事件

然后邮件的内容可能需要简介。咱们可能需要设计一个简单的模板页面,用于邮件的发送。越想越复杂啊。

@mtics mtics requested a review from ZhengqiaoWang February 4, 2023 01:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants