MCPcopy Create free account
hub / github.com/PierreGode/Ragnar / HostTrafficStats

Class HostTrafficStats

traffic_analyzer.py:114–152  ·  view source on GitHub ↗

Traffic statistics for a single host

Source from the content-addressed store, hash-verified

112 'level': self.level.value,
113 'category': self.category,
114 'message': self.message,
115 'src_ip': self.src_ip,
116 'dst_ip': self.dst_ip,
117 'details': self.details,
118 'timestamp': self.timestamp.isoformat(),
119 'acknowledged': self.acknowledged
120 }
121
122
123@dataclass
124class HostTrafficStats:
125 """Traffic statistics for a single host"""
126 ip: str
127 hostname: Optional[str] = None
128 mac: Optional[str] = None
129 total_packets: int = 0
130 total_bytes: int = 0
131 packets_in: int = 0
132 packets_out: int = 0
133 bytes_in: int = 0
134 bytes_out: int = 0
135 protocols: Dict[str, int] = field(default_factory=dict)
136 ports_contacted: set = field(default_factory=set)
137 ports_targeted: set = field(default_factory=set)
138 sweep_targets: Dict[int, set] = field(default_factory=dict)
139 connections_active: int = 0
140 first_seen: datetime = field(default_factory=datetime.now)
141 last_seen: datetime = field(default_factory=datetime.now)
142 dns_queries: List[str] = field(default_factory=list)
143
144 def to_dict(self) -> Dict[str, Any]:
145 return {
146 'ip': self.ip,
147 'hostname': self.hostname,
148 'mac': self.mac,
149 'total_packets': self.total_packets,
150 'total_bytes': self.total_bytes,
151 'packets_in': self.packets_in,
152 'packets_out': self.packets_out,
153 'bytes_in': self.bytes_in,
154 'bytes_out': self.bytes_out,
155 'protocols': self.protocols,

Callers 2

_update_host_statsMethod · 0.85
_parse_arp_lineMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected