-
-
Notifications
You must be signed in to change notification settings - Fork 523
Malshare ingestor #2804
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
Malshare ingestor #2804
Conversation
|
Please review. |
| response = requests.get(download_url) | ||
| response.raise_for_status() | ||
| if not isinstance(response.content, bytes): | ||
| raise ValueError("VT downloaded file is not instance of bytes") |
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.
VT ?
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.
Sorry, misstype. Updated.
| try: | ||
| logger.info(f"Downloading sample {h}") | ||
| download_url = f"{self.url}/api.php?api_key={self._api_key_name}&action=getfile&hash={h}" | ||
| response = requests.get(download_url) |
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.
Can you please use the requests.get params parameter for each of the request parameter ? This avoid longer f-string and I think it's more readable
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.
updated
|
|
||
| def run(self) -> Iterable[Any]: | ||
| req_url = f"{self.url}/api.php?api_key={self._api_key_name}&action=getlist" | ||
| result = requests.get(req_url) |
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.
Can you please use the requests.get params parameter for each of the request parameter ? This avoid longer f-string and I think it's more readable
|
Please pull the latest changes from |
497fb79 to
3a60807
Compare
|
I have pulled the latest changes, but the test is still failing. |
|
I don't think you did it correctly. You need to have this commit in your branch |
|
Should I push a commit to fix the Spamhaus error? |
|
Can you please try pulling again ? Should be solved now hopefully |
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
Signed-off-by: pranjalg1331 <[email protected]>
3a60807 to
43e1dd7
Compare
| def download_sample(self, h): | ||
| try: | ||
| logger.info(f"Downloading sample {h}") | ||
| download_url = f"{self.url}/api.php" |
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.
This is duplicated, I think we can set it as class attribute
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.
created base_url class attribute.
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.
I was thinking about having a class attribute called endpoint that has it's value to api.php.
Then, when making the request you combine self.url and self.endpoint
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.
Got it..Updated
Signed-off-by: pranjalg1331 <[email protected]>
|
|
||
| def download_sample(self, sample_hash: str) -> bytes: | ||
| try: | ||
| logger.info(f"Downloading sample {sample_hash}") |
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.
Please also write a more meaningful log here (different from run), so we can follow the execution flow during debugging.
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.
Updated
Signed-off-by: pranjalg1331 <[email protected]>




Closes #1399
Description
Please include a summary of the change and link to the related issue.
Type of change
Please delete options that are not relevant.
Checklist
developdumpplugincommand and added it in the project as a data migration. ("How to share a plugin with the community")test_files.zipand you added the default tests for that mimetype in test_classes.py.FREE_TO_USE_ANALYZERSplaybook by following this guide.urlthat contains this information. This is required for Health Checks._monkeypatch()was used in its class to apply the necessary decorators.MockUpResponseof the_monkeypatch()method. This serves us to provide a valid sample for testing.# This file is a part of IntelOwl https://github.com/intelowlproject/IntelOwl # See the file 'LICENSE' for copying permission.Black,Flake,Isort) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.testsfolder). All the tests (new and old ones) gave 0 errors.DeepSource,Django Doctorsor other third-party linters have triggered any alerts during the CI checks, I have solved those alerts.Important Rules