コード例 #1
0
ファイル: test_log.py プロジェクト: neveralso/cuckoo
def test_process_json_logging():
    set_cwd(tempfile.mkdtemp())
    cuckoo_create()
    index_yara()
    init_logfile("process-p0.json")

    def process_tasks(instance, maxcount):
        logger("foo bar", action="hello.world", status="success")

    with mock.patch("cuckoo.main.Database"):
        with mock.patch("cuckoo.main.process_tasks") as p1:
            with mock.patch("time.time") as p2:
                p1.side_effect = process_tasks
                p2.return_value = 1484232003
                main.main(
                    ("--cwd", cwd(), "process", "p0"), standalone_mode=False
                )

    assert json.load(open(cwd("log", "process-p0.json"), "rb")) == {
        "asctime": mock.ANY,
        "action": "hello.world",
        "level": "info",
        "message": "foo bar",
        "status": "success",
        "task_id": None,
        "time": 1484232003,
    }
コード例 #2
0
ファイル: test_log.py プロジェクト: songofhack/cuckoo
def test_process_json_logging():
    set_cwd(tempfile.mkdtemp())
    cuckoo_create()
    index_yara()
    init_logfile("process-p0.json")

    def process_tasks(instance, maxcount):
        logger("foo bar", action="hello.world", status="success")

    with mock.patch("cuckoo.main.Database") as p0:
        with mock.patch("cuckoo.main.process_tasks") as p1:
            with mock.patch("time.time") as p2:
                p1.side_effect = process_tasks
                p2.return_value = 1484232003
                main.main(
                    ("--cwd", cwd(), "process", "p0"), standalone_mode=False
                )

    assert json.load(open(cwd("log", "process-p0.json"), "rb")) == {
        "asctime": mock.ANY,
        "action": "hello.world",
        "level": "info",
        "message": "foo bar",
        "status": "success",
        "task_id": None,
        "time": 1484232003,
    }
コード例 #3
0
ファイル: test_apps.py プロジェクト: xuyuuu/cuckoo-forlinux
 def setup(self):
     set_cwd(tempfile.mkdtemp())
     cuckoo_create()
     index_yara()
コード例 #4
0
ファイル: test_apps.py プロジェクト: neveralso/cuckoo
 def setup(self):
     set_cwd(tempfile.mkdtemp())
     cuckoo_create()
     index_yara()