insert credentials from honeypot events which are obtained from the module processor to credential_event collection Args: credential_event: Object of CredentialEvent Class with honeypot event credentials Returns: inserted_id
(credential_event: CredentialEvent)
| 195 | |
| 196 | |
| 197 | def insert_to_credential_events_collection(credential_event: CredentialEvent): |
| 198 | """ |
| 199 | insert credentials from honeypot events which are obtained |
| 200 | from the module processor to credential_event collection |
| 201 | |
| 202 | Args: |
| 203 | credential_event: Object of CredentialEvent Class with honeypot |
| 204 | event credentials |
| 205 | |
| 206 | Returns: |
| 207 | inserted_id |
| 208 | """ |
| 209 | credential_event.country_ip_src = byte_to_str( |
| 210 | IP2Location.get_country_short( |
| 211 | credential_event.ip_src |
| 212 | ) |
| 213 | ) |
| 214 | |
| 215 | credential_event.machine_name = network_config["real_machine_identifier_name"] |
| 216 | |
| 217 | verbose_info( |
| 218 | messages["received_honeypot_credential_event"].format( |
| 219 | credential_event.ip_src, |
| 220 | credential_event.username, |
| 221 | credential_event.password, |
| 222 | credential_event.module_name, |
| 223 | credential_event.machine_name |
| 224 | ) |
| 225 | ) |
| 226 | return elasticsearch_events.index(index='credential_events', body=credential_event.__dict__) |
| 227 | |
| 228 | |
| 229 | def insert_to_file_change_events_collection(file_change_event_data: FileEventsData): |