Esempio n. 1
0
    def test_send_data(self, p, q):
        q._get_report.return_value = self.report(
            "tests/files/sample_analysis_storage"
        )

        p.post.return_value.json.return_value = {
            "status": True, "feedback_id": 1,
        }

        feedback = CuckooFeedback()
        cf = CuckooFeedbackObject(
            "message", "*****@*****.**", "name", "company", True
        )
        cf.include_report_web(1)
        cf.include_analysis()
        assert feedback.send_feedback(cf) == 1

        p.post.assert_called_once_with(
            feedback.endpoint,
            data={
                "feedback": mock.ANY,
            },
            files={
                "file": mock.ANY,
            },
            headers=mock.ANY
        )

        # Ensure that the second entry for each file is an open file handle.
        files = p.post.call_args[1]["files"]
        z = zipfile.ZipFile(files["file"])
        assert "Starting analyzer" in z.read("analysis.log")
        assert len(z.read("cuckoo.log")) == 15274
Esempio n. 2
0
    def test_send_data(self, p, q):
        q._get_report.return_value = self.report(
            "tests/files/sample_analysis_storage")

        p.post.return_value.json.return_value = {
            "status": True,
            "feedback_id": 1,
        }

        feedback = CuckooFeedback()
        cf = CuckooFeedbackObject("message", "*****@*****.**", "name",
                                  "company", True)
        cf.include_report_web(1)
        cf.include_analysis()
        assert feedback.send_feedback(cf) == 1

        p.post.assert_called_once_with(feedback.endpoint,
                                       data={
                                           "feedback": mock.ANY,
                                       },
                                       files={
                                           "file": mock.ANY,
                                       },
                                       headers=mock.ANY)

        # Ensure that the second entry for each file is an open file handle.
        files = p.post.call_args[1]["files"]
        z = zipfile.ZipFile(files["file"])
        assert "Starting analyzer" in z.read("analysis.log")
        assert len(z.read("cuckoo.log")) == 15274
Esempio n. 3
0
    def test_include_analysis(self, p):
        p._get_report.return_value = self.report(
            "tests/files/sample_analysis_storage")

        feedback = CuckooFeedbackObject()
        feedback.include_report_web(1)
        feedback.include_analysis(memdump=False)
        assert len(feedback.to_files()) == 1
Esempio n. 4
0
    def test_include_analysis(self, p):
        p._get_report.return_value = self.report(
            "tests/files/sample_analysis_storage"
        )

        feedback = CuckooFeedbackObject()
        feedback.include_report_web(1)
        feedback.include_analysis(memdump=False)
        assert len(feedback.to_files()) == 1