0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

pyreboxの作法 その4

Posted at

概要

pyreboxの作法、調べて見た。
侵入検知、やってみる。

方針

プロセスを監視して、あやしいの見つけたら、停める。

写真

Screenshot from 2020-02-16 06-27-30.png

環境

host: debain 9.0 64bit
guest: windows xp sp3 32bit

サンプルコード

calc.exeが見つかったら、shを呼ぶ。

from __future__ import print_function
from ipython_shell import start_shell
from api import CallbackManager

cm = None
pyrebox_print = None

def new_proc(params):
    '''
    Process creation callback. Receives 3 parameters:
    '''
    global pyrebox_print
    global cm
    pid = params["pid"]
    pgd = params["pgd"]
    name = params["name"]
    pyrebox_print("New process: %s" % (name))
    if name == "calc.exe":
        pyrebox_print("kenti sh call.")
        start_shell()

def initialize_callbacks(module_hdl, printer):
    '''
    Initilize callbacks for this module.
    '''
    global cm
    global pyrebox_print
    pyrebox_print = printer
    pyrebox_print("[*]    Initializing callbacks0")
    cm = CallbackManager(module_hdl, new_style = True)
    cm.add_callback(CallbackManager.CREATEPROC_CB, new_proc)
    pyrebox_print("[*]    Initialized callbacks0")

def clean():
    '''
    Clean up everything.
    '''
    global cm
    print("[*]    Cleaning module0")
    cm.clean()
    print("[*]    Cleaned module0")


if __name__ == "__main__":
    print("[*] Loading python module0 %s" % (__file__))



以上。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?