Skip to content

Commit

Permalink
minors
Browse files Browse the repository at this point in the history
  • Loading branch information
Virgula0 committed Jan 13, 2025
1 parent dd81972 commit 9abef41
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ In the project the following files have the described functions:

> [!WARNING]
> The entire software is designed for running on a Linux environment and although the only changes needed for running on another operating system are interface names, some checks may fail due to different environments.
> For example: `detector.py` (https://github.com/Virgula0/nmap-harvester/blob/main/detector.py#L60) contains a check to run with `root` privileges and this check should be commented if the environment is different from Unix.
> For example: `detector.py` (https://github.com/Virgula0/nmap-harvester/blob/main/detector.py#L55) contains a check to run with `root` privileges and this check should be commented if the environment is different from Unix.
> This disclaimer has been inserted because I noticed the usage of other operating systems during the course lectures. Running the `detector.py` on a virtual environment should work because everything is set to run on the `localhost` interface, but even here, the creation of the dataset phases may not work because of interfaces used by pyshark on a virtual machine. A solution can be to create another container and let the 2 isolated container to communicate between them, but this is up to the readers to investigate better eventually.
## Requirements
Expand Down
5 changes: 3 additions & 2 deletions detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ def generate_output(data, anomaly_detected, normal_count, anomaly_count, normal_
return table

def main():
model = joblib.load(MODEL_PATH)
console.print("[bold green][INFO] Model loaded successfully![/bold green]")

if os.geteuid() != 0:
console.print("[bold red]Pyshark needs root privileges for capturing data on interfaces[/bold red]")
sys.exit(-1)

model = joblib.load(MODEL_PATH)
console.print(f"[bold green][INFO] Model loaded successfully! {type(model)}[/bold green]")

if os.path.exists(RUNTIME_CAPTURE):
os.remove(RUNTIME_CAPTURE)

Expand Down

0 comments on commit 9abef41

Please sign in to comment.