Skip to content
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

Seon.io module #1141

Merged
merged 15 commits into from
Mar 27, 2021
Merged

Seon.io module #1141

merged 15 commits into from
Mar 27, 2021

Conversation

krishnasism
Copy link
Contributor

No description provided.

@codecov-io
Copy link

codecov-io commented Feb 13, 2021

Codecov Report

Merging #1141 (879d514) into master (4ffad6a) will decrease coverage by 0.30%.
The diff coverage is 29.18%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1141      +/-   ##
==========================================
- Coverage   50.78%   50.47%   -0.31%     
==========================================
  Files         442      454      +12     
  Lines       35777    36536     +759     
==========================================
+ Hits        18168    18443     +275     
- Misses      17609    18093     +484     
Impacted Files Coverage Δ
spiderfoot/db.py 75.30% <ø> (ø)
modules/sfp_seon.py 14.94% <14.94%> (ø)
test/unit/modules/test_sfp_seon.py 100.00% <100.00%> (ø)
modules/sfp_pageinfo.py 32.35% <0.00%> (-3.14%) ⬇️
modules/sfp_shodan.py 18.37% <0.00%> (-1.63%) ⬇️
modules/sfp_s3bucket.py 22.12% <0.00%> (-0.40%) ⬇️
modules/sfp_binaryedge.py 13.18% <0.00%> (-0.15%) ⬇️
sfcli.py 31.18% <0.00%> (ø)
test/unit/modules/test_sfp_ipapicom.py 60.00% <0.00%> (ø)
... and 13 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4ffad6a...879d514. Read the comment docs.

# Option descriptions
optdescs = {
'api_key': "API Key for seon.io",
'fraud_threshold': 'Minimum fraud score for target to be marked as malicious(0-100)',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing space after malicious.

"MALICIOUS_EMAILADDR",
"EMAILADDR_DELIVERABLE",
"EMAILADDR_UNDELIVERABLE",
"SOCIAL_MEDIAL",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

evt = SpiderFootEvent('TCP_PORT_OPEN', f"{eventData}:{port}", self.__name__, event)
self.notifyListeners(evt)

if resultSet.get('tor'):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These following events should only be reported if they are positive. i.e. I don't think it's valuable to report that something is NOT a VPN, for example, since most things won't be.

for site in socialMediaList:
if resultSet.get('account_details').get(site):
if resultSet.get('account_details').get(site).get('url'):
evt = SpiderFootEvent("SOCIAL_MEDIA", f"{site}: <SFURL> {resultSet.get('account_details').get(site).get('url')} </SFURL>", self.__name__, event)
Copy link
Owner

@smicallef smicallef Feb 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No space after <SFURL> and before </SFURL>.

evt = SpiderFootEvent("PROVIDER_TELCO", resultSet.get('carrier'), self.__name__, event)
self.notifyListeners(evt)

evt = SpiderFootEvent('RAW_RIR_DATA', str(resultSet), self.__name__, event)
Copy link
Owner

@smicallef smicallef Feb 18, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RAW_RIR_DATA should only be reported if data was found. Also, it's only being reported in this elif branch - it should probably be up one further.


# Option descriptions
optdescs = {
'api_key': "API Key for seon.io",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be in the form of <name> API Key.

self.errorState = True
return

if self.errorState:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check should be higher up.


if resultSet.get('country'):
location = ', '.join(filter(None, [resultSet.get('city'), resultSet.get('state_prov'), resultSet.get('country')]))
location += f"\n-Latitude: {resultSet.get('latitude')}\n-Longitude: {resultSet.get('longitude')}"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lat/Lon has its own event type - PHYSICAL_COORDINATES, so should be a separate additional event.

useragent=self.opts['_useragent']
)

return json.loads(res['content'])
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should have the regular 404, 429, etc. checks here before returning and setting errorState if appropriate.


resultSet = data.get('data')
if resultSet:
if resultSet.get('score') >= self.opts['fraud_threshold']:
Copy link
Owner

@smicallef smicallef Mar 11, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using .get() and expecting an integer for comparison, set 0 as the value to be returned in case the key isn't found (e.g. resultSet.get('score', 0), so that you don't raise an exception for trying to compare a None with a number.


if resultSet.get('public_proxy'):
evt = SpiderFootEvent("WEBSERVER_TECHNOLOGY", f"Server is Public Proxy: {resultSet.get('public_proxy')}", self.__name__, event)
self.notifyListeners(evt)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the entity isn't a proxy, etc. will this still result in an event? It should not - i.e. we only want events here if the entity is a proxy, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should not go in if its False

evt = SpiderFootEvent('TCP_PORT_OPEN', f"{eventData}:{port}", self.__name__, event)
self.notifyListeners(evt)

evt = SpiderFootEvent('RAW_RIR_DATA', str(resultSet), self.__name__, event)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RAW_RIR_DATA should only be reported if data was found for the entity.

@smicallef smicallef merged commit d2a4935 into smicallef:master Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants