|
|
|
@ -31,7 +31,7 @@ import plugin_ix
|
|
|
|
|
# iregistry = plugins.Registry(meta.__home__)
|
|
|
|
|
|
|
|
|
|
@_cli.command(name='log-intruder')
|
|
|
|
|
def intrusion(path:str='/var/log/auth.log', year:int=datetime.now().year):
|
|
|
|
|
def intrusion(path:str='/var/log/auth.log', year:int=datetime.now().year,debug:bool=False):
|
|
|
|
|
"""
|
|
|
|
|
This function
|
|
|
|
|
"""
|
|
|
|
@ -42,8 +42,10 @@ def intrusion(path:str='/var/log/auth.log', year:int=datetime.now().year):
|
|
|
|
|
try:
|
|
|
|
|
_pointer = getattr(smart.logger,_id)
|
|
|
|
|
_df = _pointer(_r[_id])
|
|
|
|
|
|
|
|
|
|
post(_df,_id)
|
|
|
|
|
if debug :
|
|
|
|
|
print (_df)
|
|
|
|
|
else:
|
|
|
|
|
post(_df,_id)
|
|
|
|
|
except Exception as e:
|
|
|
|
|
print (e)
|
|
|
|
|
pass
|
|
|
|
@ -52,18 +54,21 @@ def intrusion(path:str='/var/log/auth.log', year:int=datetime.now().year):
|
|
|
|
|
print ("Nothing out of the ordinary was found in")
|
|
|
|
|
print (f"{path}")
|
|
|
|
|
@_cli.command(name='top')
|
|
|
|
|
def apply_apps (app:str=None,user:str=None):
|
|
|
|
|
def apply_apps (app:str=None,user:str=None,debug:bool=False):
|
|
|
|
|
"""
|
|
|
|
|
This function looks at applications/commands running on the system
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
_df = smart.top.read(name=app)
|
|
|
|
|
_df = smart.top.read(name=app,user=user)
|
|
|
|
|
_id = 'apps' if not app else app
|
|
|
|
|
# if app :
|
|
|
|
|
# _index = _df.name == app
|
|
|
|
|
# if _index.sum() :
|
|
|
|
|
# _df = _df[_index]
|
|
|
|
|
post(_df,_id)
|
|
|
|
|
if debug :
|
|
|
|
|
print (_df)
|
|
|
|
|
else:
|
|
|
|
|
post(_df,_id)
|
|
|
|
|
|
|
|
|
|
@_cli.command(name='archive')
|
|
|
|
|
def _archive():
|
|
|
|
@ -86,18 +91,24 @@ def _archive():
|
|
|
|
|
"""
|
|
|
|
|
print(_msg)
|
|
|
|
|
@_cli.command(name='folder')
|
|
|
|
|
def apply_folder(path:str):
|
|
|
|
|
def apply_folder(path:str,debug:bool=False):
|
|
|
|
|
"""
|
|
|
|
|
This function will read the content of a folder and generate a
|
|
|
|
|
"""
|
|
|
|
|
_df = smart.folder.read(path=path)
|
|
|
|
|
# print (_df)
|
|
|
|
|
post(_df,'folders')
|
|
|
|
|
if debug :
|
|
|
|
|
print(_df)
|
|
|
|
|
else:
|
|
|
|
|
post(_df,'folders')
|
|
|
|
|
pass
|
|
|
|
|
@_cli.command (name='files')
|
|
|
|
|
def apply_files(folder:str) :
|
|
|
|
|
def apply_files(folder:str,debug:bool=False) :
|
|
|
|
|
_df = smart.files.read(folder)
|
|
|
|
|
post(_df,'files')
|
|
|
|
|
if debug:
|
|
|
|
|
print(_df)
|
|
|
|
|
else:
|
|
|
|
|
post(_df,'files')
|
|
|
|
|
@_cli.command(name='init')
|
|
|
|
|
# @plugins.cli.appr(name='init')
|
|
|
|
|
def apply_signup (email:str,key:str=None,provider:str='sqlite') :
|
|
|
|
@ -120,7 +131,7 @@ def apply_signup (email:str,key:str=None,provider:str='sqlite') :
|
|
|
|
|
else:
|
|
|
|
|
_verb = "updated"
|
|
|
|
|
f = open(os.sep.join([_PATH,'config.json']),'w')
|
|
|
|
|
f.write(json.dumps(_config))
|
|
|
|
|
f.write(json.dumps(_config,indent=2))
|
|
|
|
|
f.close()
|
|
|
|
|
_msg = f"""
|
|
|
|
|
The configuration file was {_verb} successfully at {meta.__home__}
|
|
|
|
|