Repository: smicallef/spiderfoot
File: modules/sfp_seon.py (Python)

Code before:
            if data is None:
                return None

            resultSet = data.get('data')
            if resultSet:
                if resultSet.get('score') >= self.opts['fraud_threshold']:
                    maliciousDesc = f"SEON [{eventData}]\n - FRAUD SCORE: {resultSet.get('score')}"
                    evt = SpiderFootEvent("MALICIOUS_PHONE_NUMBER", maliciousDesc, self.__name__, event)
                    self.notifyListeners(evt)

                if resultSet.get('account_details'):
                    socialMediaList = resultSet.get('account_details').keys()
                    for site in socialMediaList:
                        if resultSet.get('account_details').get(site).get('registered'):
                            evt = SpiderFootEvent("SOCIAL_MEDIA", f"Registered on {site}", self.__name__, event)
                            self.notifyListeners(evt)

                if resultSet.get('type'):
                    evt = SpiderFootEvent("PHONE_NUMBER_TYPE", resultSet.get('type'), self.__name__, event)
                    self.notifyListeners(evt)

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

            evt = SpiderFootEvent('RAW_RIR_DATA', str(resultSet), self.__name__, event)
            self.notifyListeners(evt)

# End of sfp_seon class


Review comment (suggestion):
`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.

Code after:
                if resultSet.get('account_details'):
                    socialMediaList = resultSet.get('account_details').keys()
                    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)
                                self.notifyListeners(evt)
                            elif resultSet.get('account_details').get(site).get('registered'):
                                evt = SpiderFootEvent("SOCIAL_MEDIA", f"Registered on {site}", self.__name__, event)
                                self.notifyListeners(evt)
                            dataFound = True

                            if site == 'linkedin':
                                if resultSet.get('account_details').get(site).get('company'):
                                    evt = SpiderFootEvent("COMPANY_NAME", resultSet.get('account_details').get(site).get('company'), self.__name__, event)
                                    self.notifyListeners(evt)
                                    dataFound = True

                                if resultSet.get('account_details').get(site).get('name'):
                                    evt = SpiderFootEvent("HUMAN_NAME", resultSet.get('account_details').get(site).get('name'), self.__name__, event)
                                    self.notifyListeners(evt)
                                    dataFound = True

                if resultSet.get('breach_details').get('breaches'):
                    breachList = resultSet.get('breach_details').get('breaches')
                    for breachSet in breachList:
                        evt = SpiderFootEvent("EMAILADDR_COMPROMISED", f"{eventData} [{breachSet.get('name')}]", self.__name__, event)
                        self.notifyListeners(evt)
                        dataFound = True

                if dataFound:
                    evt = SpiderFootEvent('RAW_RIR_DATA', str(resultSet), self.__name__, event)
                    self.notifyListeners(evt)

        elif eventName == "PHONE_NUMBER":
            data = self.query(eventData, eventName)
            if data is None:
                return None

            resultSet = data.get('data')
            if resultSet:
                if resultSet.get('score') >= self.opts['fraud_threshold']:
                    maliciousDesc = f"SEON [{eventData}]\n - FRAUD SCORE: {resultSet.get('score')}"
                    evt = SpiderFootEvent("MALICIOUS_PHONE_NUMBER", maliciousDesc, self.__name__, event)
                    self.notifyListeners(evt)
                    dataFound = True

                if resultSet.get('account_details'):
                    socialMediaList = resultSet.get('account_details').keys()
                    for site in socialMediaList:
                        if resultSet.get('account_details').get(site).get('registered'):