forked from b3dr/anti-phishing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.py
45 lines (31 loc) · 875 Bytes
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# coding: utf-8
"""
扫描插件
"""
import os
os.path.join(os.getcwd())
from mlog import logger
class Plugin(object):
def __init__(self, name=None, plugin_id=None, rootpath=None,):
self.rootpath = rootpath
self.name = name
self.plugin_id = plugin_id
if not self.load_plugin():
logger.error("Load plugin %s failed" % name)
else:
logger.debug("Load Plugin %s " % name)
def load_plugin(self):
"""
加载模块
:return:
"""
load_success = False
if os.path.isdir(self.rootpath):
plugin_path = int(os.popen("which " + self.name + " | grep found | wc -l").read())
if plugin_path != 0:
load_success = True
return load_success
def handel_task(self):
pass
def start(self):
pass