Skip to content

Commit

Permalink
--
Browse files Browse the repository at this point in the history
  • Loading branch information
royrusso committed Dec 26, 2024
1 parent 2f9d2c1 commit 4f4637f
Show file tree
Hide file tree
Showing 10 changed files with 116 additions and 42 deletions.
62 changes: 31 additions & 31 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,20 @@
# PROBUS
<div align="center">

# Probus - Network Scanner

[![codecov](https://codecov.io/github/royrusso/probus/graph/badge.svg?token=B972KDOOOB)](https://codecov.io/github/royrusso/probus)
![Tests](https://img.shields.io/github/actions/workflow/status/royrusso/probus/pytests_codecov.yml?label=Tests)
![License](https://img.shields.io/badge/license-Apache%202.0-blue?style=flat-square)

# This project is in early development!

A _FAST_ network monitor and UI that actively scans and alerts you
to network changes, new devices, open ports, and identifies CVEs
(Common Vulnerabilities and Exposures)

## Table of Contents

- [Introduction](#introduction)
- [Features](#features)
- [Installation](#installation)
- [Development](#development)
- [Contributing](#contributing)
- [Contact](#contact)
- [License](#license)
**This project is in early development!**

## Introduction
A network scanner with an attractive UI, that identifies security vulnerabilities in your network and alerts you to new ones as they arise. Scans are performed on a schedule or on-demand.

Probus is a network scanner that identifies security vulnerabilities in your network and alerts you to new ones as they arise. Probus scans your network quickly using a combination of Nmap and a 2-pass scanning technique to identify hosts and open ports.
[Introduction](#bulb-introduction) _ [Key Features](#dart-key-features) _ [Quickstart](#zap-quickstart) _ [Development](#dizzy-development) _ [Contributing](#+1-contributing) \* [Contact](#incoming_envelope-contact)

Probus is platform-agnostic and available as a Docker container.
</div>

### Features:
## :dart: Key Features:

- **Network Scanner:** Asynchronously scans your network for hosts and open ports.
- **Scheduled Scans:** Scans your network on a schedule.
Expand All @@ -35,30 +23,42 @@ Probus is platform-agnostic and available as a Docker container.
- **Alerting:** Alerts you to new vulnerabilities as they arise, new devices added to your network, given a network range.
- **Platform agnostic**: Avilable as a docker container.

## Installation
## :zap: Quickstart

In order to run the commands described below, you need:

- [Docker](https://www.docker.com/)
- [Docker Compose](https://docs.docker.com/compose/)

### Running

1. Linux Installs: Run `docker compose up` to start the application.
2. Mac and Windows Installs: Run `NETWORK_MODE=bridge docker compose up` to start the application.

Download the Docker from: TODO
UI: [http://localhost:8080](http://localhost:8080)

UI is accessible from: [http://localhost:8080](http://localhost:8080).
API: [http://localhost:8000/docs](http://localhost:8000/docs)

Swagger API is accessible from: [http://localhost:8000/docs](http://localhost:8000/docs).
> **Note:** The `NETWORK_MODE=bridge` environment variable is required for Mac and Windows. This is because the default network mode for Docker Compose is `host`, which is not supported on Mac and Windows and Probus requires access to the host network to scan the network.
### Local Installation from Sources
Alternatively, you can create a `.env` file in the root of the project with the following content:

Clone the repository. Then, run `docker compose up --build`.
```bash
NETWORK_MODE=bridge
```

## Development
## :dizzy: Development

Please read the [DEVELOPMENT.md](DEVELOPMENT.md) file for more information on how to run this project locally.
Please read the [DEVELOPMENT.md](DEVELOPMENT.md) file for more information on how to run this project locally and contribute.

## Contributing
## :+1: Contributing

Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for more information on how to contribute to this project.

## Contact
## :incoming_envelope: Contact

- Use **GitHub Issues** for code-related issues.

## License
## :file_cabinet: License

Probus is licensed under the [Apache License 2.0](LICENSE).
6 changes: 3 additions & 3 deletions backend/api/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
router = APIRouter()


@router.get("/", tags=["default"])
def read_root():
return {"Probus says": "Hello World"}
# @router.get("/", tags=["default"])
# def read_root():
# return {"Probus says": "Hello World"}
14 changes: 13 additions & 1 deletion backend/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def probus_openapi_schema():
app.include_router(info.router)
app.include_router(default.router)


app.openapi = probus_openapi_schema

# TODO: We should disable this and reverse proxy through the UI's dev server.
Expand All @@ -58,6 +57,19 @@ def probus_openapi_schema():
allow_headers=["*"],
)


### BEGIN: attempt to serve the frontend via FastAPI so we only have one Docker container
# Fails on serving non-cached assets? Fails on refreshing the page
# class SPAStaticFiles(StaticFiles):
# async def get_response(self, path: str, scope):
# response = await super().get_response(path, scope)
# if response.status_code == 404:
# response = await super().get_response(".", scope)
# return response
# app.mount("/", SPAStaticFiles(directory="frontend/dist", html=True), name="frontend")
## END


if __name__ == "__main__":
"""
If using VSCode, you can run this script in the included FastAPI debug configuration
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ services:
backend:
build:
context: .
dockerfile: docker/Dockerfile-backend
dockerfile: docker/backend.Dockerfile
ports:
- "8000:8000"
privileged: true
#user: root
#network_mode: bridge #TODO: make configurable for linux to use host mode.
user: root
network_mode: ${NETWORK_MODE:-host}
frontend:
build:
context: .
dockerfile: docker/Dockerfile-frontend
dockerfile: docker/frontend.Dockerfile
ports:
- "8080:8080"
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const App = () => {
<Routes>
<Route index element={<Home />} />
<Route path="/results/:profile_id" element={<ScanResults />} />
<Route path="/profiles" element={<Profiles />} />
<Route path="/list_profiles" element={<Profiles />} />
</Routes>
</main>
</>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const Header = () => {
>
<Nav className="me-auto">
<Nav.Link href="/">New Scan</Nav.Link>
<Nav.Link href="/profiles">Profiles</Nav.Link>
<Nav.Link href="/list_profiles">Profiles</Nav.Link>
</Nav>
<Nav className="justify-content-end">
<Nav.Link href="/settings">
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/routes/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const Home = () => {
<h3>
Latest Scans{" "}
<div className="inline-small">
[ <a href="/profiles">View All</a>]
[ <a href="/list_profiles">View All</a>]
</div>
</h3>
</Col>
Expand Down
62 changes: 62 additions & 0 deletions spa_docker_attempt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
### An attempt at serving the frontend and backend from the same container

# Build for Vite frontend
FROM node:23.0.0-alpine AS frontend-builder

WORKDIR /app/frontend

# Copy package.json and package-lock.json to install dependencies
COPY /frontend/package*.json ./

# Install dependencies
RUN npm install

# Copy the rest of the application code
COPY /frontend/. .

# Build the application for production
RUN npm run build

#EXPOSE 8080

#CMD ["npm", "run", "start", "--", "--host"]

# Build for FastAPI backend
FROM python:3.13-slim

WORKDIR /app

# Install gcc and other necessary tools
RUN apt-get update && apt-get install -y \
gcc \
libffi-dev \
&& rm -rf /var/lib/apt/lists/*

# Install nmap
RUN apt-get update && \
apt-get install -y nmap && \
apt-get clean

# Install ping
RUN apt-get update && \
apt-get install -y iputils-ping && \
apt-get clean

COPY backend/requirements.txt requirements.txt

RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application code
COPY . .

EXPOSE 8000

# Run as root for nmap calls.
USER root

# Copy frontend build to backend
COPY --from=frontend-builder /app/frontend/dist /app/frontend/dist

CMD ["uvicorn", "backend.main:app", "--host", "0.0.0.0", "--port", "8000"]


0 comments on commit 4f4637f

Please sign in to comment.