コード例 #1
0
def analyze(conf, input):
    checkConfigRequirements(conf)
    meta = helpers.loadMetadata(__file__)
    data = helpers.parseArtifact(input)
    helpers.checkSupportedType(meta, data["artifactType"])
    response = sendReq(conf, meta, data["value"])
    return prepareResults(response)
コード例 #2
0
def analyze(input):
    meta = helpers.loadMetadata(__file__)
    data = helpers.parseArtifact(input)
    helpers.checkSupportedType(meta, data["artifactType"])
    payload = buildReq(data["value"])
    response = sendReq(meta, payload)
    return prepareResults(response)
コード例 #3
0
def analyze(conf, input):
    checkConfigRequirements(conf)
    meta = helpers.loadMetadata(__file__)
    data = helpers.parseArtifact(input)
    helpers.checkSupportedType(meta, data["artifactType"])
    search = searchFile(data["value"], conf['file_path'])
    results = prepareResults(search)
    return results
コード例 #4
0
    def test_checkSupportedType(self):
        with patch('sys.exit', new=MagicMock()) as mock:
            meta = {"supportedTypes": ["ip", "foo"]}
            result = helpers.checkSupportedType(meta, "ip")
            self.assertTrue(result)
            mock.assert_not_called()

            result = helpers.checkSupportedType(meta, "bar")
            self.assertFalse(result)
            mock.assert_called_once_with(126)
コード例 #5
0
def analyze(conf, input):
    checkConfigRequirements(conf)
    meta = helpers.loadMetadata(__file__)
    data = helpers.parseArtifact(input)
    helpers.checkSupportedType(meta, data["artifactType"])
    request = buildReq(conf, data["artifactType"], data["value"])
    report_url = sendReq(request[0], request[1], request[2])
    time.sleep(10)
    report = getReport(conf, report_url)
    return prepareResults(report.json())
コード例 #6
0
def analyze(config, input):
    meta = helpers.loadMetadata(__file__)
    data = helpers.parseArtifact(input)
    helpers.checkSupportedType(meta, data["artifactType"])
    response = resolve(config, meta, data["value"])
    return prepareResults(response)