-
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Custom elasticsearch template ip address field.
- Loading branch information
1 parent
0895b0a
commit 26d87d1
Showing
9 changed files
with
399 additions
and
253 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
""" | ||
Copyright 2016 Fedele Mantuano (https://twitter.com/fedelemantuano) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
from .sample_parser import SampleParser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
""" | ||
Copyright 2016 Fedele Mantuano (https://twitter.com/fedelemantuano) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
from abc import ABCMeta, abstractmethod | ||
from .exceptions import InvalidAttachment | ||
|
||
|
||
class AbstractProcessing(object): | ||
|
||
__metaclass__ = ABCMeta | ||
|
||
def __init__(self, **kwargs): | ||
self._kwargs = kwargs | ||
self._check_arguments() | ||
|
||
def __getattr__(self, name): | ||
try: | ||
return self._kwargs[name] | ||
except KeyError: | ||
msg = "'{0}' object has no attribute '{1}'" | ||
raise AttributeError(msg.format(type(self).__name__, name)) | ||
|
||
def __setattr__(self, name, value): | ||
super(AbstractProcessing, self).__setattr__(name, value) | ||
|
||
@abstractmethod | ||
def process(self, attachments): | ||
if not isinstance(attachments, dict): | ||
raise InvalidAttachment("Attachment result is not a dict") | ||
|
||
@abstractmethod | ||
def _check_arguments(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
""" | ||
Copyright 2016 Fedele Mantuano (https://twitter.com/fedelemantuano) | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
""" | ||
|
||
__all__ = ["Base64Error", "TempIOError", "InvalidAttachment", | ||
"VirusTotalApiKeyInvalid", "InvalidContentTypes", "MissingArgument"] | ||
|
||
|
||
class Base64Error(ValueError): | ||
pass | ||
|
||
|
||
class TempIOError(Exception): | ||
pass | ||
|
||
|
||
class InvalidAttachment(ValueError): | ||
pass | ||
|
||
|
||
class VirusTotalApiKeyInvalid(ValueError): | ||
pass | ||
|
||
|
||
class InvalidContentTypes(ValueError): | ||
pass | ||
|
||
|
||
class MissingArgument(ValueError): | ||
pass |
Oops, something went wrong.