MCPcopy Create free account
hub / github.com/OWASP/Python-Honeypot / insert_to_network_events_queue

Function insert_to_network_events_queue

database/connector.py:108–146  ·  view source on GitHub ↗

insert other network events (port scan, etc..) to network_events_queue Args: network_event: Object of NetworkEvent Class with event parameters network_events_queue: Multiprocessing queue which stores the list of network_events in _dict_ format

(network_event: NetworkEvent, network_events_queue: Queue)

Source from the content-addressed store, hash-verified

106
107
108def insert_to_network_events_queue(network_event: NetworkEvent, network_events_queue: Queue):
109 """
110 insert other network events (port scan, etc..) to network_events_queue
111
112 Args:
113 network_event: Object of NetworkEvent Class with event parameters
114 network_events_queue: Multiprocessing queue which stores the list of
115 network_events in _dict_ format
116
117 Returns:
118 None
119 """
120
121 verbose_info(
122 messages["received_network_event"].format(
123 network_event.ip_dest,
124 network_event.port_dest,
125 network_event.ip_src,
126 network_event.port_src,
127 network_event.machine_name
128 )
129 )
130
131 # Get country of the source IP Address
132 network_event.country_ip_src = byte_to_str(
133 IP2Location.get_country_short(
134 network_event.ip_src
135 )
136 )
137
138 # Get country of the destination IP Address
139 network_event.country_ip_dest = byte_to_str(
140 IP2Location.get_country_short(
141 network_event.ip_dest
142 )
143 )
144
145 network_events_queue.put(network_event.__dict__)
146 return
147
148
149def push_events_queues_to_database(honeypot_events_queue, network_events_queue):

Callers 2

process_packetFunction · 0.90

Calls 3

verbose_infoFunction · 0.90
byte_to_strFunction · 0.90
get_country_shortMethod · 0.80

Tested by 1