Fetches the whois records from PassiveTotal based on the registered organization. @param email The email to search for in the whois records.
(self, organization)
| 139 | return res |
| 140 | |
| 141 | def get_organization(self, organization): |
| 142 | """ |
| 143 | Fetches the whois records from PassiveTotal based on the registered organization. |
| 144 | @param email The email to search for in the whois records. |
| 145 | """ |
| 146 | parameters = {"field": "organization", "query": organization} |
| 147 | req = requests.get( |
| 148 | self.URL + "whois/search", |
| 149 | params=parameters, |
| 150 | auth=HTTPBasicAuth(self.TOKEN, self.KEY), |
| 151 | ) |
| 152 | |
| 153 | if req.status_code != 200: |
| 154 | self._logger.warning(req.status_code) |
| 155 | self._logger.warning(req.text) |
| 156 | time.sleep(5) |
| 157 | req = requests.get( |
| 158 | self.URL + "whois/search?field=organization&query=" + organization, |
| 159 | auth=HTTPBasicAuth(self.TOKEN, self.KEY), |
| 160 | ) |
| 161 | if req.status_code != 200: |
| 162 | self._logger.error("Second org lookup attempt failed.") |
| 163 | self._logger.error(req.status_code) |
| 164 | self._logger.error(req.text) |
| 165 | return None |
| 166 | |
| 167 | try: |
| 168 | res = json.loads(req.text) |
| 169 | except: |
| 170 | return None |
| 171 | |
| 172 | return res |
| 173 | |
| 174 | def get_whois(self, domain): |
| 175 | """ |