mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-20 23:31:31 +02:00
- Updated the default route for automation to redirect to engines instead of scans. - Removed the scans page and replaced it with a new scans overview page that lists scan history for projects. - Introduced a detailed scan view page to display individual scan results and subdomain discoveries. - Added new enums for scan statuses and subdomain sources to improve code clarity and maintainability. - Implemented a new scan task in Celery to handle scan execution and logging. - Enhanced the database models for scans and subdomains to support new features and improve data integrity. - Updated the worker Dockerfile to include necessary scanning tools and dependencies. - Added utility functions for domain matching and pattern compilation to streamline scan operations.
71 lines
2.1 KiB
Python
71 lines
2.1 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel
|
|
from sqlalchemy import Column
|
|
from sqlalchemy.types import JSON
|
|
from sqlmodel import Field, SQLModel, UniqueConstraint
|
|
|
|
from shared.utils.datetime import utc_now
|
|
|
|
|
|
class Subdomain(SQLModel, table=True):
|
|
__tablename__ = "subdomains"
|
|
__table_args__ = (
|
|
UniqueConstraint("scan_id", "name", name="uq_subdomain_scan_name"),
|
|
)
|
|
|
|
id: uuid.UUID = Field(default_factory=uuid.uuid4, primary_key=True, index=True)
|
|
scan_id: uuid.UUID = Field(foreign_key="scans.id", index=True, ondelete="CASCADE")
|
|
target_id: uuid.UUID = Field(
|
|
foreign_key="targets.id", index=True, ondelete="CASCADE"
|
|
)
|
|
project_id: uuid.UUID = Field(foreign_key="projects.id", index=True)
|
|
|
|
name: str = Field(max_length=500, index=True)
|
|
sources: list = Field(default_factory=list, sa_column=Column(JSON, nullable=False))
|
|
resolved_ips: list = Field(
|
|
default_factory=list, sa_column=Column(JSON, nullable=False)
|
|
)
|
|
cname: str | None = Field(default=None, max_length=500)
|
|
is_active: bool = Field(default=False, index=True)
|
|
is_wildcard: bool = Field(default=False)
|
|
is_excluded: bool = Field(default=False, index=True)
|
|
|
|
discovered_at: datetime = Field(default_factory=utc_now)
|
|
created_at: datetime = Field(default_factory=utc_now)
|
|
|
|
|
|
class SubdomainRead(BaseModel):
|
|
id: uuid.UUID
|
|
scan_id: uuid.UUID
|
|
target_id: uuid.UUID
|
|
name: str
|
|
sources: list[str] = Field(default_factory=list)
|
|
resolved_ips: list[str] = Field(default_factory=list)
|
|
cname: str | None = None
|
|
is_active: bool
|
|
is_wildcard: bool
|
|
is_excluded: bool = False
|
|
discovered_at: datetime
|
|
|
|
|
|
class SubdomainSummary(BaseModel):
|
|
total: int
|
|
active: int
|
|
sources: dict[str, int] = Field(default_factory=dict)
|
|
|
|
|
|
class TargetSubdomainRead(BaseModel):
|
|
name: str
|
|
sources: list[str] = Field(default_factory=list)
|
|
resolved_ips: list[str] = Field(default_factory=list)
|
|
cname: str | None = None
|
|
is_active: bool
|
|
is_wildcard: bool
|
|
is_excluded: bool = False
|
|
scan_count: int
|
|
last_scan_id: uuid.UUID
|
|
first_seen: datetime
|
|
last_seen: datetime
|