-
-
Notifications
You must be signed in to change notification settings - Fork 504
[WIP] Phunter Analyzer, Closes #2286 #2698
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
Conversation
@mlodic Hello, can I get some assistance on how to fix the failing check? |
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 appreciate the creative solution but this is not the solution to the issue raised. This can be an additional observable analyzer for generic phone lookup and you can call it Phone_Checkup or something similar. Please change PR description accordingly
|
||
# General Information | ||
|
||
parsed = phonenumbers.parse(phone_number) |
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.
if the number is not valid (that can happen because the observable type is generic so everything is allowed here), what does this library trigger?
This is important because it would be better to properly manage that error here and do not raise an analyzer error because that would make people believe that there is something wrong in the analyzer itself but the problem was the input. In that case, I would prefer to have a valid result of the analyzer with an explicit message saying that only phone numbers are supported
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0" | ||
|
||
free_lookup_url = f"https://free-lookup.net/{phone_number.replace('+', '')}" | ||
|
||
r = requests.get(free_lookup_url, headers={"user-agent": user_agent}) | ||
|
||
html_body = BeautifulSoup(r.text, "html.parser") | ||
list_info = html_body.findChild("ul", class_="report-summary__list").findAll( | ||
"div" | ||
) | ||
|
||
info_dict = { | ||
k.text.strip(): info.text.strip() if info.text.strip() else "Not found" | ||
for _, (k, info) in enumerate(zip(list_info[::2], list_info[1::2])) | ||
} |
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 wrap this in a separated function and inside a try/except clause. In this way, if this part, for any reason, fails, the other analyzer parts still get the results to the users
spammer = False | ||
|
||
spamcalls_url = f"https://spamcalls.net/en/number/{phone_number}" | ||
|
||
r = requests.get(spamcalls_url, headers={"user-agent": user_agent}) | ||
|
||
spammer = r.status_code == 200 |
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.
same here, separated function
|
||
# Free Lookup | ||
|
||
user_agent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0" |
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 provide this as an optional configurable parameter
I thought I had to look into and re-create the internal workings of Phunter and make it a separate function that could be imported. Sorry if I misunderstood it in any way. 😓 |
Noproblem. My idea was to leverage that tool so we don't have to write and maintain our own one. IntelOwl should be more focused on integration of other tools than on adding our own logic of extraction, if possible. On the other hand, it could make sense to add the code that you created anyway because it is simple. The important thing is that here we should explicitly write in the code and description that it was inspired by Phunter and the name of the analyzer must be changed |
Thank you for the clarification, I'll keep that in mind going forward. Meanwhile, I'll make the necessary changes ASAP. |
This pull request has been marked as stale because it has had no activity for 10 days. If you are still working on this, please provide some updates or it will be closed in 5 days. |
Sorry, been a bit busy lately, will get back to this immediately! |
This pull request has been marked as stale because it has had no activity for 10 days. If you are still working on this, please provide some updates or it will be closed in 5 days. |
This pull request has been closed because it had no updates in 15 days. If you're still working on this fell free to reopen. |
Description
Phunter Analyzer, Closes #2286
Type of change
Checklist
develop
dumpplugin
command and added it in the project as a data migration. ("How to share a plugin with the community")test_files.zip
and you added the default tests for that mimetype in test_classes.py.FREE_TO_USE_ANALYZERS
playbook by following this guide.url
that contains this information. This is required for Health Checks._monkeypatch()
was used in its class to apply the necessary decorators.MockUpResponse
of the_monkeypatch()
method. This serves us to provide a valid sample for testing.Black
,Flake
,Isort
) gave 0 errors. If you have correctly installed pre-commit, it does these checks and adjustments on your behalf.tests
folder). All the tests (new and old ones) gave 0 errors.DeepSource
,Django Doctors
or other third-party linters have triggered any alerts during the CI checks, I have solved those alerts.Important Rules
Raw JSON :-
Screenshot :-