-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change indicators to list instead one value #6
Open
r7-mgorny
wants to merge
2
commits into
master
Choose a base branch
from
MC-231_pull_indicators_from_raw_mail
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -52,13 +52,17 @@ def test_parse_from_raw(self): | |
self.assertEqual(email.recipients, ["[email protected]"]) | ||
self.assertEqual(email.sender, "[email protected]") | ||
self.assertTrue("level 3" in email.body) | ||
self.assertEqual(email.indicators.md5, "a35d0f590b9e2aa1a6afa68880836777") | ||
self.assertEqual( | ||
email.indicators.sha1, "2b725fe68564fb791c5a33f451c3fbf589e1d2e8" | ||
[d.md5 for d in email.indicators], | ||
['b067a7ee9a159b724d5261dc80e03124', 'a35d0f590b9e2aa1a6afa68880836777', 'eae68e9c11349cc5dece3474acd87804', '224662a660009095b8eb905a9c0d6964', '68b329da9893e34099c7d8ad5cb9c940', '4ff3d0db8a6aa37b33bc70492b8d4c2c', '5288a1294c0c2d86ca05027996127aaa'] | ||
) | ||
self.assertEqual( | ||
email.indicators.sha256, | ||
"226a485db0230d4bc95c892f29b7257fee1aefb9ed273ec4cc4abe134a6b8a6b", | ||
[d.sha1 for d in email.indicators], | ||
['f62bfadaea976ecca214a0696188dfa409ba6478', '2b725fe68564fb791c5a33f451c3fbf589e1d2e8', 'b4f3aba8e4cd3a67f2bedd2166bf5e34a403f756', '8da1890238848f6b8f1c776b0699babb0925f256', 'adc83b19e793491b1c6ea0fd8b46cd9f32e592fc', '1f0dede6a71ddb34aefa595c618b380f7ed179ec', '32127d12c2133daa69663f684ff94773cb1fe0fd'] | ||
) | ||
self.assertEqual( | ||
[d.sha256 for d in email.indicators], | ||
['52b97144c63e5a585ba11550d3969e512d2394aca5252a1fbcea625964cdaae3', '226a485db0230d4bc95c892f29b7257fee1aefb9ed273ec4cc4abe134a6b8a6b', 'f05aeb4305d0f98daf964f851960d61daa3a2d73af2bc23140d047a312574ff9', '1950205c6953757c7edc8afa12cf26dc87d5e888a49828c997b404fe5fb51b3b', '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b', 'e8c6adeb2cd035926a6ed70c8097264b56aa0c06cfa387fd9bd0a789b0fe0a00', '20b4681499193a3a5c647c7e6af71f2f2daf7ac9204d3a5d8c203cf84ce27782'], | ||
) | ||
|
||
attached_email = email.attached_emails[0] | ||
|
@@ -67,14 +71,16 @@ def test_parse_from_raw(self): | |
self.assertEqual(attached_email.recipients, ["[email protected]"]) | ||
self.assertTrue("Level 2 body" in attached_email.body) | ||
self.assertEqual( | ||
attached_email.indicators.md5, "224662a660009095b8eb905a9c0d6964" | ||
[d.md5 for d in attached_email.indicators], | ||
['eae68e9c11349cc5dece3474acd87804', '224662a660009095b8eb905a9c0d6964', '68b329da9893e34099c7d8ad5cb9c940', '4ff3d0db8a6aa37b33bc70492b8d4c2c', '5288a1294c0c2d86ca05027996127aaa'] | ||
) | ||
self.assertEqual( | ||
attached_email.indicators.sha1, "8da1890238848f6b8f1c776b0699babb0925f256" | ||
[d.sha1 for d in attached_email.indicators], | ||
['b4f3aba8e4cd3a67f2bedd2166bf5e34a403f756', '8da1890238848f6b8f1c776b0699babb0925f256', 'adc83b19e793491b1c6ea0fd8b46cd9f32e592fc', '1f0dede6a71ddb34aefa595c618b380f7ed179ec', '32127d12c2133daa69663f684ff94773cb1fe0fd'] | ||
) | ||
self.assertEqual( | ||
attached_email.indicators.sha256, | ||
"1950205c6953757c7edc8afa12cf26dc87d5e888a49828c997b404fe5fb51b3b", | ||
[d.sha256 for d in attached_email.indicators], | ||
['f05aeb4305d0f98daf964f851960d61daa3a2d73af2bc23140d047a312574ff9', '1950205c6953757c7edc8afa12cf26dc87d5e888a49828c997b404fe5fb51b3b', '01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b', 'e8c6adeb2cd035926a6ed70c8097264b56aa0c06cfa387fd9bd0a789b0fe0a00', '20b4681499193a3a5c647c7e6af71f2f2daf7ac9204d3a5d8c203cf84ce27782'] | ||
) | ||
|
||
attached_email_of_attached_email = attached_email.attached_emails[0] | ||
|
@@ -105,13 +111,17 @@ def test_parse_from_raw2(self): | |
self.assertEqual(email.account, TEST_MAILBOX_ID) | ||
self.assertEqual(email.subject, "Attachment") | ||
self.assertTrue("Attachment Body" in email.body) | ||
self.assertEqual(email.indicators.md5, "267cc9490cec0c3229795e5eb7ef2a25") | ||
self.assertEqual( | ||
email.indicators.sha1, "e62d99edae16e70bfcf9bd041c08afd183271c56" | ||
[d.md5 for d in email.indicators], | ||
['efb42a638c23407056c48ebab5e119eb', '267cc9490cec0c3229795e5eb7ef2a25', '6f3a888cc847bb3fc76f55bf9a4c1781', 'd8fbc36661e49768c7db3160afdeaf70'] | ||
) | ||
self.assertEqual( | ||
[d.sha1 for d in email.indicators], | ||
['057858fe08a55ad2d1e4ee4a2d26a88a6a954691', 'e62d99edae16e70bfcf9bd041c08afd183271c56', '18ada0598635438ea49a305102b6d6e84e6afaa7', 'bfccda3b5ade42569e05753fa1ad1f05c4ce2095'] | ||
) | ||
self.assertEqual( | ||
email.indicators.sha256, | ||
"aae84980564cc107ea5ef7c3ea393fb18d678fea5956b7b5005f8ae7664bf78c", | ||
[d.sha256 for d in email.indicators], | ||
['91557d129de7ce80a6ac78f6c17a9d5aec7ff4dc777f1f0e69d3b2f1568a5cb1', 'aae84980564cc107ea5ef7c3ea393fb18d678fea5956b7b5005f8ae7664bf78c', 'd5ef2912c4b28072c1f9df611f87b683c1b31cfb609f5d4f09be5abaf8c6bf18', 'b6ef02bc495b3710bd822a789e2b916c610b6fc78aab1f5a82bb2676fd6ad664'] | ||
) | ||
self.assertEqual(len(email.attached_emails), 1) | ||
self.assertEqual(len(email.attached_files), 0) | ||
|
@@ -120,14 +130,16 @@ def test_parse_from_raw2(self): | |
attached_email = email.attached_emails[0] | ||
self.assertTrue("Test Message Attachment Body" in attached_email.body) | ||
self.assertEqual( | ||
attached_email.indicators.md5, "d8fbc36661e49768c7db3160afdeaf70" | ||
[d.md5 for d in attached_email.indicators], | ||
['6f3a888cc847bb3fc76f55bf9a4c1781', 'd8fbc36661e49768c7db3160afdeaf70'] | ||
) | ||
self.assertEqual( | ||
attached_email.indicators.sha1, "bfccda3b5ade42569e05753fa1ad1f05c4ce2095" | ||
[d.sha1 for d in attached_email.indicators], | ||
['18ada0598635438ea49a305102b6d6e84e6afaa7', 'bfccda3b5ade42569e05753fa1ad1f05c4ce2095'] | ||
) | ||
self.assertEqual( | ||
attached_email.indicators.sha256, | ||
"b6ef02bc495b3710bd822a789e2b916c610b6fc78aab1f5a82bb2676fd6ad664", | ||
[d.sha256 for d in attached_email.indicators], | ||
['d5ef2912c4b28072c1f9df611f87b683c1b31cfb609f5d4f09be5abaf8c6bf18', 'b6ef02bc495b3710bd822a789e2b916c610b6fc78aab1f5a82bb2676fd6ad664'] | ||
) | ||
|
||
self.assertEqual(email.date_received, "Tue, 6 Aug 2019 19:19:40 +0000") | ||
|
@@ -192,13 +204,17 @@ def test_parse_from_raw4(self): | |
</html> | ||
""" | ||
self.assertEqual(email.body, expected_body) | ||
self.assertEqual(email.indicators.md5, "c537b7db873e8e2cd6b965be6afdd063") | ||
self.assertEqual( | ||
email.indicators.sha1, "b1f5dd056c0930042fa5549b4c5c8aa6ecb70e3a" | ||
[d.md5 for d in email.indicators], | ||
['99d3bb8f3b3d3e51dc40b749174f9f90', 'c537b7db873e8e2cd6b965be6afdd063'] | ||
) | ||
self.assertEqual( | ||
email.indicators.sha256, | ||
"50b779af79f6493165c0b8de3e56c08e0cc3eec3c50e2f9f2ddfe80247b8e886", | ||
[d.sha1 for d in email.indicators], | ||
['9c9ac62540543d3b20722f1fabb31b3a363547b7', 'b1f5dd056c0930042fa5549b4c5c8aa6ecb70e3a'] | ||
) | ||
self.assertEqual( | ||
[d.sha256 for d in email.indicators], | ||
['9b3ba7c8a896fba147e01cc5ea7416707b668d674200b6b4d754248f96310438', '50b779af79f6493165c0b8de3e56c08e0cc3eec3c50e2f9f2ddfe80247b8e886'] | ||
) | ||
self.assertEqual(email.date_received, "Thu, 8 Aug 2019 21:19:37 +0000") | ||
self.assertEqual(len(email.headers), 76) | ||
|
@@ -229,13 +245,17 @@ def test_parse_from_raw_evil_email(self): | |
], | ||
) | ||
self.assertEqual(email.sender, "[email protected]") | ||
self.assertEqual(email.indicators.md5, "1f224c7839c3f7d825864f322a6bb57a") | ||
self.assertEqual( | ||
email.indicators.sha1, "83dfe966303673168c344c286bb16d2801d1919f" | ||
[d.md5 for d in email.indicators], | ||
['91d6dc1ec546d719e4eaddb46cfc47c2', '1f224c7839c3f7d825864f322a6bb57a', '37f34918dfbed1979275686b65d572c9', '074480fdee5ca23a2dfde056f248eb8f', '907729a50f97b5da110eedc1555f77de', 'd6a82ae5b3ab8b85a2b2ea6bdff5c2fa', '7eebac1ee4a603f1e1e9cedae18e23b4', 'b2c83a9ce3b0e272f219376a91d643be', '9a160749c91a0f1fbd91edb6b6b43fa7', '885d96a24039dbdf336748df9fa08b48'] | ||
) | ||
self.assertEqual( | ||
[d.sha1 for d in email.indicators], | ||
['eff5fc65becb9a7ef1732b1432715ff0c8d78276', '83dfe966303673168c344c286bb16d2801d1919f', '51f435e29cae0fd70e196c5b2b11f4db66c40f43', 'cd8965f9fc5519776c014ed27b8d5f6d7c0b16d2', '0f6893f573a5ec144411a513c154b4cd3a988975', '849c94583692c1f5b76bd3285e07083a71963f94', '1ff7f7880f96a79e61d65cad0daf532145cd0ed7', '8c65f765413465dd8ba9d24c29d95370b6a4fccb', 'e7e143b11126941f6fe17b4f2873d4b8972d5b70', '19b0930b78551044f87fae9b31d27fc7499a605d'] | ||
) | ||
self.assertEqual( | ||
email.indicators.sha256, | ||
"251ac384891e16088f0be97cf6a872559fd287f1e163e4b83f6b49b8ad6862b8", | ||
[d.sha256 for d in email.indicators], | ||
['4e7728bf05c87767efa7ca46f3ff5322d12899747905938cf1db85d966c878f3', '251ac384891e16088f0be97cf6a872559fd287f1e163e4b83f6b49b8ad6862b8', '972435f55a4c05660671788c6f9d057f8d206c623c5c100b29ce877899e9793d', 'c116993e5b12738cb974180caa01a34b89b9485790882778ca67fa0750b094d6', '661683f1bee1c0d4556ee5cd9b197cbb39c04da48adf9d8483717d1790863739', 'a600775a1b81fb63b2572f2c5b5b718a059da4412b28b0cd40cde2a07cb66806', '33d352f4ba43792e366e330cf9c8ac9fe9d8da55972504629742330449701a35', 'd3ccc5a5e58aebe7e2dddbfecda746accf08d2294572a791bee3b8c9404b73fe', '2956991d59472e5995189a3f7f5af52c0de9cefcfaf1824631f4c47239aa5f6a', 'a7cb0f9d5f5036d44eb2464458e3a264c0cac33c6f113f25b2eab451381bff2c'] | ||
) | ||
|
||
def test_parse_google_link_garbled(self): | ||
|
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that going to return the whole body instead of just the indicator?