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

Code before:

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

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

            resultSet = data.get('result')
            if resultSet:
                if resultSet.get('first_name') and resultSet.get('last_name'):
                    evt = SpiderFootEvent("HUMAN_NAME", f"{resultSet.get('first_name')} {resultSet.get('last_name')}", self.__name__, event)
                    self.notifyListeners(evt)
                if resultSet.get('phone_number'):
                    evt = SpiderFootEvent("PHONE_NUMBER", resultSet.get('phone_number'), self.__name__, event)
                    self.notifyListeners(evt)

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

        elif eventName == "EMAILADDR":
            failedModules = 0
            data = self.queryFlickr(eventData, eventName)
            humanNames = set()
            geoInfos = set()
            if data is None:
                failedModules += 1
            else:
                resultSet = data[0].get('entities')[0].get('data')
                if resultSet:
                    if resultSet.get('realname').get('_content'):
                        humanNames.add(resultSet.get('realname').get('_content'))
                    if resultSet.get('location').get('_content'):
                        geoInfos.add(resultSet.get('location').get('_content'))
                    if resultSet.get('profileurl').get('_content'):
                        evt = SpiderFootEvent("SOCIAL_MEDIA", f"Flickr: <SFURL>{resultSet.get('profileurl').get('_content')}</SFURL>", self.__name__, event)
                        self.notifyListeners(evt)

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

            data = self.querySkype(eventData, eventName)
            if data is None:
                failedModules += 1
            else:
                resultSet = data.get('result')
                if resultSet:
                    resultSet = data.get('result')[0].get('nodeProfileData')
                    if resultSet.get('name'):
                        humanNames.add(resultSet.get('name'))

Review comment (suggestion):
This should be an `ACCOUNT_EXTERNAL_OWNED` event instead - see the sfp_c99 module for how it reports Skype accounts.

Code after:
                resultSet = data[0].get('entities')[0].get('data')
                if resultSet:
                    if resultSet.get('realname').get('_content'):
                        humanNames.add(resultSet.get('realname').get('_content'))
                    if resultSet.get('location').get('_content'):
                        geoInfos.add(resultSet.get('location').get('_content'))
                    if resultSet.get('profileurl').get('_content'):
                        evt = SpiderFootEvent("SOCIAL_MEDIA", f"Flickr: <SFURL>{resultSet.get('profileurl').get('_content')}</SFURL>", self.__name__, event)
                        self.notifyListeners(evt)

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

            data = self.querySkype(eventData)
            if data is None:
                failedModules += 1
            else:
                resultSet = data.get('result')
                if resultSet:
                    resultSet = data.get('result')[0].get('nodeProfileData')
                    if resultSet.get('name'):
                        humanNames.add(resultSet.get('name'))
                    if resultSet.get('skypeId'):
                        evt = SpiderFootEvent("ACCOUNT_EXTERNAL_OWNED", f"Skype [{resultSet.get('skypeId')}]", self.__name__, event)
                        self.notifyListeners(evt)
                        evt = SpiderFootEvent("USERNAME", resultSet.get('skypeId'), self.__name__, event)
                        self.notifyListeners(evt)

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

            data = self.queryLinkedin(eventData)
            if data is None:
                failedModules += 1
            else:
                resultSet = data.get('result')
                if resultSet:
                    resultSet = data.get('result')[0]
                    if resultSet.get('displayName'):
                        humanNames.add(resultSet.get('displayName'))
                    if resultSet.get('location'):
                        geoInfos.add(resultSet.get('location'))
                    if resultSet.get('companyName'):
                        evt = SpiderFootEvent("COMPANY_NAME", resultSet.get('companyName'), self.__name__, event)
                        self.notifyListeners(evt)
                    if resultSet.get('headline'):
                        evt = SpiderFootEvent("JOB_TITLE", resultSet.get('headline'), self.__name__, event)
                        self.notifyListeners(evt)

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