2023-09-04 12:14:24 +01:00
|
|
|
from primaite.simulator.network.hardware.base import NIC, Node
|
2023-08-31 13:35:56 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
class Computer(Node):
|
|
|
|
|
"""
|
2023-09-01 16:58:21 +01:00
|
|
|
A basic Computer class.
|
2023-08-31 13:35:56 +01:00
|
|
|
|
|
|
|
|
Example:
|
|
|
|
|
>>> pc_a = Computer(
|
|
|
|
|
hostname="pc_a",
|
|
|
|
|
ip_address="192.168.1.10",
|
|
|
|
|
subnet_mask="255.255.255.0",
|
|
|
|
|
default_gateway="192.168.1.1"
|
|
|
|
|
)
|
|
|
|
|
>>> pc_a.power_on()
|
|
|
|
|
|
|
|
|
|
Instances of computer come 'pre-packaged' with the following:
|
|
|
|
|
|
|
|
|
|
* Core Functionality:
|
2023-09-01 16:58:21 +01:00
|
|
|
* ARP
|
|
|
|
|
* ICMP
|
|
|
|
|
* Packet Capture
|
|
|
|
|
* Sys Log
|
2023-08-31 13:35:56 +01:00
|
|
|
* Services:
|
2023-09-01 16:58:21 +01:00
|
|
|
* DNS Client
|
|
|
|
|
* FTP Client
|
|
|
|
|
* LDAP Client
|
|
|
|
|
* NTP Client
|
2023-08-31 13:35:56 +01:00
|
|
|
* Applications:
|
2023-09-01 16:58:21 +01:00
|
|
|
* Email Client
|
|
|
|
|
* Web Browser
|
2023-08-31 13:35:56 +01:00
|
|
|
* Processes:
|
2023-09-01 16:58:21 +01:00
|
|
|
* Placeholder
|
2023-08-31 13:35:56 +01:00
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
def __init__(self, **kwargs):
|
|
|
|
|
super().__init__(**kwargs)
|
|
|
|
|
self.connect_nic(NIC(ip_address=kwargs["ip_address"], subnet_mask=kwargs["subnet_mask"]))
|