Projects STRLCPY Sirius Commits f4cbf20f
🤬
  • API/.DS_Store
    Binary file.
  • ■ ■ ■ ■ ■
    API/API/APIHandler.go
    skipped 18 lines
    19 19   
    20 20   "github.com/gin-gonic/gin"
    21 21   
    22  - //coreAPI "github.com/0sm0s1z/Sirius-Scan/API/core"
     22 + coreAPI "github.com/0sm0s1z/Sirius-Scan/API/core"
    23 23   hostAPI "github.com/0sm0s1z/Sirius-Scan/API/hosts"
     24 + scanAPI "github.com/0sm0s1z/Sirius-Scan/API/scan"
    24 25   siriusDB "github.com/0sm0s1z/Sirius-Scan/lib/db"
     26 + siriusHelper "github.com/0sm0s1z/Sirius-Scan/lib/utils"
    25 27  )
    26 28   
    27 29  func GetHost(c *gin.Context) {
    skipped 5 lines
    33 35   
    34 36   //Get the host data from the database
    35 37   var result siriusDB.SVDBHost
    36  - result = hostAPI.GetHost(hostRequest)
     38 + result, err := hostAPI.GetHost(hostRequest)
     39 + if err != nil {
     40 + log.Println("Error retrieving result from DB")
     41 + }
    37 42   
    38 43   c.IndentedJSON(http.StatusOK, result)
    39 44  }
    skipped 18 lines
    58 63  func GetStatus(c *gin.Context) {
    59 64   
    60 65   //Get the status of the API from the database
    61  - result := "asdf"
    62  - //result := coreAPI.GetStatus()
     66 + var result coreAPI.SystemStatus
     67 + result = coreAPI.GetStatus()
    63 68   
    64 69   //Hardcode result for now
    65  - //result = coreAPI.SystemStatus{Status: "Initializing"}
     70 + //result := coreAPI.SystemStatus{Status: "Initializing"}
    66 71   
    67 72   c.IndentedJSON(http.StatusOK, result)
    68 73  }
    69 74   
     75 +func NewScan(c *gin.Context) {
     76 + //Get Scan Profile from Request
     77 + var request scanAPI.ScanRequest
     78 + if c.ShouldBind(&request) == nil {
     79 + //log.Println("Request Received")
     80 + }
     81 + 
     82 + scanID := "scan-" + siriusHelper.RandomString(10)
     83 + request.ScanID = scanID
     84 + 
     85 + scanAPI.NewScan(request)
     86 + 
     87 + c.IndentedJSON(http.StatusOK, scanID)
     88 +}
     89 + 
     90 +/* SCAN API */
     91 +func GetScanReport(c *gin.Context) {
     92 + var scanRequest scanAPI.ScanRequest
     93 + 
     94 + if c.ShouldBind(&scanRequest) != nil {
     95 + log.Println("Scan Report Failed for: ", scanRequest.ScanID)
     96 + }
     97 + 
     98 + //Get the report data from the database
     99 + scanRequest = scanAPI.GetScanReport(scanRequest.ScanID)
     100 + 
     101 + c.IndentedJSON(http.StatusOK, scanRequest)
     102 +}
     103 + 
  • ■ ■ ■ ■ ■ ■
    API/API/ModuleTester.go
     1 +package APIHandler
     2 + 
     3 +import (
     4 + "bytes"
     5 + "encoding/json"
     6 + "log"
     7 + "net/http"
     8 + 
     9 + scanAPI "github.com/0sm0s1z/Sirius-Scan/API/scan"
     10 + siriusHelper "github.com/0sm0s1z/Sirius-Scan/lib/utils"
     11 + "github.com/gin-gonic/gin"
     12 + "github.com/streadway/amqp"
     13 +)
     14 + 
     15 +func failOnError(err error, msg string) {
     16 + if err != nil {
     17 + log.Fatalf("%s: %s", msg, err)
     18 + }
     19 +}
     20 + 
     21 +//API Call to test any function
     22 +func TestFunction(c *gin.Context) {
     23 + 
     24 + //Get the status of the API from the database
     25 + //var result SystemStatus
     26 + result := "OK"
     27 + 
     28 + conn, err := amqp.Dial("amqp://guest:guest@rabbitmq:5672/")
     29 + failOnError(err, "Failed to connect to RabbitMQ")
     30 + defer conn.Close()
     31 + 
     32 + ch, err := conn.Channel()
     33 + failOnError(err, "Failed to open a channel")
     34 + defer ch.Close()
     35 + 
     36 + q, err := ch.QueueDeclare(
     37 + "scan", // name
     38 + false, // durable
     39 + false, // delete when unused
     40 + false, // exclusive
     41 + false, // no-wait
     42 + nil, // arguments
     43 + )
     44 + failOnError(err, "Failed to declare a queue")
     45 + 
     46 + var request scanAPI.ScanRequest
     47 + if c.ShouldBind(&request) == nil {
     48 + //log.Println("Request Received")
     49 + }
     50 + 
     51 + var scanJob scanAPI.ScanRequest
     52 + scanID := "scan-" + siriusHelper.RandomString(10)
     53 + 
     54 + scanJob.ScanID = scanID
     55 + scanJob.Command = "new"
     56 + scanJob.Targets = request.Targets
     57 + 
     58 + body, error := json.Marshal(scanJob)
     59 + if error != nil {
     60 + log.Fatal(error)
     61 + }
     62 + 
     63 + err = ch.Publish(
     64 + "", // exchange
     65 + q.Name, // routing key
     66 + false, // mandatory
     67 + false, // immediate
     68 + amqp.Publishing{
     69 + ContentType: "application/json",
     70 + Body: body,
     71 + })
     72 + log.Println("=== Requesting Scan ===")
     73 + failOnError(err, "Failed to publish a message")
     74 + 
     75 + c.IndentedJSON(http.StatusOK, result)
     76 +}
     77 + 
     78 +func serialize(msg scanAPI.ScanRequest) ([]byte, error) {
     79 + var b bytes.Buffer
     80 + encoder := json.NewEncoder(&b)
     81 + err := encoder.Encode(msg)
     82 + return b.Bytes(), err
     83 +}
     84 + 
     85 +func deserialize(b []byte) (scanAPI.ScanRequest, error) {
     86 + var msg scanAPI.ScanRequest
     87 + buf := bytes.NewBuffer(b)
     88 + decoder := json.NewDecoder(buf)
     89 + err := decoder.Decode(&msg)
     90 + return msg, err
     91 +}
     92 + 
  • ■ ■ ■ ■ ■ ■
    API/API/core/BuildDatabase.go
     1 +package coreAPI
     2 + 
     3 +import (
     4 + "bytes"
     5 + "encoding/json"
     6 + "fmt"
     7 + "io"
     8 + "log"
     9 + "net/http"
     10 + "os"
     11 + "os/exec"
     12 + "strings"
     13 + 
     14 + siriusDB "github.com/0sm0s1z/Sirius-Scan/lib/db"
     15 +)
     16 + 
     17 +//BuildDetails
     18 +type BuildDetails struct {
     19 + NVDLink string `json:"nvd_link"`
     20 + Status string `json:"status"`
     21 +}
     22 + 
     23 +//BuildDatabase builds the vulnerability database from the NVD
     24 +//This function is called from SetStatus if the current status is unset (first run)
     25 +//This function downloads the NVD data, parses it, and inserts it into the database by calling AddVuln
     26 +func BuildDatabase() {
     27 + log.Println("Building the vulnerability database")
     28 + 
     29 + //NVD Download URLS
     30 + nvdDetails := []BuildDetails{
     31 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2023.json.gz", Status: "Downloading NVD data: 2023"},
     32 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2022.json.gz", Status: "Downloading NVD data: 2022"},
     33 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2021.json.gz", Status: "Downloading NVD data: 2021"},
     34 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2020.json.gz", Status: "Downloading NVD data: 2020"},
     35 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2019.json.gz", Status: "Downloading NVD data: 2019"},
     36 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2018.json.gz", Status: "Downloading NVD data: 2018"},
     37 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2017.json.gz", Status: "Downloading NVD data: 2017"},
     38 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2016.json.gz", Status: "Downloading NVD data: 2016"},
     39 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2015.json.gz", Status: "Downloading NVD data: 2015"},
     40 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2014.json.gz", Status: "Downloading NVD data: 2014"},
     41 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2013.json.gz", Status: "Downloading NVD data: 2013"},
     42 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2012.json.gz", Status: "Downloading NVD data: 2012"},
     43 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2011.json.gz", Status: "Downloading NVD data: 2011"},
     44 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2010.json.gz", Status: "Downloading NVD data: 2010"},
     45 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2009.json.gz", Status: "Downloading NVD data: 2009"},
     46 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2008.json.gz", Status: "Downloading NVD data: 2008"},
     47 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2007.json.gz", Status: "Downloading NVD data: 2007"},
     48 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2006.json.gz", Status: "Downloading NVD data: 2006"},
     49 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2005.json.gz", Status: "Downloading NVD data: 2005"},
     50 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2004.json.gz", Status: "Downloading NVD data: 2004"},
     51 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2003.json.gz", Status: "Downloading NVD data: 2003"},
     52 + {NVDLink: "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-2002.json.gz", Status: "Downloading NVD data: 2002"},
     53 + }
     54 + 
     55 + //For each NVD URL download the data
     56 + for i := 0; i <= 21; i++ {
     57 + //Download the NVD data
     58 + filename := strings.Split(nvdDetails[i].NVDLink, "/")[len(strings.Split(nvdDetails[i].NVDLink, "/"))-1]
     59 + log.Println("Downloading NVD: " + filename)
     60 + out, err := os.Create("tmp/" + filename)
     61 + if err != nil {
     62 + log.Println(err)
     63 + }
     64 + defer out.Close()
     65 + 
     66 + resp, err := http.Get(nvdDetails[i].NVDLink)
     67 + if err != nil {
     68 + log.Println(err)
     69 + }
     70 + defer resp.Body.Close()
     71 + 
     72 + _, err = io.Copy(out, resp.Body)
     73 + if err != nil {
     74 + log.Println(err)
     75 + }
     76 + 
     77 + //Extract the NVD data
     78 + cmd := exec.Command("/bin/gunzip", "tmp/"+filename)
     79 + stdout, err := cmd.Output()
     80 + if err != nil {
     81 + fmt.Println(err.Error())
     82 + return
     83 + }
     84 + fmt.Println(string(stdout))
     85 + 
     86 + newStatus := SystemStatus{
     87 + Profile: "root",
     88 + Status: "Initializing",
     89 + Tasks: []SystemTask{
     90 + {
     91 + TaskID: "1",
     92 + TaskName: nvdDetails[i].Status,
     93 + TaskStatus: "10",
     94 + TaskProgress: i * 1,
     95 + },
     96 + },
     97 + }
     98 + SetStatus(newStatus)
     99 + }
     100 + 
     101 + progress := 58
     102 + //For each NVD file extract the data and insert into the database
     103 + for _, nvdDetail := range nvdDetails {
     104 + filename := strings.Split(nvdDetail.NVDLink, "/")[len(strings.Split(nvdDetail.NVDLink, "/"))-1]
     105 + filename = strings.Replace(filename, ".gz", "", -1)
     106 + 
     107 + //Extract the NVD data
     108 + dat, err := os.ReadFile("tmp/" + filename)
     109 + if err != nil {
     110 + log.Println(err)
     111 + }
     112 + 
     113 + //Parse the NVD data
     114 + var responseObject NVDVulnerablityList
     115 + json.Unmarshal(dat, &responseObject)
     116 + var vuln siriusDB.SVDBEntry
     117 + 
     118 + for i := 0; i < len(responseObject.CVEItems); i++ {
     119 + fmt.Println("================")
     120 + 
     121 + vuln.CVEDataType = responseObject.CVEItems[i].CVE.DataType
     122 + vuln.CVEDataFormat = responseObject.CVEItems[i].CVE.DataFormat
     123 + 
     124 + vuln.CVEDataMeta.ID = responseObject.CVEItems[i].CVE.CVEDataMeta.ID
     125 + vuln.CVEDataMeta.ASSIGNER = responseObject.CVEItems[i].CVE.CVEDataMeta.ASSIGNER
     126 + vuln.Description = responseObject.CVEItems[i].CVE.Description
     127 + vuln.CVSSV3 = responseObject.CVEItems[i].Impact.BaseMetricV3.CVSSV3
     128 + 
     129 + for j := 0; j < len(responseObject.CVEItems[i].Configurations.Nodes); j++ {
     130 + vuln.CPE = responseObject.CVEItems[i].Configurations.Nodes[j]
     131 + }
     132 + 
     133 + for j := 0; j < len(responseObject.CVEItems[i].CVE.References.ReferenceData); j++ {
     134 + vuln.References = append(vuln.References, responseObject.CVEItems[i].CVE.References.ReferenceData[j].URL)
     135 + }
     136 + 
     137 + b, err := json.Marshal(vuln)
     138 + if err != nil {
     139 + fmt.Println(err)
     140 + return
     141 + }
     142 + fmt.Println(string(b))
     143 + 
     144 + //Add Vulnerability Definition to SVDB
     145 + resp, err := http.Post("http://localhost:8080/api/svdb/new/vuln", "application/json", bytes.NewBuffer(b))
     146 + 
     147 + if err != nil {
     148 + log.Fatal(err)
     149 + }
     150 + 
     151 + var res map[string]interface{}
     152 + json.NewDecoder(resp.Body).Decode(&res)
     153 + fmt.Println(res["json"])
     154 + 
     155 + //Clear Vuln Entry
     156 + vuln = siriusDB.SVDBEntry{}
     157 + 
     158 + }
     159 + //Get year from filename
     160 + year := strings.Split(filename, "-")[len(strings.Split(filename, "-"))-1]
     161 + year = strings.Replace(year, ".json", "", -1)
     162 + 
     163 + progress = progress + 3
     164 + 
     165 + //Update the status
     166 + newStatus := SystemStatus{
     167 + Profile: "root",
     168 + Status: "Initializing",
     169 + Tasks: []SystemTask{
     170 + {
     171 + TaskID: "1",
     172 + TaskName: "Building Vulnerability Database: " + year,
     173 + TaskStatus: "10",
     174 + TaskProgress: progress,
     175 + },
     176 + },
     177 + }
     178 + SetStatus(newStatus)
     179 + }
     180 + 
     181 + //Clean up the NVD data
     182 + exec.Command("/bin/rm", "tmp/*.json")
     183 + 
     184 + //Update the status
     185 + newStatus := SystemStatus{
     186 + Profile: "root",
     187 + Status: "OK",
     188 + Tasks: []SystemTask{
     189 + {
     190 + TaskID: "1",
     191 + TaskName: "Welcome to Sirius",
     192 + },
     193 + },
     194 + }
     195 + SetStatus(newStatus)
     196 + 
     197 + //Parse the NVD data
     198 + //Insert the NVD data into the database
     199 + 
     200 +}
     201 + 
     202 +type NVDVulnerablityList struct {
     203 + CVEDataType string `json:"CVE_data_type"`
     204 + CVEDataFormat string `json:"CVE_data_format"`
     205 + CVEDataVersion string `json:"CVE_data_version"`
     206 + CVEDataNumberOfCVEs string `json:"CVE_data_numberOfCVEs,omitempty"`
     207 + CVEDataTimestamp string `json:"CVE_data_timestamp"`
     208 + CVEItems []siriusDB.CVEItem `json:"CVE_Items,omitempty"`
     209 +}
     210 + 
  • ■ ■ ■ ■ ■ ■
    API/API/core/GetStatus.go
    1 1  package coreAPI
    2 2   
    3 3  import (
     4 + "context"
    4 5   _ "encoding/json"
    5 6   _ "errors"
    6  - "log"
     7 + "fmt"
    7 8   
    8  - coreAPI "github.com/0sm0s1z/Sirius-Scan/API/core"
     9 + "go.mongodb.org/mongo-driver/bson"
     10 + "go.mongodb.org/mongo-driver/mongo"
     11 + 
    9 12   svdbAPI "github.com/0sm0s1z/Sirius-Scan/API/svdb"
    10 13  )
    11 14   
    12 15  //GetStatus collects the status from the database and returns it to the caller
    13  -func GetStatus() coreAPI.SystemStatus {
    14  - log.Println("Getting System Status")
    15  - 
     16 +func GetStatus() SystemStatus {
    16 17   //Connect to the Database
    17  - client := svdbAPI.DatabaseConnect()
     18 + client, ctx := svdbAPI.DatabaseConnect()
    18 19   
    19 20   //Get the status collection
    20  -
     21 + statusCollection := client.Database("Sirius").Collection("Status")
    21 22   
    22  - //statusCollection := client.Database("sirius").Collection("status")
     23 + var status SystemStatus
     24 + err := statusCollection.FindOne(context.TODO(), bson.D{{"profile", "root"}}).Decode(&status)
     25 + if err != nil {
     26 + if err == mongo.ErrNoDocuments {
     27 + // Set the status to Initializing
     28 + fmt.Println("Initializing the vulnerability database")
    23 29   
     30 + initStatus := SystemStatus{
     31 + Profile: "root",
     32 + Status: "init",
     33 + Tasks: []SystemTask{
     34 + {
     35 + TaskID: "1",
     36 + TaskName: "Initializing",
     37 + TaskStatus: "Downloading Base Vulnerability Database from NVD...",
     38 + TaskProgress: 10,
     39 + },
     40 + },
     41 + }
    24 42   
     43 + SetStatus(initStatus)
     44 + //status = SystemStatus{Status: "Initializing"}
     45 + }
     46 + }
     47 + defer client.Disconnect(ctx)
    25 48   
    26 49   //Get the status of the API from the database
    27  - var result coreAPI.SystemStatus
    28  - 
    29  - 
    30  - 
    31  - //Hardcode result for now
    32  - result = coreAPI.SystemStatus{Status: "OK"}
    33  - return result
     50 + return status
    34 51  }
     52 + 
  • ■ ■ ■ ■ ■ ■
    API/API/core/SetStatus.go
     1 +package coreAPI
     2 + 
     3 +import (
     4 + "context"
     5 + "log"
     6 + 
     7 + "go.mongodb.org/mongo-driver/bson"
     8 + 
     9 + svdbAPI "github.com/0sm0s1z/Sirius-Scan/API/svdb"
     10 +)
     11 + 
     12 +//SetStatus sets the status of the system in the database
     13 +func SetStatus(status SystemStatus) {
     14 + log.Println("Setting System Status: " + status.Status)
     15 + 
     16 + //Connect to the Database
     17 + client, ctx := svdbAPI.DatabaseConnect()
     18 + 
     19 + //Get the status collection
     20 + statusCollection := client.Database("Sirius").Collection("Status")
     21 + 
     22 + //If status is initializing, create the root profile
     23 + if status.Status == "init" {
     24 + //Create the root profile
     25 + //Insert the status into the database
     26 + _, err := statusCollection.InsertOne(context.TODO(), status)
     27 + if err != nil {
     28 + log.Fatal(err)
     29 + }
     30 + 
     31 + //Trigger Build of the Vulnerability Database
     32 + BuildDatabase()
     33 + 
     34 + } else {
     35 + //Update the status in the database
     36 + _, err := statusCollection.UpdateOne(context.TODO(), bson.D{{"profile", "root"}}, bson.D{{"$set", status}})
     37 + if err != nil {
     38 + log.Println(err)
     39 + }
     40 + }
     41 + defer client.Disconnect(ctx)
     42 + 
     43 + return
     44 +}
     45 + 
  • ■ ■ ■ ■ ■ ■
    API/API/core/core.go
    1 1  package coreAPI
    2 2   
    3 3  type SystemStatus struct {
    4  - Status string `json:"status"`
    5  - Tasks []SystemTask `json:"system_task"`
     4 + Profile string `json:"profile"`
     5 + Status string `json:"status"`
     6 + Tasks []SystemTask `json:"tasks"`
    6 7  }
    7 8  type SystemTask struct {
    8  - TaskID int `json:"task_id"`
    9  - TaskName string `json:"task_name"`
    10  - TaskStatus string `json:"task_status"`
     9 + TaskID string `json:"task_id"`
     10 + TaskName string `json:"task_name"`
     11 + TaskStatus string `json:"task_status"`
     12 + TaskProgress int `json:"task_progress"`
    11 13  }
     14 + 
  • ■ ■ ■ ■ ■ ■
    API/API/hosts/CheckIfHostExists.go
     1 +package hostAPI
     2 + 
     3 +import (
     4 + siriusDB "github.com/0sm0s1z/Sirius-Scan/lib/db"
     5 + "go.mongodb.org/mongo-driver/mongo"
     6 +)
     7 + 
     8 +func CheckIfHostExists(host string) bool {
     9 + //Create a hostRequest object
     10 + hostRequest := siriusDB.SVDBHost{
     11 + IP: host,
     12 + }
     13 + //Get the host data from the database
     14 + _, err := GetHost(hostRequest)
     15 + if err != nil {
     16 + return false
     17 + if err == mongo.ErrNoDocuments {
     18 + // This error means your query did not match any documents.
     19 + return false
     20 + }
     21 + }
     22 + return true
     23 +}
     24 + 
  • ■ ■ ■ ■ ■ ■
    API/API/hosts/GetHost.go
    skipped 27 lines
    28 28   //3rd Party Dependencies
    29 29  )
    30 30   
    31  -func GetHost(hostRequest siriusDB.SVDBHost) siriusDB.SVDBHost {
     31 +func GetHost(hostRequest siriusDB.SVDBHost) (siriusDB.SVDBHost, error) {
    32 32   
    33 33   //Get the host data from the database
    34 34   client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://mongo:27017"))
    skipped 21 lines
    56 56   }
    57 57   }
    58 58   
    59  - return result
     59 + return result, err
    60 60  }
    61 61   
  • ■ ■ ■ ■ ■ ■
    API/API/scan/NewScan.go
    1 1  package scanAPI
    2 2   
    3 3  import (
     4 + "bytes"
     5 + "encoding/json"
    4 6   _ "encoding/json"
    5 7   _ "errors"
    6 8   "log"
    7  - "net/http"
    8  - "os"
    9  - "os/exec"
    10 9   
    11  - "github.com/gin-gonic/gin"
    12 10   //Internal Libraries
     11 + 
    13 12   hostAPI "github.com/0sm0s1z/Sirius-Scan/API/hosts"
    14 13   siriusDB "github.com/0sm0s1z/Sirius-Scan/lib/db"
    15  - siriusHelper "github.com/0sm0s1z/Sirius-Scan/lib/utils"
    16  - siriusNmap "github.com/0sm0s1z/Sirius-Scan/scanner/engines/nmap"
     14 + "github.com/streadway/amqp"
    17 15   //3rd Party Dependencies
    18 16  )
    19 17   
    20  -type ScanRequest struct {
    21  - ScanID string
    22  - Targets []string
    23  -}
    24  - 
    25 18  type HostCVE struct {
    26 19   Host string
    27 20   CVEList []string
    28 21  }
    29 22   
    30  -// NewScan -
    31  -func NewScan(c *gin.Context) {
    32  - 
    33  - log.Println("New Scan Requested")
    34  - 
    35  - //Get Scan Profile from Request
    36  - var request ScanRequest
    37  - if c.ShouldBind(&request) == nil {
    38  - //log.Println("Request Received")
    39  - }
    40  - 
    41  - //Create Scan ID
    42  - scanID := "scan-" + siriusHelper.RandomString(10)
    43  - 
    44  - //Create Scratch Directory for Scan
    45  - os.MkdirAll("/tmp/sirius/"+scanID, 0755)
    46  - 
    47  - //For each Target run a scan
    48  - 
    49  - for _, target := range request.Targets {
    50  - //Execute Nmap Scan
    51  - rawScanResults := "/tmp/sirius/" + scanID + "/" + target + "-nmapportscan.xml"
    52  - exec.Command("nmap", "-A", "--script=vuln,vulners", target, "-oX", rawScanResults).Output()
     23 +func failOnError(err error, msg string) {
     24 + if err != nil {
     25 + log.Fatalf("%s: %s", msg, err)
    53 26   }
     27 +}
    54 28   
    55  - //Hardcoded Scan ID for Testing
    56  - //scanID = "scan-BpLnfgDsc2"
     29 +//API Call to test any function
     30 +func NewScan(request ScanRequest) {
     31 + //Connect to the RabbitMQ server
     32 + conn, err := amqp.Dial("amqp://guest:guest@rabbitmq:5672/")
     33 + failOnError(err, "Failed to connect to RabbitMQ")
     34 + defer conn.Close()
    57 35   
    58  - //log.Println("Processing Scan Results")
    59  - var scanResults []siriusNmap.CVE
    60  - var hostCVEs []HostCVE
     36 + ch, err := conn.Channel()
     37 + failOnError(err, "Failed to open a channel")
     38 + defer ch.Close()
    61 39   
    62  - //Process Scan Results for each Target
    63  - for _, target := range request.Targets {
    64  - rawScanResults := "/tmp/sirius/" + scanID + "/" + target + "-nmapportscan.xml"
    65  - dat, err := os.ReadFile(rawScanResults)
    66  - siriusHelper.ErrorCheck(err)
     40 + q, err := ch.QueueDeclare(
     41 + "scan", // name
     42 + false, // durable
     43 + false, // delete when unused
     44 + false, // exclusive
     45 + false, // no-wait
     46 + nil, // arguments
     47 + )
     48 + failOnError(err, "Failed to declare a queue")
    67 49   
    68  - //Process Scan Results and append to scanResults
    69  - scanResults = append(scanResults, processScanResults(dat)...)
     50 + request.Command = "new"
    70 51   
    71  - //Create HostCVE
    72  - var hostCVE HostCVE
    73  - hostCVE.Host = target
    74  - 
    75  - //Create CVEList
    76  - var cveList []string
    77  - for _, cve := range scanResults {
    78  - newCVE := "CVE-" + cve.CVEID
    79  - cveList = append(cveList, newCVE)
    80  - }
    81  - 
    82  - hostCVE.CVEList = cveList
    83  - 
    84  - //Append HostCVE to hostCVEs
    85  - hostCVEs = append(hostCVEs, hostCVE)
     52 + body, error := json.Marshal(request)
     53 + if error != nil {
     54 + log.Fatal(error)
    86 55   }
    87 56   
    88  - //Send Scan Results to Database
    89  - SubmitFindings(hostCVEs)
    90  - log.Println("Scan Complete")
    91  - //log.Println(hostCVEs)
     57 + err = ch.Publish(
     58 + "", // exchange
     59 + q.Name, // routing key
     60 + false, // mandatory
     61 + false, // immediate
     62 + amqp.Publishing{
     63 + ContentType: "application/json",
     64 + Body: body,
     65 + })
     66 + log.Println("=== Requesting Scan ===")
     67 + failOnError(err, "Failed to publish a message")
     68 +}
    92 69   
    93  - //Return Scan Results
    94  - c.IndentedJSON(http.StatusOK, hostCVEs)
     70 +func serialize(msg ScanRequest) ([]byte, error) {
     71 + var b bytes.Buffer
     72 + encoder := json.NewEncoder(&b)
     73 + err := encoder.Encode(msg)
     74 + return b.Bytes(), err
    95 75  }
    96 76   
    97  -func processScanResults(dat []byte) []siriusNmap.CVE {
    98  - 
    99  - //Parse XML Using Lair Project's Nmap Parser
    100  - var scanResults []siriusNmap.CVE
    101  - scanResults = siriusNmap.ProcessReport(dat)
    102  - 
    103  - log.Println(scanResults)
    104  - 
    105  - //Return DiscoveryDetails struct
    106  - 
    107  - return scanResults
     77 +func deserialize(b []byte) (ScanRequest, error) {
     78 + var msg ScanRequest
     79 + buf := bytes.NewBuffer(b)
     80 + decoder := json.NewDecoder(buf)
     81 + err := decoder.Decode(&msg)
     82 + return msg, err
    108 83  }
    109 84   
    110 85  // Update hosts in database with new findings
    skipped 3 lines
    114 89   //Get the host from the database
    115 90   var hostRequest siriusDB.SVDBHost
    116 91   hostRequest.IP = host.Host
    117  - hostRequest = hostAPI.GetHost(hostRequest)
     92 + hostRequest, err := hostAPI.GetHost(hostRequest)
     93 + if err != nil {
     94 + log.Println("Error retrieving result from DB")
     95 + }
    118 96   
    119 97   //If host does not exist in the database, create it
    120 98   if hostRequest.IP == "" {
    skipped 6 lines
    127 105   //Combine the new cve list with the old cve
    128 106   hostRequest.CVE = append(hostRequest.CVE, host.CVEList...)
    129 107   
     108 + //Remove duplicates from the hostRequest.CVE list
     109 + hostRequest.CVE = removeDuplicateValues(hostRequest.CVE)
     110 + 
    130 111   //Update the host in the database
    131 112   hostAPI.UpdateHost(hostRequest)
    132 113   }
    133 114   }
    134 115  }
    135 116   
     117 +func removeDuplicateValues(stringSlice []string) []string {
     118 + keys := make(map[string]bool)
     119 + list := []string{}
     120 + 
     121 + // If the key(values of the slice) is not equal
     122 + // to the already present value in new slice (list)
     123 + // then we append it. else we jump on another element.
     124 + for _, entry := range stringSlice {
     125 + if _, value := keys[entry]; !value {
     126 + keys[entry] = true
     127 + list = append(list, entry)
     128 + }
     129 + }
     130 + return list
     131 +}
     132 + 
  • ■ ■ ■ ■ ■ ■
    API/API/scan/ScanReport.go
     1 +package scanAPI
     2 + 
     3 +import (
     4 + "context"
     5 + "log"
     6 + "time"
     7 + 
     8 + "go.mongodb.org/mongo-driver/bson"
     9 + "go.mongodb.org/mongo-driver/mongo"
     10 + "go.mongodb.org/mongo-driver/mongo/options"
     11 +)
     12 + 
     13 +// ScanReport retrieves information from the database given a scan ID and returns a ScanRequest struct
     14 +func GetScanReport(scanID string) ScanRequest {
     15 + //Get the scan request from the database
     16 + client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://mongo:27017"))
     17 + if err != nil {
     18 + log.Fatal(err)
     19 + }
     20 + 
     21 + ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
     22 + err = client.Connect(ctx)
     23 + if err != nil {
     24 + log.Fatal(err)
     25 + }
     26 + defer client.Disconnect(ctx)
     27 + 
     28 + //Perform DB Operations
     29 + scanCollection := client.Database("Sirius").Collection("Scans")
     30 + 
     31 + //Find the appropriate Scan
     32 + var result ScanRequest
     33 + err = scanCollection.FindOne(context.TODO(), bson.M{"scanid": scanID}).Decode(&result)
     34 + if err != nil {
     35 + log.Println("Error retrieving result from DB")
     36 + if err == mongo.ErrNoDocuments {
     37 + // This error means your query did not match any documents.
     38 + log.Println("No result found with that ID")
     39 + }
     40 + }
     41 + return result
     42 +}
     43 + 
     44 +// UpdateScanReport updates the scan report in the database
     45 +func UpdateScanReport(scanRequest ScanRequest) {
     46 + //Get the scan request from the database
     47 + client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://mongo:27017"))
     48 + if err != nil {
     49 + log.Fatal(err)
     50 + }
     51 + 
     52 + ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
     53 + err = client.Connect(ctx)
     54 + if err != nil {
     55 + log.Fatal(err)
     56 + }
     57 + defer client.Disconnect(ctx)
     58 + 
     59 + //Perform DB Operations
     60 + scanCollection := client.Database("Sirius").Collection("Scans")
     61 + 
     62 + //Find the appropriate Scan
     63 + _, err = scanCollection.UpdateOne(context.TODO(), bson.M{"scanid": scanRequest.ScanID}, bson.M{"$set": scanRequest})
     64 + if err != nil {
     65 + log.Println("Error updating result in DB")
     66 + if err == mongo.ErrNoDocuments {
     67 + // This error means your query did not match any documents.
     68 + log.Println("No result found with that ID")
     69 + //Add the scan request to the database
     70 + }
     71 + }
     72 +}
     73 + 
     74 +func NewScanReport(scanRequest ScanRequest) {
     75 + //Get the scan request from the database
     76 + client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://mongo:27017"))
     77 + if err != nil {
     78 + log.Fatal(err)
     79 + }
     80 + 
     81 + ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
     82 + err = client.Connect(ctx)
     83 + if err != nil {
     84 + log.Fatal(err)
     85 + }
     86 + defer client.Disconnect(ctx)
     87 + 
     88 + //Perform DB Operations
     89 + scanCollection := client.Database("Sirius").Collection("Scans")
     90 + 
     91 + //Find the appropriate Scan
     92 + _, err = scanCollection.InsertOne(context.TODO(), scanRequest)
     93 + if err != nil {
     94 + log.Println("Error inserting result into DB")
     95 + }
     96 +}
     97 + 
  • ■ ■ ■ ■ ■ ■
    API/API/scan/scan.go
    1 1  package scanAPI
     2 + 
     3 +import (
     4 + siriusDB "github.com/0sm0s1z/Sirius-Scan/lib/db"
     5 +)
     6 + 
     7 +type ScanRequest struct {
     8 + ScanID string
     9 + Command string
     10 + Targets []string
     11 + ScanReport ScanReport
     12 +}
     13 + 
     14 +type ScanReport struct {
     15 + ScanID string
     16 + ScanType string
     17 + ScanStatus string
     18 + CompletedHosts []string
     19 + ScanProgress int
     20 + ScanResults []siriusDB.SVDBHost
     21 +}
     22 + 
  • ■ ■ ■ ■ ■ ■
    API/API/svdb/DatabaseConnect.go
    skipped 8 lines
    9 9   "go.mongodb.org/mongo-driver/mongo/options"
    10 10  )
    11 11   
    12  - 
    13  - 
    14  -func DatabaseConnect() *mongo.Client {
     12 +func DatabaseConnect() (*mongo.Client, context.Context) {
    15 13   //DB Connection
    16 14   client, err := mongo.NewClient(options.Client().ApplyURI("mongodb://mongo:27017"))
    17 15   if err != nil {
    skipped 4 lines
    22 20   if err != nil {
    23 21   log.Fatal(err)
    24 22   }
    25  - defer client.Disconnect(ctx)
    26  - return client
     23 + 
     24 + return client, ctx
    27 25  }
     26 + 
  • ■ ■ ■ ■
    API/API/svdb/VulnerabilityReport.go
    skipped 26 lines
    27 27   
    28 28   //Get the host data from the database
    29 29   var result siriusDB.SVDBHost
    30  - result = hostAPI.GetHost(hostRequest)
     30 + result, err := hostAPI.GetHost(hostRequest)
     31 + if err != nil {
     32 + log.Println("Error retrieving result from DB")
     33 + }
    31 34   
    32 35   //Collect the vulnerability data for each CVE
    33 36   var finding siriusDB.FindingRequest
    skipped 22 lines
  • ■ ■ ■ ■ ■ ■
    API/Dockerfile
    skipped 6 lines
    7 7  COPY .air.toml .air.toml
    8 8   
    9 9  # Dependencies
    10  -RUN apt-get update && apt-get install -y nmap
     10 +RUN apt-get update
     11 +RUN apt install build-essential
     12 +RUN apt install libpcap-dev ndiff
     13 + 
     14 +WORKDIR /tmp
     15 +RUN wget https://nmap.org/dist/nmap-7.92.tar.bz2
     16 +RUN tar xf nmap-7.92.tar.bz2
    11 17   
     18 +WORKDIR /tmp/nmap-7.92
     19 +RUN ./configure
     20 +RUN make
     21 +RUN make install
     22 +RUN cp nmap /usr/bin/nmap
     23 +RUN cp nmap-os-db /usr/local/bin/../share/nmap/nmap-os-db
     24 + 
     25 +WORKDIR /api
    12 26  #DEV Dependencies
    13 27  RUN go install github.com/cosmtrek/air@latest
    14 28   
    skipped 4 lines
  • API/Sirius-Scan
    Binary file.
  • API/bin/sirius-api.exe
    Binary file.
  • ■ ■ ■ ■ ■
    API/go.mod
    skipped 2 lines
    3 3  go 1.17
    4 4   
    5 5  require (
     6 + github.com/codeclysm/extract v2.2.0+incompatible // indirect
     7 + github.com/codeclysm/extract/v3 v3.1.0 // indirect
    6 8   github.com/cosmtrek/air v1.41.0 // indirect
    7 9   github.com/creack/pty v1.1.18 // indirect
    8 10   github.com/fatih/color v1.14.1 // indirect
    skipped 8 lines
    17 19   github.com/goccy/go-json v0.9.7 // indirect
    18 20   github.com/golang/protobuf v1.5.2 // indirect
    19 21   github.com/golang/snappy v0.0.1 // indirect
     22 + github.com/h2non/filetype v1.1.3 // indirect
    20 23   github.com/imdario/mergo v0.3.13 // indirect
    21 24   github.com/json-iterator/go v1.1.12 // indirect
    22  - github.com/klauspost/compress v1.13.6 // indirect
     25 + github.com/juju/errors v1.0.0 // indirect
     26 + github.com/klauspost/compress v1.15.13 // indirect
    23 27   github.com/lair-framework/go-nmap v0.0.0-20191202052157-3507e0b03523 // indirect
    24 28   github.com/leodido/go-urn v1.2.1 // indirect
    25 29   github.com/mattn/go-colorable v0.1.13 // indirect
    skipped 4 lines
    30 34   github.com/pelletier/go-toml v1.9.5 // indirect
    31 35   github.com/pelletier/go-toml/v2 v2.0.1 // indirect
    32 36   github.com/pkg/errors v0.9.1 // indirect
     37 + github.com/streadway/amqp v1.0.0 // indirect
    33 38   github.com/ugorji/go/codec v1.2.7 // indirect
     39 + github.com/ulikunitz/xz v0.5.11 // indirect
    34 40   github.com/xdg-go/pbkdf2 v1.0.0 // indirect
    35 41   github.com/xdg-go/scram v1.0.2 // indirect
    36 42   github.com/xdg-go/stringprep v1.0.2 // indirect
    skipped 11 lines
  • ■ ■ ■ ■ ■ ■
    API/go.sum
     1 +github.com/codeclysm/extract v2.2.0+incompatible h1:q3wyckoA30bhUSiwdQezMqVhwd8+WGE64/GL//LtUhI=
     2 +github.com/codeclysm/extract v2.2.0+incompatible/go.mod h1:2nhFMPHiU9At61hz+12bfrlpXSUrOnK+wR+KlGO4Uks=
     3 +github.com/codeclysm/extract/v3 v3.1.0 h1:z14FpkRizce3HNHsqJoZWwj0ovzZ2hiIkmT96FQS3j8=
     4 +github.com/codeclysm/extract/v3 v3.1.0/go.mod h1:ZJi80UG2JtfHqJI+lgJSCACttZi++dHxfWuPaMhlOfQ=
    1 5  github.com/cosmtrek/air v1.41.0 h1:6ck2LbcVvby6cyuwE8ruia41U2nppMZGWOpq+E/EhoU=
    2 6  github.com/cosmtrek/air v1.41.0/go.mod h1:+RBGjJt7T2f3I7td8Tvk0XsH/hZ3E1QBLfiWObICO4c=
    3 7  github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
    skipped 37 lines
    41 45  github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
    42 46  github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
    43 47  github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
     48 +github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg=
     49 +github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY=
    44 50  github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
    45 51  github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
    46 52  github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
    47 53  github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
    48 54  github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
     55 +github.com/juju/errors v1.0.0 h1:yiq7kjCLll1BiaRuNY53MGI0+EQ3rF6GB+wvboZDefM=
     56 +github.com/juju/errors v1.0.0/go.mod h1:B5x9thDqx0wIMH3+aLIMP9HjItInYWObRovoCFM5Qe8=
    49 57  github.com/klauspost/compress v1.13.6 h1:P76CopJELS0TiO2mebmnzgWaajssP/EszplttgQxcgc=
    50 58  github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
     59 +github.com/klauspost/compress v1.15.13 h1:NFn1Wr8cfnenSJSA46lLq4wHCcBzKTSjnBIexDMMOV0=
     60 +github.com/klauspost/compress v1.15.13/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
    51 61  github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
    52 62  github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
    53 63  github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
    skipped 32 lines
    86 96  github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
    87 97  github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
    88 98  github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE=
     99 +github.com/streadway/amqp v1.0.0 h1:kuuDrUJFZL1QYL9hUNuCxNObNzB0bV/ZG5jV3RWAQgo=
     100 +github.com/streadway/amqp v1.0.0/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw=
    89 101  github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
    90 102  github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
    91 103  github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
    skipped 9 lines
    101 113  github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=
    102 114  github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0=
    103 115  github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY=
     116 +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8=
     117 +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
    104 118  github.com/xdg-go/pbkdf2 v1.0.0 h1:Su7DPu48wXMwC3bs7MCNG+z4FhcyEuz5dlvchbq0B0c=
    105 119  github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI=
    106 120  github.com/xdg-go/scram v1.0.2 h1:akYIkZ28e6A96dkWNJQu3nmCzH3YfwMPQExUYDaRv7w=
    skipped 68 lines
  • ■ ■ ■ ■ ■ ■
    API/lib/mq/ConnectToRabbitMQ.go
     1 +package mq
     2 + 
     3 +import (
     4 + "github.com/streadway/amqp"
     5 +)
     6 + 
     7 +func ConnectToRabbitMQ() (*amqp.Connection, error) {
     8 + //Connect to RabbitMQ
     9 + conn, err := amqp.Dial("amqp://guest:guest@rabbitmq:5672/")
     10 + return conn, err
     11 +}
     12 + 
  • ■ ■ ■ ■ ■ ■
    API/lib/mq/ScanQueue.go
     1 +package mq
     2 + 
     3 +import (
     4 + "encoding/json"
     5 + "log"
     6 + "strings"
     7 + 
     8 + hostAPI "github.com/0sm0s1z/Sirius-Scan/API/hosts"
     9 + scanAPI "github.com/0sm0s1z/Sirius-Scan/API/scan"
     10 + siriusDB "github.com/0sm0s1z/Sirius-Scan/lib/db"
     11 +)
     12 + 
     13 +//ScanQueue is subscribed to the RabbitMQ for scan requests
     14 +// For each request, it will create a new scan and add it to the database
     15 +func ScanQueue() {
     16 + //Connect to the RabbitMQ
     17 + conn, err := ConnectToRabbitMQ()
     18 + failOnError(err, "Failed to connect to RabbitMQ")
     19 + defer conn.Close()
     20 + 
     21 + ch, err := conn.Channel()
     22 + failOnError(err, "Failed to open a channel")
     23 + defer ch.Close()
     24 + 
     25 + q, err := ch.QueueDeclare(
     26 + "scan-report", // name
     27 + false, // durable
     28 + false, // delete when unused
     29 + false, // exclusive
     30 + false, // no-wait
     31 + nil, // arguments
     32 + )
     33 + failOnError(err, "Failed to declare a queue")
     34 + 
     35 + msgs, err := ch.Consume(
     36 + q.Name, // queue
     37 + "", // consumer
     38 + true, // auto-ack
     39 + false, // exclusive
     40 + false, // no-local
     41 + false, // no-wait
     42 + nil, // args
     43 + )
     44 + failOnError(err, "Failed to register a consumer")
     45 + 
     46 + forever := make(chan bool)
     47 + 
     48 + go func() {
     49 + for d := range msgs {
     50 + //Serialize the message into a ScanRequest struct
     51 + var scanJob scanAPI.ScanRequest
     52 + err = json.Unmarshal(d.Body, &scanJob)
     53 + if err != nil {
     54 + log.Fatal(err)
     55 + }
     56 + 
     57 + //Retrieve the current scan report from the database
     58 + //Check if scan already exists
     59 + var newRequest scanAPI.ScanRequest
     60 + newRequest = scanAPI.GetScanReport(scanJob.ScanID)
     61 + if newRequest.ScanID == "" {
     62 + scanAPI.NewScanReport(scanJob)
     63 + }
     64 + 
     65 + //Get the last host in the scan report
     66 + var host siriusDB.SVDBHost
     67 + host = scanJob.ScanReport.ScanResults[len(scanJob.ScanReport.ScanResults)-1]
     68 + 
     69 + if scanJob.Command == "scanVulnerability" {
     70 + //scanAPI.NewScanReport(scanJob)
     71 + } else if scanJob.Command == "complete" {
     72 + //Remove duplicate CVEs
     73 + host.CVE = removeDuplicates(host.CVE)
     74 + 
     75 + //Add the host to the list of completed hosts
     76 + newRequest.ScanReport.CompletedHosts = append(scanJob.ScanReport.CompletedHosts, host.IP)
     77 + //Add the new host to the scan report
     78 + newRequest.ScanReport.ScanResults = append(newRequest.ScanReport.ScanResults, host)
     79 + 
     80 + //Check if the host already exists in the database
     81 + //If it does, update the host
     82 + //If it doesn't, add the host
     83 + if hostAPI.CheckIfHostExists(host.IP) {
     84 + hostAPI.UpdateHost(host)
     85 + } else {
     86 + hostAPI.AddHost(host)
     87 + }
     88 + 
     89 + //Update scan report
     90 + scanAPI.UpdateScanReport(newRequest)
     91 + 
     92 + log.Println("=== Scan Complete: " + scanJob.ScanReport.ScanResults[0].IP + " ===")
     93 + }
     94 + }
     95 + }()
     96 + 
     97 + log.Printf(" [*] API Scan Queue is now listening.")
     98 + <-forever
     99 +}
     100 + 
     101 +func removeDuplicates(strs []string) []string {
     102 + unique := make(map[string]bool)
     103 + result := []string{}
     104 + 
     105 + for _, str := range strs {
     106 + //remove trailing whitespace
     107 + str = strings.TrimSpace(str)
     108 + if !unique[str] {
     109 + unique[str] = true
     110 + result = append(result, str)
     111 + }
     112 + }
     113 + 
     114 + return result
     115 +}
     116 + 
  • ■ ■ ■ ■ ■ ■
    API/lib/mq/mq.go
     1 +package mq
     2 + 
     3 +import (
     4 + "log"
     5 +)
     6 + 
     7 +func failOnError(err error, msg string) {
     8 + if err != nil {
     9 + log.Fatalf("%s: %s", msg, err)
     10 + }
     11 +}
     12 + 
  • API/main
    Binary file.
  • ■ ■ ■ ■ ■ ■
    API/scanner/engines/nmap/nmap.go
    skipped 35 lines
    36 36   var scan Scan
    37 37   var cvelist []CVE
    38 38   
     39 + // Convert the NmapRun struct to a SVDBHost struct
     40 + //var host siriusDB.SVDBHost
     41 + //host.OS = run.Hosts[0].Os.OsMatches[0].Name
     42 + 
     43 + //CVEs from HostScript Output
     44 + for j := 0; j < len(run.Hosts[0].HostScripts); j++ {
     45 + scriptOutput := run.Hosts[0].HostScripts[j].Output
     46 + 
     47 + for _, line := range strings.Split(strings.TrimSuffix(scriptOutput, "\n"), "\n") {
     48 + if strings.Contains(line, "CVE-") {
     49 + //log.Println(line)
     50 + cveid := strings.Split(line, "CVE-")[1]
     51 + 
     52 + if len(cveid) > 9 {
     53 + cveid = cveid[:10]
     54 + cvelist = append(cvelist, CVE{CVEID: cveid})
     55 + } else {
     56 + cveid = cveid[:9]
     57 + cvelist = append(cvelist, CVE{CVEID: cveid})
     58 + }
     59 + }
     60 + }
     61 + }
     62 + 
    39 63   // THIS IS GHETTO AND BAD AND I SHOULD FEEL BAD - but it works for now
    40 64   for i := 0; i < len(run.Hosts[0].Ports); i++ {
     65 + 
     66 + //CVEs from Port Script Output
    41 67   for j := 0; j < len(run.Hosts[0].Ports[i].Scripts); j++ {
    42 68   
    43 69   scriptOutput := run.Hosts[0].Ports[i].Scripts[j].Output
    44 70   
    45 71   for _, line := range strings.Split(strings.TrimSuffix(scriptOutput, "\n"), "\n") {
    46 72   if strings.Contains(line, "CVE-") {
     73 + //log.Println(line)
    47 74   cveid := strings.Split(line, "CVE-")[1]
    48 75   
    49 76   if len(cveid) > 9 {
    skipped 65 lines
  • API/sirius-api.exe
    Binary file.
  • ■ ■ ■ ■ ■
    API/sirius-api.go
    skipped 17 lines
    18 18   APIHandler "github.com/0sm0s1z/Sirius-Scan/API"
    19 19   agentsAPI "github.com/0sm0s1z/Sirius-Scan/API/agents"
    20 20   dataAPI "github.com/0sm0s1z/Sirius-Scan/API/data"
    21  - scanAPI "github.com/0sm0s1z/Sirius-Scan/API/scan"
    22 21   svdbAPI "github.com/0sm0s1z/Sirius-Scan/API/svdb"
    23 22   siriusDB "github.com/0sm0s1z/Sirius-Scan/lib/db"
     23 + siriusMQ "github.com/0sm0s1z/Sirius-Scan/lib/mq"
    24 24   //siriusNVD "github.com/0sm0s1z/Sirius-Scan/lib/nvd"
    25 25   //3rd Party Dependencies
    26 26  )
    skipped 9 lines
    36 36  // SVDBEntry represents data about a target SVDBEntry.
    37 37   
    38 38  func main() {
     39 + 
     40 + //Begin ScanQueue
     41 + go siriusMQ.ScanQueue()
     42 + 
     43 + gin.SetMode(gin.ReleaseMode)
    39 44   router := gin.Default()
    40 45   router.Use(cors.New(cors.Config{
    41 46   AllowOrigins: []string{"*"},
    skipped 3 lines
    45 50   
    46 51   //Sirius Core API
    47 52   router.GET("/api/status", APIHandler.GetStatus)
     53 + router.POST("/api/test", APIHandler.TestFunction)
    48 54   
    49 55   //Sirius Host API
    50 56   router.GET("/api/get/hosts", getHosts)
    skipped 27 lines
    78 84   router.GET("/api/data/cpe_vendors", svdbAPI.GetCPEVendors)
    79 85   
    80 86   //Scanner APIs
    81  - router.POST("/api/scan/new", scanAPI.NewScan)
     87 + router.POST("/api/scan/new", APIHandler.NewScan)
     88 + router.POST("/api/scan/report", APIHandler.GetScanReport)
    82 89   
    83 90   router.Run(":8080")
    84 91  }
    skipped 20 lines
  • ■ ■ ■ ■ ■ ■
    API/testdata
    1  -<?xml version="1.0" encoding="UTF-8"?>
    2  -<!DOCTYPE nmaprun>
    3  -<?xml-stylesheet href="file:///opt/homebrew/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
    4  -<!-- Nmap 7.92 scan initiated Thu Jan 13 17:24:57 2022 as: nmap -sV -O -oX testdata 192.168.86.33 -->
    5  -<nmaprun scanner="nmap" args="nmap -sV -O -oX testdata 192.168.86.33" start="1642116297" startstr="Thu Jan 13 17:24:57 2022" version="7.92" xmloutputversion="1.05">
    6  -<scaninfo type="syn" protocol="tcp" numservices="1000" services="1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-445,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3389-3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5357,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9929,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389"/>
    7  -<verbose level="0"/>
    8  -<debugging level="0"/>
    9  -<hosthint><status state="up" reason="arp-response" reason_ttl="0"/>
    10  -<address addr="192.168.86.33" addrtype="ipv4"/>
    11  -<address addr="F8:FF:C2:0E:37:C4" addrtype="mac" vendor="Apple"/>
    12  -<hostnames>
    13  -</hostnames>
    14  -</hosthint>
    15  -<host starttime="1642116297" endtime="1642116311"><status state="up" reason="arp-response" reason_ttl="0"/>
    16  -<address addr="192.168.86.33" addrtype="ipv4"/>
    17  -<address addr="F8:FF:C2:0E:37:C4" addrtype="mac" vendor="Apple"/>
    18  -<hostnames>
    19  -<hostname name="sans-sec460.lan" type="PTR"/>
    20  -</hostnames>
    21  -<ports><extraports state="closed" count="994">
    22  -<extrareasons reason="reset" count="994" proto="tcp" ports="1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79,81-85,88-90,99-100,106,109-111,113,119,125,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-444,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9929,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389"/>
    23  -</extraports>
    24  -<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="http" product="nginx" version="1.13.5" method="probed" conf="10"><cpe>cpe:/a:igor_sysoev:nginx:1.13.5</cpe></service></port>
    25  -<port protocol="tcp" portid="135"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="msrpc" product="Microsoft Windows RPC" ostype="Windows" method="probed" conf="10"><cpe>cpe:/o:microsoft:windows</cpe></service></port>
    26  -<port protocol="tcp" portid="139"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="netbios-ssn" product="Microsoft Windows netbios-ssn" ostype="Windows" method="probed" conf="10"><cpe>cpe:/o:microsoft:windows</cpe></service></port>
    27  -<port protocol="tcp" portid="445"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="microsoft-ds" product="Microsoft Windows 7 - 10 microsoft-ds" extrainfo="workgroup: WORKGROUP" hostname="SANS-SEC460" ostype="Windows" method="probed" conf="10"><cpe>cpe:/o:microsoft:windows</cpe></service></port>
    28  -<port protocol="tcp" portid="3389"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="ms-wbt-server" product="Microsoft Terminal Services" ostype="Windows" method="probed" conf="10"><cpe>cpe:/o:microsoft:windows</cpe></service></port>
    29  -<port protocol="tcp" portid="5357"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="http" product="Microsoft HTTPAPI httpd" version="2.0" extrainfo="SSDP/UPnP" ostype="Windows" method="probed" conf="10"><cpe>cpe:/o:microsoft:windows</cpe></service></port>
    30  -</ports>
    31  -<os><portused state="open" proto="tcp" portid="80"/>
    32  -<portused state="closed" proto="tcp" portid="1"/>
    33  -<portused state="closed" proto="udp" portid="31453"/>
    34  -<osmatch name="Microsoft Windows 10 1507 - 1607" accuracy="100" line="69497">
    35  -<osclass type="general purpose" vendor="Microsoft" osfamily="Windows" osgen="10" accuracy="100"><cpe>cpe:/o:microsoft:windows_10</cpe></osclass>
    36  -</osmatch>
    37  -</os>
    38  -<uptime seconds="267213" lastboot="Mon Jan 10 15:11:38 2022"/>
    39  -<distance value="1"/>
    40  -<tcpsequence index="255" difficulty="Good luck!" values="97D1D20B,E1A58A75,1C165B0B,5761B430,865E6980,7D1316A6"/>
    41  -<ipidsequence class="Incremental" values="7951,7952,7953,7954,7955,7956"/>
    42  -<tcptssequence class="1000HZ" values="FED570D,FED5776,FED57DD,FED5846,FED58AD,FED5915"/>
    43  -<times srtt="7970" rttvar="2033" to="100000"/>
    44  -</host>
    45  -<runstats><finished time="1642116311" timestr="Thu Jan 13 17:25:11 2022" summary="Nmap done at Thu Jan 13 17:25:11 2022; 1 IP address (1 host up) scanned in 14.13 seconds" elapsed="14.13" exit="success"/><hosts up="1" down="0" total="1"/>
    46  -</runstats>
    47  -</nmaprun>
    48  - 
  • ■ ■ ■ ■ ■
    API/tmp/build-errors.log
    1  -exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 1exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2signal: trace/BPT trapexit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 1exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 2exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2
  • API/tmp/sirius-api
    Binary file.
  • API/discover-vulners-cve.py API/utils/discover-vulners-cve.py
    Content is identical
  • API/lib.go API/utils/lib.go
    Content is identical
  • API/main.go API/utils/main.go
    Content is identical
  • API/nvd-cpematch-consumer API/utils/nvd-cpematch-consumer
    Binary file.
  • API/nvd-cpematch-consumer.go API/utils/nvd-cpematch-consumer.go
    Content is identical
  • API/nvd-cve-consumer.go API/utils/nvd-cve-consumer.go
    Content is identical
  • ■ ■ ■ ■ ■ ■
    Engine/.air.toml
     1 +#alias air='$(go env GOPATH)/bin/air'
     2 + 
     3 +root = "."
     4 +testdata_dir = "testdata"
     5 +tmp_dir = "tmp"
     6 + 
     7 +[build]
     8 + args_bin = []
     9 + bin = "tmp/sirius"
     10 + cmd = "go build -o ./tmp/sirius ./sirius.go"
     11 + delay = 0
     12 + exclude_dir = ["assets", "tmp", "vendor", "testdata"]
     13 + exclude_file = []
     14 + exclude_regex = ["_test.go"]
     15 + exclude_unchanged = false
     16 + follow_symlink = false
     17 + full_bin = ""
     18 + include_dir = []
     19 + include_ext = ["go", "tpl", "tmpl", "html"]
     20 + include_file = []
     21 + kill_delay = "0s"
     22 + log = "build-errors.log"
     23 + rerun = false
     24 + rerun_delay = 500
     25 + send_interrupt = false
     26 + stop_on_error = false
     27 + 
     28 +[color]
     29 + app = ""
     30 + build = "yellow"
     31 + main = "magenta"
     32 + runner = "green"
     33 + watcher = "cyan"
     34 + 
     35 +[log]
     36 + main_only = false
     37 + time = false
     38 + 
     39 +[misc]
     40 + clean_on_exit = false
     41 + 
     42 +[screen]
     43 + clear_on_rebuild = false
     44 + keep_scroll = true
     45 + 
  • ■ ■ ■ ■
    Engine/Dockerfile
    skipped 7 lines
    8 8  # Dependencies
    9 9  RUN apt-get update
    10 10  RUN apt install -y build-essential
    11  -RUN apt install -y libpcap-dev ndiff
     11 +RUN apt install -y libpcap-dev ndiff libssl-dev libssh-dev
    12 12   
    13 13  WORKDIR /tmp
    14 14  RUN wget https://nmap.org/dist/nmap-7.92.tar.bz2
    skipped 17 lines
  • ■ ■ ■ ■ ■ ■
    Engine/core/DiscoveryScanner.go
    1  -package core
    2  - 
    3  -import (
    4  - "log"
    5  -)
    6  - 
    7  -// VulnerabilityScanner subscribes to the queue and listens for scan requests
    8  -// When a scan request is received, it will execute scans for each target up to the scan queue
    9  -func DiscoveryScanner() {
    10  - log.Println("Vulnerability Scanner Invoked")
    11  - 
    12  -}
    13  - 
  • ■ ■ ■ ■ ■
    Engine/core/NewScan.go
    1 1  package core
    2 2   
    3 3  import (
    4  - "fmt"
    5 4   "log"
    6 5   "os"
    7 6   
    8 7   //Internal Libraries
     8 + scanners "github.com/0sm0s1z/Sirius-Scan/Engine/core/scanners"
    9 9   lib "github.com/0sm0s1z/Sirius-Scan/Engine/lib"
    10 10  )
    11 11   
    skipped 4 lines
    16 16   //Create Scratch Directory for Scan
    17 17   os.MkdirAll("/tmp/sirius/"+job.ScanID, 0755)
    18 18   
    19  - //Transform ScanRequest into a TargetMatrix
    20  - targetMatrix := lib.BuildTargetMatrix(job)
    21  - 
    22  - //Start the Vulnerability Scan Consumer microservice
    23  - go VulnerabilityScanner()
    24  - 
    25  - //For each Target run a scan
    26  - for _, target := range targetMatrix {
    27  - //Execute Sirius Scan
    28  - //Discovery Scanner
    29  - //go scanners.DiscoveryScanner()
    30  - fmt.Println(target)
    31  - 
    32  - }
    33  - 
    34  - //log.Println(targetMatrix)
    35  - 
    36  - //For each Target run a scan
    37  - /*
    38  - for _, target := range request.Targets {
    39  - //Execute Nmap Scan
    40  - rawScanResults := "/tmp/sirius/" + scanID + "/" + target + "-nmapportscan.xml"
    41  - cmd, err := exec.Command("nmap", "-sV", "-O", "--script=vuln,vulners,default,safe", target, "-oX", rawScanResults).Output()
    42  - //Get command response
    43  - if err != nil {
    44  - log.Println(err)
    45  - }
    46  - log.Println(string(cmd))
    47  - 
    48  - }*/
    49  - 
    50  - scanStatus := lib.SystemStatus{
    51  - Profile: "root",
    52  - Status: "OK",
    53  - Tasks: []lib.SystemTask{
    54  - {
    55  - TaskID: "2",
    56  - TaskName: job.ScanID,
    57  - TaskStatus: "Done",
    58  - TaskProgress: 100,
    59  - },
    60  - },
    61  - }
    62  - 
    63  - log.Println(scanStatus)
    64  - //var scanResults []siriusNmap.CVE
    65  - //var hostCVEs []HostCVE
    66  - 
     19 + //Start a Discovery Scan
     20 + scanners.DiscoveryScanner(job)
    67 21  }
    68 22   
  • ■ ■ ■ ■ ■ ■
    Engine/core/VulnerabilityScanner.go
    1  -package core
    2  - 
    3  -import (
    4  - "encoding/json"
    5  - "log"
    6  - 
    7  - "github.com/streadway/amqp"
    8  - 
    9  - lib "github.com/0sm0s1z/Sirius-Scan/Engine/lib"
    10  -)
    11  - 
    12  -func failOnError(err error, msg string) {
    13  - if err != nil {
    14  - log.Fatalf("%s: %s", msg, err)
    15  - }
    16  -}
    17  - 
    18  -// VulnerabilityScanner subscribes to the queue and listens for scan requests
    19  -// When a scan request is received, it will execute scans for each target up to the scan queue
    20  -func VulnerabilityScanner() {
    21  - conn, err := amqp.Dial("amqp://guest:guest@rabbitmq:5672/")
    22  - failOnError(err, "Failed to connect to RabbitMQ")
    23  - defer conn.Close()
    24  - 
    25  - ch, err := conn.Channel()
    26  - failOnError(err, "Failed to open a channel")
    27  - defer ch.Close()
    28  - 
    29  - q, err := ch.QueueDeclare(
    30  - "scan", // name
    31  - false, // durable
    32  - false, // delete when unused
    33  - false, // exclusive
    34  - false, // no-wait
    35  - nil, // arguments
    36  - )
    37  - failOnError(err, "Failed to declare a queue")
    38  - 
    39  - msgs, err := ch.Consume(
    40  - q.Name, // queue
    41  - "", // consumer
    42  - true, // auto-ack
    43  - false, // exclusive
    44  - false, // no-local
    45  - false, // no-wait
    46  - nil, // args
    47  - )
    48  - failOnError(err, "Failed to register a consumer")
    49  - 
    50  - // Start Scanning each target in the queue
    51  - forever := make(chan bool)
    52  - 
    53  - go func() {
    54  - for d := range msgs {
    55  - log.Printf("Received a message: %s", d.Body)
    56  - var targetMatrix lib.TargetMatrix
    57  - json.Unmarshal(d.Body, &targetMatrix)
    58  - }
    59  - }()
    60  - <-forever
    61  -}
    62  - 
  • ■ ■ ■ ■ ■ ■
    Engine/core/scanners/DiscoveryScanner.go
     1 +package scanners
     2 + 
     3 +import (
     4 + "log"
     5 + 
     6 + sirius "github.com/0sm0s1z/Sirius-Scan/Engine/lib"
     7 +)
     8 + 
     9 +// DiscoveryScanner accepts a TargetMatrix and enumerates each target
     10 +// Publish ScanReports to the scan queue
     11 +func DiscoveryScanner(job sirius.ScanRequest) {
     12 + 
     13 + //Transform ScanRequest into a TargetMatrix
     14 + targetMatrix := sirius.BuildTargetMatrix(job)
     15 + 
     16 + //For each Target run a scan
     17 + for _, target := range targetMatrix {
     18 + host := discover(target)
     19 + if host == true {
     20 + //Create new SVDBHost
     21 + var host sirius.SVDBHost
     22 + host.IP = target
     23 + 
     24 + //Append the host to the ScanReport
     25 + job.ScanReport.ScanResults = append(job.ScanReport.ScanResults, host)
     26 + 
     27 + //Set scan Command
     28 + job.Command = "scanVulnerability"
     29 + 
     30 + //Publish the ScanReport to the queue
     31 + publishHost(job)
     32 + }
     33 + }
     34 +}
     35 + 
     36 +func discover(target string) bool {
     37 + log.Println("Starting Discovery Scan on: " + target)
     38 + host := ScanTCP(target)
     39 + 
     40 + return host
     41 +}
     42 + 
     43 +func publishHost(scanRequest sirius.ScanRequest) {
     44 + //Send the ScanResult to the queue
     45 + sirius.SendToQueue(scanRequest, "scan")
     46 + sirius.SendToQueue(scanRequest, "scan-report")
     47 +}
     48 + 
  • ■ ■ ■ ■ ■ ■
    Engine/core/scanners/Scan-TCP.go
     1 +package scanners
     2 + 
     3 +//Scan-TCP.go is a TCP sweeper
     4 +//It will scan a target for common open TCP ports to determine if the host is online
     5 + 
     6 +import (
     7 + "context"
     8 + "log"
     9 + "net"
     10 + "strings"
     11 + "time"
     12 +)
     13 + 
     14 +type ScanResult struct {
     15 + ScanID string
     16 + Target string
     17 + Port string
     18 + Protocol string
     19 + Service string
     20 + Product string
     21 + Version string
     22 + ExtraInfo string
     23 +}
     24 + 
     25 +//ScanTCP is the main TCP scanning function
     26 +func ScanTCP(target string) bool {
     27 + //String array of common ports
     28 + ports := []string{
     29 + "21",
     30 + "22",
     31 + "23",
     32 + "25",
     33 + "53",
     34 + "80",
     35 + "110",
     36 + "111",
     37 + "135",
     38 + "139",
     39 + "143",
     40 + "443",
     41 + "445",
     42 + "993",
     43 + "995",
     44 + "1723",
     45 + "3306",
     46 + "3389",
     47 + "5900",
     48 + "8080",
     49 + }
     50 + 
     51 + //Create a TCP connection for each port
     52 + for _, port := range ports {
     53 + //ctx, cancel := context.WithTimeout(context.Background(), 1000*time.Millisecond)
     54 + //defer cancel()
     55 + isOnline, err := checkHostOnline(target, port, 300*time.Millisecond)
     56 + if err != nil {
     57 + log.Printf("Error: %v\n", err)
     58 + }
     59 + 
     60 + if isOnline {
     61 + return true
     62 + }
     63 + }
     64 + return false
     65 +}
     66 + 
     67 +func checkHostOnline(host, port string, timeout time.Duration) (bool, error) {
     68 + conn, err := net.DialTimeout("tcp", net.JoinHostPort(host, port), timeout)
     69 + if err != nil {
     70 + if strings.Contains(err.Error(), "refused") {
     71 + return false, nil
     72 + } else if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
     73 + return false, nil
     74 + } else {
     75 + return false, err
     76 + }
     77 + } else {
     78 + conn.Close()
     79 + return true, nil
     80 + }
     81 +}
     82 + 
     83 +func ScanPort(ctx context.Context, target string, port string) {
     84 + //Create a TCP connection
     85 + conn, err := net.DialTimeout("tcp", target+":"+port, 3*time.Second)
     86 + if err != nil {
     87 + log.Println(err)
     88 + } else {
     89 + 
     90 + //Close the connection
     91 + conn.Close()
     92 + 
     93 + //Create a new ScanResult
     94 + scanResult := ScanResult{
     95 + Target: target,
     96 + Port: port,
     97 + Protocol: "TCP",
     98 + Service: "Unknown",
     99 + Product: "Unknown",
     100 + Version: "Unknown",
     101 + ExtraInfo: "Unknown",
     102 + //Timestamp: time.Now().Format("2006-01-02 15:04:05"),
     103 + }
     104 + 
     105 + //Get the service name
     106 + scanResult.Service = getServiceName(port)
     107 + }
     108 +}
     109 + 
     110 +func getServiceName(port string) string {
     111 + //List of common services
     112 + services := map[string]string{
     113 + "21": "FTP",
     114 + "22": "SSH",
     115 + "23": "Telnet",
     116 + "25": "SMTP",
     117 + "53": "DNS",
     118 + "80": "HTTP",
     119 + "110": "POP3",
     120 + "111": "RPC",
     121 + "135": "RPC",
     122 + "139": "SMB",
     123 + "143": "IMAP",
     124 + "443": "HTTPS",
     125 + "445": "SMB",
     126 + "993": "IMAPS",
     127 + "995": "POP3S",
     128 + "1723": "PPTP",
     129 + "3306": "MySQL",
     130 + "3389": "RDP",
     131 + "5900": "VNC",
     132 + "8080": "HTTP",
     133 + }
     134 + 
     135 + //Return the service name
     136 + return services[port]
     137 +}
     138 + 
     139 +func getServiceBanner(target string, port string) string {
     140 + //Convert port to string
     141 + 
     142 + //Create a TCP connection
     143 + conn, err := net.DialTimeout("tcp", target+":"+port, 3*time.Second)
     144 + if err != nil {
     145 + log.Println(err)
     146 + }
     147 + 
     148 + //Close the connection
     149 + defer conn.Close()
     150 + 
     151 + //Read the banner
     152 + buf := make([]byte, 1024)
     153 + conn.Read(buf)
     154 + 
     155 + //Return the banner
     156 + return string(buf)
     157 +}
     158 + 
  • ■ ■ ■ ■ ■ ■
    Engine/core/scanners/VulnerabilityScanner.go
     1 +package scanners
     2 + 
     3 +import (
     4 + "encoding/xml"
     5 + "fmt"
     6 + "log"
     7 + "os"
     8 + "os/exec"
     9 + 
     10 + sirius "github.com/0sm0s1z/Sirius-Scan/Engine/lib"
     11 + siriusNmap "github.com/0sm0s1z/Sirius-Scan/Engine/lib/nmap"
     12 + "github.com/lair-framework/go-nmap"
     13 +)
     14 + 
     15 +// VulnerabilityScanner subscribes to the queue and listens for scan requests
     16 +// When a scan request is received, it will execute scans for each target up to the scan queue
     17 +func VulnerabilityScanner(scanRequest sirius.ScanRequest) {
     18 + //Get target from scanRequest (last host in the list)
     19 + target := scanRequest.ScanReport.ScanResults[len(scanRequest.ScanReport.ScanResults)-1].IP
     20 + 
     21 + //Execute Nmap Scan
     22 + rawScanResults := "/tmp/sirius/" + scanRequest.ScanID + "/" + target + "-nmapportscan.xml"
     23 + 
     24 + cmd, err := exec.Command("nmap", "-T4", "-sV", "-O", "--script=vuln,vulners,safe,default,smb-os-discovery", target, "-oX", rawScanResults).Output()
     25 + //Get command response
     26 + if err != nil {
     27 + log.Println(err)
     28 + }
     29 + log.Println(string(cmd))
     30 + 
     31 + //Process Nmap Scan Results
     32 + dat, err := os.ReadFile(rawScanResults)
     33 + if err != nil {
     34 + log.Println(err)
     35 + }
     36 + //Parse Nmap XML
     37 + svdbHost, err := parseNmapXML(dat)
     38 + if err != nil {
     39 + fmt.Printf("Error: %v\n", err)
     40 + }
     41 + cveList := processScanResults(dat)
     42 + 
     43 + //Create a SVDBHost
     44 + svdbHost.CVE = cveList
     45 + 
     46 + //Clear Scan Results
     47 + scanRequest.ScanReport.ScanResults = nil
     48 + 
     49 + //Append SVDBHost to ScanReport
     50 + scanRequest.ScanReport.ScanResults = append(scanRequest.ScanReport.ScanResults, *svdbHost)
     51 + scanRequest.Command = "complete"
     52 + 
     53 + //Send ScanReport to Queue
     54 + sirius.SendToQueue(scanRequest, "scan")
     55 + sirius.SendToQueue(scanRequest, "scan-report")
     56 +}
     57 + 
     58 +// processScanResults processes the raw scan results and returns a list of CVEs
     59 +func processScanResults(dat []byte) []string {
     60 + //Parse XML Using Lair Project's Nmap Parser
     61 + var nmapResults []siriusNmap.CVE
     62 + nmapResults = siriusNmap.ProcessReport(dat)
     63 + 
     64 + //Create CVEList
     65 + var cveList []string
     66 + for _, cve := range nmapResults {
     67 + newCVE := "CVE-" + cve.CVEID
     68 + cveList = append(cveList, newCVE)
     69 + }
     70 + 
     71 + return cveList
     72 +}
     73 + 
     74 +func parseNmapXML(data []byte) (*sirius.SVDBHost, error) {
     75 + var nmapRun nmap.NmapRun
     76 + if err := xml.Unmarshal(data, &nmapRun); err != nil {
     77 + return nil, fmt.Errorf("unable to unmarshal XML data: %v", err)
     78 + }
     79 + 
     80 + if len(nmapRun.Hosts) == 0 {
     81 + return nil, fmt.Errorf("no hosts found in the nmap XML data")
     82 + }
     83 + 
     84 + host := nmapRun.Hosts[0]
     85 + var ip string
     86 + for _, address := range host.Addresses {
     87 + if address.AddrType == "ipv4" || address.AddrType == "ipv6" {
     88 + ip = address.Addr
     89 + break
     90 + }
     91 + }
     92 + 
     93 + var osName, osVersion string
     94 + if len(host.Os.OsMatches) > 0 {
     95 + osMatch := host.Os.OsMatches[0]
     96 + osName = osMatch.Name
     97 + osVersion = osMatch.OsClasses[0].OsGen
     98 + }
     99 + 
     100 + svdbHost := &sirius.SVDBHost{
     101 + IP: ip,
     102 + Hostname: host.Hostnames[0].Name,
     103 + OS: osName,
     104 + OSVersion: osVersion,
     105 + }
     106 + 
     107 + // Parse the services, CPEs, CVEs, and agent data as needed
     108 + // and fill in the corresponding fields in the SVDBHost struct
     109 + 
     110 + return svdbHost, nil
     111 +}
     112 + 
  • ■ ■ ■ ■ ■
    Engine/go.mod
    skipped 2 lines
    3 3  go 1.17
    4 4   
    5 5  require (
     6 + github.com/lair-framework/go-nmap v0.0.0-20191202052157-3507e0b03523 // indirect
    6 7   github.com/rabbitmq/amqp091-go v1.5.0 // indirect
    7 8   github.com/streadway/amqp v1.0.0 // indirect
    8 9   github.com/wagslane/go-rabbitmq v0.12.1 // indirect
    skipped 2 lines
  • ■ ■ ■ ■ ■ ■
    Engine/go.sum
    skipped 1 lines
    2 2  github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
    3 3  github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
    4 4  github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
     5 +github.com/lair-framework/go-nmap v0.0.0-20191202052157-3507e0b03523 h1:N4NQR4on0n3Kc3xlBXUYzCZorFdordwkR2kcZMk9te0=
     6 +github.com/lair-framework/go-nmap v0.0.0-20191202052157-3507e0b03523/go.mod h1:7Em1Lxm3DFdLvXWUZ6bQ/xIbGlxFy7jl07bziQMZ/kU=
    5 7  github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
    6 8  github.com/rabbitmq/amqp091-go v1.5.0 h1:VouyHPBu1CrKyJVfteGknGOGCzmOz0zcv/tONLkb7rg=
    7 9  github.com/rabbitmq/amqp091-go v1.5.0/go.mod h1:JsV0ofX5f1nwOGafb8L5rBItt9GyhfQfcJj+oyz0dGg=
    skipped 37 lines
  • ■ ■ ■ ■
    Engine/lib/BuildTargetMatrix.go
    skipped 8 lines
    9 9   //If host, add to targetMatrix
    10 10   //If network, generate host list and add to targetMatrix
    11 11   if IsHost(target) {
    12  - targetMatrix = append(targetMatrix, ExpandNetwork(target)...)
     12 + targetMatrix = append(targetMatrix, target)
    13 13   } else if IsNetwork(target) {
    14 14   //Generate Host List
    15 15   //Add to targetMatrix
    skipped 7 lines
  • ■ ■ ■ ■ ■
    Engine/lib/IsNetwork.go
    1 1  package lib
    2 2   
    3 3  import (
    4  - "log"
    5 4   "net"
    6 5  )
    7 6   
    skipped 1 lines
    9 8  func IsNetwork(target string) bool {
    10 9   ipv4Addr, ipv4Net, err := net.ParseCIDR(target)
    11 10   if err != nil {
    12  - log.Fatal(err)
     11 + return false
    13 12   } else {
    14 13   return true
    15 14   }
    skipped 4 lines
  • ■ ■ ■ ■ ■
    Engine/lib/RegisterConsumer.go
    skipped 5 lines
    6 6   "github.com/streadway/amqp"
    7 7  )
    8 8   
    9  -func failOnError(err error, msg string) {
    10  - if err != nil {
    11  - log.Fatalf("%s: %s", msg, err)
    12  - }
    13  -}
    14  - 
    15 9  // RegisterConsumer registers a consumer with the queue
    16  -func RegisterConsumer(name string) {
     10 +func RegisterConsumer(name string) {
    17 11   conn, err := amqp.Dial("amqp://guest:guest@rabbitmq:5672/")
    18 12   failOnError(err, "Failed to connect to RabbitMQ")
    19 13   defer conn.Close()
    skipped 29 lines
  • ■ ■ ■ ■ ■ ■
    Engine/lib/ScanEngineTypes.go
    skipped 7 lines
    8 8  }
    9 9   
    10 10  type ScanReport struct {
    11  - ScanID string
    12  - ScanType string
    13  - ScanStatus string
    14  - ScanProgress int
    15  - ScanResults []SVDBHost
     11 + ScanID string
     12 + ScanType string
     13 + ScanStatus string
     14 + CompletedHosts []string
     15 + ScanProgress int
     16 + ScanResults []SVDBHost
    16 17  }
    17 18   
  • ■ ■ ■ ■ ■ ■
    Engine/lib/SendToQueue.go
     1 +package lib
     2 + 
     3 +import (
     4 + "encoding/json"
     5 + 
     6 + "github.com/streadway/amqp"
     7 +)
     8 + 
     9 +func SendToQueue(scanRequest ScanRequest, queueName string) {
     10 + //Connect to RabbitMQ
     11 + conn, err := ConnectToRabbitMQ()
     12 + failOnError(err, "Failed to connect to RabbitMQ")
     13 + defer conn.Close()
     14 + 
     15 + //Open a channel
     16 + ch, err := conn.Channel()
     17 + failOnError(err, "Failed to open a channel")
     18 + defer ch.Close()
     19 + 
     20 + //Declare a queue
     21 + q, err := ch.QueueDeclare(
     22 + queueName, // name
     23 + false, // durable
     24 + false, // delete when unused
     25 + false, // exclusive
     26 + false, // no-wait
     27 + nil, // arguments
     28 + )
     29 + failOnError(err, "Failed to declare a queue")
     30 + 
     31 + //Publish a message
     32 + body, err := json.Marshal(scanRequest)
     33 + failOnError(err, "Failed to marshal scan request")
     34 + err = ch.Publish(
     35 + "", // exchange
     36 + q.Name, // routing key
     37 + false, // mandatory
     38 + false, // immediate
     39 + amqp.Publishing{
     40 + DeliveryMode: amqp.Persistent,
     41 + ContentType: "text/plain",
     42 + Body: []byte(body),
     43 + })
     44 + failOnError(err, "Failed to publish a message")
     45 +}
     46 + 
     47 +func ConnectToRabbitMQ() (*amqp.Connection, error) {
     48 + //Connect to RabbitMQ
     49 + conn, err := amqp.Dial("amqp://guest:guest@rabbitmq:5672/")
     50 + return conn, err
     51 +}
     52 + 
  • ■ ■ ■ ■ ■ ■
    Engine/lib/lib.go
     1 +package lib
     2 + 
     3 +import "log"
     4 + 
     5 +func failOnError(err error, msg string) {
     6 + if err != nil {
     7 + log.Fatalf("%s: %s", msg, err)
     8 + }
     9 +}
     10 + 
  • ■ ■ ■ ■ ■ ■
    Engine/nmap.xml
     1 +<?xml version="1.0" encoding="UTF-8"?>
     2 +<!DOCTYPE nmaprun>
     3 +<?xml-stylesheet href="file:///opt/homebrew/bin/../share/nmap/nmap.xsl" type="text/xsl"?>
     4 +<!-- Nmap 7.92 scan initiated Thu Mar 16 21:51:36 2023 as: nmap -T4 -sV -O -&#45;script=vuln,vulners -oX nmap.xml 192.168.86.33 -->
     5 +<nmaprun scanner="nmap" args="nmap -T4 -sV -O -&#45;script=vuln,vulners -oX nmap.xml 192.168.86.33" start="1679021496" startstr="Thu Mar 16 21:51:36 2023" version="7.92" xmloutputversion="1.05">
     6 +<scaninfo type="syn" protocol="tcp" numservices="1000" services="1,3-4,6-7,9,13,17,19-26,30,32-33,37,42-43,49,53,70,79-85,88-90,99-100,106,109-111,113,119,125,135,139,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-445,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3389-3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5357,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9929,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389"/>
     7 +<verbose level="0"/>
     8 +<debugging level="0"/>
     9 +<prescript><script id="broadcast-avahi-dos" output="&#xa; Discovered hosts:&#xa; 224.0.0.251&#xa; After NULL UDP avahi packet DoS (CVE-2011-1002).&#xa; Hosts are all up (not vulnerable).&#xa;"/></prescript><hosthint><status state="up" reason="arp-response" reason_ttl="0"/>
     10 +<address addr="192.168.86.33" addrtype="ipv4"/>
     11 +<address addr="54:A0:50:70:AE:E0" addrtype="mac" vendor="Asustek Computer"/>
     12 +<hostnames>
     13 +</hostnames>
     14 +</hosthint>
     15 +<host starttime="1679021532" endtime="1679021611"><status state="up" reason="arp-response" reason_ttl="0"/>
     16 +<address addr="192.168.86.33" addrtype="ipv4"/>
     17 +<address addr="54:A0:50:70:AE:E0" addrtype="mac" vendor="Asustek Computer"/>
     18 +<hostnames>
     19 +<hostname name="sans-sec460.lan" type="PTR"/>
     20 +</hostnames>
     21 +<ports><extraports state="closed" count="995">
     22 +<extrareasons reason="reset" count="995" proto="tcp" ports="1,3-4,6-7,9,13,17,19-21,23-26,30,32-33,37,42-43,49,53,70,79,81-85,88-90,99-100,106,109-111,113,119,125,143-144,146,161,163,179,199,211-212,222,254-256,259,264,280,301,306,311,340,366,389,406-407,416-417,425,427,443-444,458,464-465,481,497,500,512-515,524,541,543-545,548,554-555,563,587,593,616-617,625,631,636,646,648,666-668,683,687,691,700,705,711,714,720,722,726,749,765,777,783,787,800-801,808,843,873,880,888,898,900-903,911-912,981,987,990,992-993,995,999-1002,1007,1009-1011,1021-1100,1102,1104-1108,1110-1114,1117,1119,1121-1124,1126,1130-1132,1137-1138,1141,1145,1147-1149,1151-1152,1154,1163-1166,1169,1174-1175,1183,1185-1187,1192,1198-1199,1201,1213,1216-1218,1233-1234,1236,1244,1247-1248,1259,1271-1272,1277,1287,1296,1300-1301,1309-1311,1322,1328,1334,1352,1417,1433-1434,1443,1455,1461,1494,1500-1501,1503,1521,1524,1533,1556,1580,1583,1594,1600,1641,1658,1666,1687-1688,1700,1717-1721,1723,1755,1761,1782-1783,1801,1805,1812,1839-1840,1862-1864,1875,1900,1914,1935,1947,1971-1972,1974,1984,1998-2010,2013,2020-2022,2030,2033-2035,2038,2040-2043,2045-2049,2065,2068,2099-2100,2103,2105-2107,2111,2119,2121,2126,2135,2144,2160-2161,2170,2179,2190-2191,2196,2200,2222,2251,2260,2288,2301,2323,2366,2381-2383,2393-2394,2399,2401,2492,2500,2522,2525,2557,2601-2602,2604-2605,2607-2608,2638,2701-2702,2710,2717-2718,2725,2800,2809,2811,2869,2875,2909-2910,2920,2967-2968,2998,3000-3001,3003,3005-3007,3011,3013,3017,3030-3031,3052,3071,3077,3128,3168,3211,3221,3260-3261,3268-3269,3283,3300-3301,3306,3322-3325,3333,3351,3367,3369-3372,3389-3390,3404,3476,3493,3517,3527,3546,3551,3580,3659,3689-3690,3703,3737,3766,3784,3800-3801,3809,3814,3826-3828,3851,3869,3871,3878,3880,3889,3905,3914,3918,3920,3945,3971,3986,3995,3998,4000-4006,4045,4111,4125-4126,4129,4224,4242,4279,4321,4343,4443-4446,4449,4550,4567,4662,4848,4899-4900,4998,5000-5004,5009,5030,5033,5050-5051,5054,5060-5061,5080,5087,5100-5102,5120,5190,5200,5214,5221-5222,5225-5226,5269,5280,5298,5357,5405,5414,5431-5432,5440,5500,5510,5544,5550,5555,5560,5566,5631,5633,5666,5678-5679,5718,5730,5800-5802,5810-5811,5815,5822,5825,5850,5859,5862,5877,5900-5904,5906-5907,5910-5911,5915,5922,5925,5950,5952,5959-5963,5987-5989,5998-6007,6009,6025,6059,6100-6101,6106,6112,6123,6129,6156,6346,6389,6502,6510,6543,6547,6565-6567,6580,6646,6666-6669,6689,6692,6699,6779,6788-6789,6792,6839,6881,6901,6969,7000-7002,7004,7007,7019,7025,7070,7100,7103,7106,7200-7201,7402,7435,7443,7496,7512,7625,7627,7676,7741,7777-7778,7800,7911,7920-7921,7937-7938,7999-8002,8007-8011,8021-8022,8031,8042,8045,8080-8090,8093,8099-8100,8180-8181,8192-8194,8200,8222,8254,8290-8292,8300,8333,8383,8400,8402,8443,8500,8600,8649,8651-8652,8654,8701,8800,8873,8888,8899,8994,9000-9003,9009-9011,9040,9050,9071,9080-9081,9090-9091,9099-9103,9110-9111,9200,9207,9220,9290,9415,9418,9485,9500,9502-9503,9535,9575,9593-9595,9618,9666,9876-9878,9898,9900,9917,9929,9943-9944,9968,9998-10004,10009-10010,10012,10024-10025,10082,10180,10215,10243,10566,10616-10617,10621,10626,10628-10629,10778,11110-11111,11967,12000,12174,12265,12345,13456,13722,13782-13783,14000,14238,14441-14442,15000,15002-15004,15660,15742,16000-16001,16012,16016,16018,16080,16113,16992-16993,17877,17988,18040,18101,18988,19101,19283,19315,19350,19780,19801,19842,20000,20005,20031,20221-20222,20828,21571,22939,23502,24444,24800,25734-25735,26214,27000,27352-27353,27355-27356,27715,28201,30000,30718,30951,31038,31337,32768-32785,33354,33899,34571-34573,35500,38292,40193,40911,41511,42510,44176,44442-44443,44501,45100,48080,49152-49161,49163,49165,49167,49175-49176,49400,49999-50003,50006,50300,50389,50500,50636,50800,51103,51493,52673,52822,52848,52869,54045,54328,55055-55056,55555,55600,56737-56738,57294,57797,58080,60020,60443,61532,61900,62078,63331,64623,64680,65000,65129,65389"/>
     23 +</extraports>
     24 +<port protocol="tcp" portid="22"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="ssh" product="OpenSSH" version="for_Windows_8.0" extrainfo="protocol 2.0" method="probed" conf="10"><cpe>cpe:/a:openbsd:openssh:for_windows_8.0</cpe></service></port>
     25 +<port protocol="tcp" portid="80"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="http" product="nginx" version="1.13.5" method="probed" conf="10"><cpe>cpe:/a:igor_sysoev:nginx:1.13.5</cpe></service><script id="http-csrf" output="Couldn&apos;t find any CSRF vulnerabilities."/><script id="http-dombased-xss" output="Couldn&apos;t find any DOM based XSS."/><script id="http-server-header" output="nginx/1.13.5"><elem>nginx/1.13.5</elem>
     26 +</script><script id="http-vuln-cve2011-3192" output="&#xa; VULNERABLE:&#xa; Apache byterange filter DoS&#xa; State: VULNERABLE&#xa; IDs: CVE:CVE-2011-3192 BID:49303&#xa; The Apache web server is vulnerable to a denial of service attack when numerous&#xa; overlapping byte ranges are requested.&#xa; Disclosure date: 2011-08-19&#xa; References:&#xa; https://www.tenable.com/plugins/nessus/55976&#xa; https://seclists.org/fulldisclosure/2011/Aug/175&#xa; https://www.securityfocus.com/bid/49303&#xa; https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-3192&#xa;"><table key="CVE-2011-3192">
     27 +<elem key="title">Apache byterange filter DoS</elem>
     28 +<elem key="state">VULNERABLE</elem>
     29 +<table key="ids">
     30 +<elem>CVE:CVE-2011-3192</elem>
     31 +<elem>BID:49303</elem>
     32 +</table>
     33 +<table key="description">
     34 +<elem>The Apache web server is vulnerable to a denial of service attack when numerous&#xa;overlapping byte ranges are requested.</elem>
     35 +</table>
     36 +<table key="dates">
     37 +<table key="disclosure">
     38 +<elem key="year">2011</elem>
     39 +<elem key="month">08</elem>
     40 +<elem key="day">19</elem>
     41 +</table>
     42 +</table>
     43 +<elem key="disclosure">2011-08-19</elem>
     44 +<table key="refs">
     45 +<elem>https://www.tenable.com/plugins/nessus/55976</elem>
     46 +<elem>https://seclists.org/fulldisclosure/2011/Aug/175</elem>
     47 +<elem>https://www.securityfocus.com/bid/49303</elem>
     48 +<elem>https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2011-3192</elem>
     49 +</table>
     50 +</table>
     51 +</script><script id="http-stored-xss" output="Couldn&apos;t find any stored XSS vulnerabilities."/></port>
     52 +<port protocol="tcp" portid="135"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="msrpc" product="Microsoft Windows RPC" ostype="Windows" method="probed" conf="10"><cpe>cpe:/o:microsoft:windows</cpe></service></port>
     53 +<port protocol="tcp" portid="139"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="netbios-ssn" product="Microsoft Windows netbios-ssn" ostype="Windows" method="probed" conf="10"><cpe>cpe:/o:microsoft:windows</cpe></service></port>
     54 +<port protocol="tcp" portid="445"><state state="open" reason="syn-ack" reason_ttl="128"/><service name="microsoft-ds" product="Microsoft Windows 7 - 10 microsoft-ds" extrainfo="workgroup: WORKGROUP" hostname="SANS-SEC460" ostype="Windows" method="probed" conf="10"><cpe>cpe:/o:microsoft:windows</cpe></service></port>
     55 +</ports>
     56 +<os><portused state="open" proto="tcp" portid="22"/>
     57 +<portused state="closed" proto="tcp" portid="1"/>
     58 +<portused state="closed" proto="udp" portid="34367"/>
     59 +<osmatch name="Microsoft Windows 10 1507 - 1607" accuracy="100" line="69497">
     60 +<osclass type="general purpose" vendor="Microsoft" osfamily="Windows" osgen="10" accuracy="100"><cpe>cpe:/o:microsoft:windows_10</cpe></osclass>
     61 +</osmatch>
     62 +</os>
     63 +<uptime seconds="614551" lastboot="Thu Mar 9 18:11:00 2023"/>
     64 +<distance value="1"/>
     65 +<tcpsequence index="250" difficulty="Good luck!" values="10DF7179,D3717665,BC0EC2A5,9AFA091D,D14D10FA,F2827789"/>
     66 +<ipidsequence class="Incremental" values="6BF3,6BF4,6BF6,6BF7,6BF8,6BF9"/>
     67 +<tcptssequence class="1000HZ" values="24A030FA,24A03158,24A031BF,24A03226,24A0328E,24A032F7"/>
     68 +<hostscript><script id="smb-vuln-ms10-054" output="false">false</script><script id="smb-vuln-ms17-010" output="&#xa; VULNERABLE:&#xa; Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)&#xa; State: VULNERABLE&#xa; IDs: CVE:CVE-2017-0143&#xa; Risk factor: HIGH&#xa; A critical remote code execution vulnerability exists in Microsoft SMBv1&#xa; servers (ms17-010).&#xa; &#xa; Disclosure date: 2017-03-14&#xa; References:&#xa; https://technet.microsoft.com/en-us/library/security/ms17-010.aspx&#xa; https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/&#xa; https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-0143&#xa;"><table key="CVE-2017-0143">
     69 +<elem key="title">Remote Code Execution vulnerability in Microsoft SMBv1 servers (ms17-010)</elem>
     70 +<elem key="state">VULNERABLE</elem>
     71 +<table key="ids">
     72 +<elem>CVE:CVE-2017-0143</elem>
     73 +</table>
     74 +<table key="description">
     75 +<elem>A critical remote code execution vulnerability exists in Microsoft SMBv1&#xa; servers (ms17-010).&#xa; </elem>
     76 +</table>
     77 +<table key="dates">
     78 +<table key="disclosure">
     79 +<elem key="year">2017</elem>
     80 +<elem key="month">03</elem>
     81 +<elem key="day">14</elem>
     82 +</table>
     83 +</table>
     84 +<elem key="disclosure">2017-03-14</elem>
     85 +<table key="refs">
     86 +<elem>https://technet.microsoft.com/en-us/library/security/ms17-010.aspx</elem>
     87 +<elem>https://blogs.technet.microsoft.com/msrc/2017/05/12/customer-guidance-for-wannacrypt-attacks/</elem>
     88 +<elem>https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-0143</elem>
     89 +</table>
     90 +</table>
     91 +</script><script id="samba-vuln-cve-2012-1182" output="NT_STATUS_ACCESS_DENIED">false</script><script id="smb-vuln-ms10-061" output="NT_STATUS_ACCESS_DENIED">false</script></hostscript><times srtt="7338" rttvar="995" to="100000"/>
     92 +</host>
     93 +<runstats><finished time="1679021611" timestr="Thu Mar 16 21:53:31 2023" summary="Nmap done at Thu Mar 16 21:53:31 2023; 1 IP address (1 host up) scanned in 115.20 seconds" elapsed="115.20" exit="success"/><hosts up="1" down="0" total="1"/>
     94 +</runstats>
     95 +</nmaprun>
     96 + 
  • ■ ■ ■ ■ ■ ■
    Engine/nmaptest.go
     1 +package main
     2 + 
     3 +import (
     4 + "encoding/xml"
     5 + "fmt"
     6 + "io/ioutil"
     7 + "os"
     8 + 
     9 + "github.com/lair-framework/go-nmap"
     10 +)
     11 + 
     12 +type Service struct {
     13 + // Define the Service struct fields
     14 +}
     15 + 
     16 +type SiriusAgent struct {
     17 + // Define the SiriusAgent struct fields
     18 +}
     19 + 
     20 +type SVDBHost struct {
     21 + OS string `json:"os"`
     22 + OSVersion string `json:"osversion"`
     23 + IP string `json:"ip"`
     24 + Hostname string `json:"hostname"`
     25 + Services []Service `json:"services"`
     26 + CVE []string `json:"cve"`
     27 + CPE []string `json:"cpe"`
     28 + Agent SiriusAgent `json:"agent"`
     29 +}
     30 + 
     31 +func main() {
     32 + if len(os.Args) != 2 {
     33 + fmt.Println("Usage: go run main.go <nmap_xml_file>")
     34 + os.Exit(1)
     35 + }
     36 + 
     37 + filePath := os.Args[1]
     38 + svdbHost, err := parseNmapXML(filePath)
     39 + if err != nil {
     40 + fmt.Printf("Error: %v\n", err)
     41 + os.Exit(1)
     42 + }
     43 + 
     44 + // Use the svdbHost as needed
     45 + fmt.Printf("%+v\n", svdbHost)
     46 +}
     47 + 
     48 +func parseNmapXML(filePath string) (*SVDBHost, error) {
     49 + data, err := ioutil.ReadFile(filePath)
     50 + if err != nil {
     51 + return nil, fmt.Errorf("unable to read file: %v", err)
     52 + }
     53 + 
     54 + var nmapRun nmap.NmapRun
     55 + if err := xml.Unmarshal(data, &nmapRun); err != nil {
     56 + return nil, fmt.Errorf("unable to unmarshal XML data: %v", err)
     57 + }
     58 + 
     59 + if len(nmapRun.Hosts) == 0 {
     60 + return nil, fmt.Errorf("no hosts found in the nmap XML data")
     61 + }
     62 + 
     63 + host := nmapRun.Hosts[0]
     64 + var ip string
     65 + for _, address := range host.Addresses {
     66 + if address.AddrType == "ipv4" || address.AddrType == "ipv6" {
     67 + ip = address.Addr
     68 + break
     69 + }
     70 + }
     71 + 
     72 + var osName, osVersion string
     73 + if len(host.Os.OsMatches) > 0 {
     74 + osMatch := host.Os.OsMatches[0]
     75 + osName = osMatch.Name
     76 + osVersion = osMatch.OsClasses[0].OsGen
     77 + }
     78 + 
     79 + svdbHost := &SVDBHost{
     80 + IP: ip,
     81 + Hostname: host.Hostnames[0].Name,
     82 + OS: osName,
     83 + OSVersion: osVersion,
     84 + }
     85 + 
     86 + // Parse the services, CPEs, CVEs, and agent data as needed
     87 + // and fill in the corresponding fields in the SVDBHost struct
     88 + 
     89 + return svdbHost, nil
     90 +}
     91 + 
  • ■ ■ ■ ■ ■ ■
    Engine/sirius.go
    skipped 5 lines
    6 6   "fmt"
    7 7   "log"
    8 8   
    9  - core "github.com/0sm0s1z/Sirius-Scan/Engine/core"
    10  - lib "github.com/0sm0s1z/Sirius-Scan/Engine/lib"
    11 9   "github.com/streadway/amqp"
     10 + 
     11 + core "github.com/0sm0s1z/Sirius-Scan/Engine/core"
     12 + scanners "github.com/0sm0s1z/Sirius-Scan/Engine/core/scanners"
     13 + sirius "github.com/0sm0s1z/Sirius-Scan/Engine/lib"
    12 14  )
    13 15   
    14 16  func failOnError(err error, msg string) {
    skipped 46 lines
    61 63   go func() {
    62 64   for d := range msgs {
    63 65   // Execute & Manage scans based on massage contents
    64  - var scanRequest lib.ScanRequest
     66 + var scanRequest sirius.ScanRequest
    65 67   err := json.Unmarshal(d.Body, &scanRequest)
    66 68   if err != nil {
    67 69   fmt.Println("JSON Unmarshal format error!", err)
    skipped 8 lines
    76 78   go func() {
    77 79   core.NewScan(scanRequest)
    78 80   }()
    79  - case "report":
    80  - // Stop the scan
    81  - log.Println("Scan Stopped")
    82  - case "scanDiscovery":
    83  - // Stop the scan
    84  - log.Println("Scan Stopped")
    85 81   case "scanVulnerability":
    86  - // Stop the scan
    87  - log.Println("Scan Stopped")
     82 + log.Println("=== Vulnerability Scanning: " + scanRequest.ScanReport.ScanResults[len(scanRequest.ScanReport.ScanResults)-1].IP + " ===")
     83 + go scanners.VulnerabilityScanner(scanRequest)
    88 84   }
    89 85   }
    90 86   }()
    skipped 5 lines
  • ■ ■ ■ ■ ■ ■
    Engine/test.go
     1 +package main
     2 + 
     3 +import (
     4 + "fmt"
     5 + "log"
     6 + "net"
     7 + "os"
     8 + "strings"
     9 + "time"
     10 +)
     11 + 
     12 +func main() {
     13 + if len(os.Args) != 2 {
     14 + fmt.Println("Usage: go run main.go <IP or hostname>")
     15 + os.Exit(1)
     16 + }
     17 + 
     18 + host := os.Args[1]
     19 + port := "80"
     20 + timeout := 3 * time.Second
     21 + 
     22 + isOnline, err := checkHostOnline(host, port, timeout)
     23 + 
     24 + if err != nil {
     25 + fmt.Printf("Error: %v\n", err)
     26 + os.Exit(1)
     27 + }
     28 + 
     29 + if isOnline {
     30 + fmt.Printf("Host %s is online\n", host)
     31 + } else {
     32 + fmt.Printf("Host %s is offline\n", host)
     33 + }
     34 +}
     35 + 
     36 +func checkHostOnline(host, port string, timeout time.Duration) (bool, error) {
     37 + conn, err := net.DialTimeout("tcp", net.JoinHostPort(host, port), timeout)
     38 + if err != nil {
     39 + if strings.Contains(err.Error(), "refused") {
     40 + return true, nil
     41 + } else if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
     42 + log.Println(err)
     43 + return false, nil
     44 + } else {
     45 + return false, err
     46 + }
     47 + }
     48 + 
     49 + conn.Close()
     50 + return true, nil
     51 +}
     52 + 
  • ■ ■ ■ ■
    Engine/tmp/build-errors.log
    1  -exit status 2exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1
     1 +exit status 2exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 2exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 2exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1
  • Engine/tmp/sirius
    Binary file.
  • ■ ■ ■ ■ ■ ■
    UI/Dockerfile
    skipped 1 lines
    2 2  
    3 3  FROM node:18-alpine
    4 4  WORKDIR /app
    5  -#COPY . .
    6 5   
    7 6  # The package files should use Docker cache system
    8 7  # To ensure that dependencies are not overwritten by the local files (OS Compatibility)
    9 8  COPY package*.json .
    10 9  COPY yarn.lock .
    11 10   
    12  -#RUN yarn install
    13 11  RUN yarn add vite
     12 +RUN yarn install
    14 13   
    15  -RUN yarn install
     14 +# Bundle app source
     15 +COPY . /app
    16 16  CMD ["yarn", "run", "dev"]
    17 17   
    18 18  EXPOSE 5173
  • ■ ■ ■ ■ ■ ■
    UI/config.json
     1 +{
     2 + "server": {
     3 + "port": "8080",
     4 + "host": "192.168.86.29"
     5 + }
     6 +}
  • ■ ■ ■ ■ ■ ■
    UI/package.json
    skipped 8 lines
    9 9   "preview": "vite preview"
    10 10   },
    11 11   "dependencies": {
     12 + "@emotion/react": "^11.10.6",
     13 + "@emotion/styled": "^11.10.6",
    12 14   "@fortawesome/fontawesome-svg-core": "^6.2.1",
    13 15   "@fortawesome/free-brands-svg-icons": "^6.2.1",
    14 16   "@fortawesome/free-solid-svg-icons": "^6.2.1",
    15 17   "@fortawesome/react-fontawesome": "^0.2.0",
     18 + "@mui/icons-material": "^5.11.11",
     19 + "@mui/material": "^5.11.12",
     20 + "json-loader": "^0.5.7",
     21 + "material-react-table": "^1.8.5",
    16 22   "ra-data-json-server": "^4.6.2",
    17 23   "react": "^18.2.0",
    18 24   "react-admin": "^4.6.2",
    skipped 13 lines
  • ■ ■ ■ ■ ■
    UI/src/App.tsx
    skipped 35 lines
    36 36   
    37 37  const theme = {
    38 38   ...defaultTheme,
     39 + default: {
     40 + fontSize: 20,
     41 + },
    39 42   palette: {
    40 43   primary: {
    41 44   main: '#428dd1',
    skipped 5 lines
    47 50   default: '#eaeaea',
    48 51   },
    49 52   },
    50  - MuiTextField: {
    51  - root: {
    52  - color: 'white',
    53  - },
     53 + typography: {
     54 + fontSize: 16,
     55 + fontFamily: [
     56 + 'Roboto',
     57 + 'Helvetica',
     58 + 'Arial',
     59 + 'sans-serif',
     60 + ].join(','),
     61 + },
     62 + MuiCard: {
     63 + root: {
     64 + backgroundColor: 'blue',
     65 + },
    54 66   },
     67 + MuiTextField: {
     68 + root: {
     69 + color: 'white',
     70 + },
     71 + },
    55 72  };
    56 73   
    57 74  const App = () => (
    skipped 25 lines
  • UI/src/assets/sirius-logo.png
  • ■ ■ ■ ■ ■ ■
    UI/src/core/components/Layout.tsx
    skipped 9 lines
    10 10   const { children } = props;
    11 11   return (
    12 12   <>
    13  - <CssBaseline />
    14  - <Nav />
    15  - <Container sx={{ maxWidth: { xl: 1280 } }}>
    16  - <main id="main-content">
    17  - {/* @ts-ignore */}
     13 + <Container sx={{backgroundColor: '#eaeaea', height: '100vh'}}>
     14 + <CssBaseline />
     15 + <Nav />
     16 + {/* @ts-ignore */}
     17 + <Container sx={{
     18 + position: 'absolute',
     19 + top: 0,
     20 + left: 0,
     21 + right: 0,
     22 + bottom: 0,
     23 + marginTop: 8,
     24 + }}>
    18 25   <ErrorBoundary FallbackComponent={Error}>
    19 26   {children}
    20 27   </ErrorBoundary>
    21  - </main>
     28 + </Container>
    22 29   </Container>
    23 30   </>
    24 31   );
    skipped 7 lines
  • ■ ■ ■ ■ ■ ■
    UI/src/core/components/Login.tsx
    1 1  // in src/Login.js
    2 2  import * as React from 'react';
    3  -import { useState } from 'react';
     3 +import { useState, useEffect } from 'react';
    4 4  import { useLogin, useNotify, Notification } from 'react-admin';
    5 5   
    6 6  import { alpha, styled } from '@mui/material/styles';
    skipped 19 lines
    26 26   
    27 27  import LinearProgress, { linearProgressClasses, LinearProgressProps } from '@mui/material/LinearProgress';
    28 28   
    29  -import FilledInput from '@mui/material/FilledInput';
    30  -import FormControl from '@mui/material/FormControl';
    31  -import FormHelperText from '@mui/material/FormHelperText';
    32  -import Input from '@mui/material/Input';
    33  -import InputLabel from '@mui/material/InputLabel';
    34  -import OutlinedInput from '@mui/material/OutlinedInput';
    35  - 
    36  - 
    37  -import green from '@mui/material/colors/green';
    38  - 
    39 29   
    40 30  import loginbg from '../../assets/loginbg.jpg';
    41 31  import siriusscan from '../../assets/sirius-scan.png';
     32 + 
     33 +import config from '../../../config.json';
    42 34   
    43 35  const Login = ({ theme }) => {
    44 36   const [initialStartup, setInitialStartup] = useState(false);
    45 37   const [email, setEmail] = useState('');
    46 38   const [password, setPassword] = useState('');
    47  - const [progress, setProgress] = React.useState(0);
     39 + const [progress, setProgress] = useState(0);
     40 + const [serverProgress, setServerProgress] = useState(0);
     41 + const [phase, setPhase] = useState('');
    48 42   const login = useLogin();
    49 43   const notify = useNotify();
    50 44   
    51 45   
    52 46   //Check if first time startup
    53  - React.useEffect(() => {
    54  - var checktime = 1000;
     47 + useEffect(() => {
     48 + setInitialStartup(true);
     49 + var checktime = 5000;
    55 50   //Make API get request to get current system status
    56 51   setInterval(() => {
    57  - fetch('http://localhost:8080/api/status')
     52 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/status')
    58 53   .then((response) => response.json())
    59 54   .then((data) => {
    60  - if (data.status == "Initializing") {
    61  - setInitialStartup(true);
     55 + if (data.status == "Initializing" || data.status == "init") {
     56 + console.log(data.tasks[0].task_name);
     57 + setServerProgress(data.tasks[0].task_progress);
     58 + setPhase(data.tasks[0].task_name)
     59 + } else if (data.status == "init") {
     60 + console.log(data.status);
    62 61   } else {
    63 62   setInitialStartup(false);
    64  - checktime = 10000;
     63 + checktime = 60000;
    65 64   }
    66 65   console.log(data);
    67 66   });
    68 67   }, checktime);
     68 +
    69 69   }, [])
    70 70   
    71 71   
    72  - React.useEffect(() => {
     72 + useEffect(() => {
    73 73   const timer = setInterval(() => {
    74  - setProgress((prevProgress) => (prevProgress >= 99 ? 1 : prevProgress + 1));
    75  - }, 200);
     74 + console.log("Progress: " + progress + " Server Progress: " + serverProgress)
     75 + if (progress < serverProgress) {
     76 + setProgress((prevProgress) => prevProgress + 1);
     77 + }
     78 + }, 1000);
    76 79   return () => {
    77  - clearInterval(timer);
    78  - };
    79  - }, []);
    80  - 
    81  - 
     80 + clearInterval(timer);
     81 + };
     82 + }, [progress, serverProgress]);
    82 83   
    83 84   
    84  - React.useEffect(() => {
    85  - const timer = setInterval(() => {
    86  - setInitialStartup(false);
    87  - }, 20000);
    88  - return () => {
    89  - clearInterval(timer);
    90  - };
    91  - }, []);
    92  - 
    93 85   const handleSubmit = e => {
    94 86   e.preventDefault();
    95  - login({ email, password }).catch(() =>
     87 + if (email === 'admin' && password === 'sirius') {
     88 + login({ email, password }).catch(() =>
     89 + notify('Invalid email or password')
     90 + );
     91 + } else {
    96 92   notify('Invalid email or password')
    97  - );
     93 + }
    98 94   };
    99 95   
    100 96   return (
    101 97   <Container sx={{backgroundImage: `url(${loginbg})`, backgroundPosition: "center", backgroundSize: "cover", minWidth: "100vw", minHeight: "100vh", alignItems: "center", justifyContent: "center", display: "flex", position: "absolute"}} component="main">
    102 98   {/* Show Loading Bar & Modal if first time startup */}
    103 99  
    104  - { initialStartup ? <FirstTimeStartup value={progress} startup={initialStartup} /> :
     100 + { initialStartup ? <FirstTimeStartup value={progress} phase={phase} startup={initialStartup} /> :
    105 101   <Container component="main" maxWidth="xs">
    106 102   <Box
    107 103   sx={{
    skipped 11 lines
    119 115   backdropFilter: "blur(10px)",
    120 116   justifyContent: "center",
    121 117   width: "450px",
    122  - height: "450px",
     118 + height: "500px",
    123 119   color: "white",
    124 120   }}
    125 121   >
    skipped 89 lines
    215 211  export default Login;
    216 212   
    217 213  // First Time Component
    218  -const FirstTimeStartup = (props: LinearProgressProps & { value: number }) => {
     214 +const FirstTimeStartup = (props: LinearProgressProps & { value: number } & {phase: string}) => {
    219 215   
    220 216   return (
    221 217   <>
    skipped 18 lines
    240 236   top: -60,
    241 237   color: '#f7c1ac',
    242 238   }}>
    243  - Downloading Vulnerability Data From NVD...
     239 + {props.phase}
    244 240   </Typography>
    245 241   <br />
    246 242   <LoadingBar value={props.value} />
    skipped 188 lines
  • ■ ■ ■ ■ ■
    UI/src/core/components/Nav.tsx
    skipped 18 lines
    19 19  import ListItemButton from '@mui/material/ListItemButton';
    20 20  import ListItemText from '@mui/material/ListItemText';
    21 21  import SettingsIcon from '@mui/icons-material/Settings';
     22 +import NotificationIcon from '@mui/icons-material/Notifications';
    22 23   
    23 24  import Header from './Header';
    24 25   
    25  -import logo from '../../assets/sirius.png';
     26 +import logo from '../../assets/sirius-logo.png';
    26 27   
    27  -const drawerWidth = 240;
     28 +const drawerWidth = 280;
    28 29   
    29 30  const openedMixin = (theme: Theme): CSSObject => ({
    30 31   width: drawerWidth,
    skipped 99 lines
    130 131   <Box display="flex" alignItems="center">
    131 132   <Box
    132 133   component="img"
    133  - sx={{ marginRight: '1em', height: 30 }}
     134 + sx={{ marginRight: '1em', height: 35 }}
    134 135   src={logo}
    135 136   />
    136 137   <Typography component="span" variant="h5">
    skipped 18 lines
    155 156   </Box>
    156 157   */}
    157 158   <Box display="flex">
     159 + <NotificationIcon sx={{
     160 + marginTop: 1.2,
     161 + cursor: 'pointer',
     162 + }} />
    158 163   <LoadingIndicator
    159 164   sx={{
    160 165   '& .RaLoadingIndicator-loader': {
    skipped 1 lines
    162 167   },
    163 168   }}
    164 169   />
     170 + 
    165 171   <UserMenu>
    166 172   <Logout />
    167 173   <MenuItem
    skipped 140 lines
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/InventoryNavigator.tsx
    skipped 10 lines
    11 11   
    12 12  import InventoryHost from "./containers/InventoryHost";
    13 13   
     14 +import config from '../../config.json';
     15 + 
    14 16  interface TabPanelProps {
    15 17   children?: React.ReactNode;
    16 18   index: number;
    skipped 6 lines
    23 25   
    24 26   React.useEffect(() => {
    25 27   //Get the list of hosts
    26  - fetch('http://localhost:8080/api/get/hosts')
     28 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/get/hosts')
    27 29   .then((response) => response.json())
    28 30   .then((data) => {
    29 31   setHostList(data);
    skipped 5 lines
    35 37   };
    36 38   
    37 39   return (
    38  - <Container sx={{marginTop: 8, marginLeft: 3}}>
     40 + <Container>
    39 41   <Card>
    40 42   {/* Navigator Tab Headers */}
    41 43   {value == 0 ?
    42  - <CardHeader sx={{ fontSize: 54 }} title="Inventory Navigator" subheader="Hosts" avatar={<LanIcon />} />
     44 + <CardHeader title="Inventory Navigator" subheader="Hosts" avatar={<LanIcon />} />
    43 45   : null}
    44 46   {value == 1 ?
    45 47   <CardHeader title="Inventory Navigator" subheader="Software Inventory" avatar={<HealingIcon />} />
    skipped 64 lines
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/IssuesNavigator.tsx
    skipped 11 lines
    12 12  import SiriusIssues from "./containers/SiriusIssues";
    13 13  import { HostFindingsDashboard } from "./components/Reporting";
    14 14   
     15 +import config from '../../config.json';
     16 + 
    15 17  interface TabPanelProps {
    16 18   children?: React.ReactNode;
    17 19   index: number;
    18 20   value: number;
    19 21   }
    20 22  
    21  -function TabPanel(props: TabPanelProps) {
    22  - const { children, value, index, ...other } = props;
    23  -
    24  - return (
    25  - <div>
    26  - {value === index && (
    27  - <Box>
    28  - {children}
    29  - </Box>
    30  - )}
    31  - </div>
    32  - );
    33  -}
    34  - 
    35  -function updateTab(value) {
    36  - const [newValue, setValue] = React.useState(0);
    37  - console.log("Updating tab");
    38  - setValue(value);
    39  -}
    40  -
    41  -function a11yProps(index: number) {
    42  - return {
    43  - id: `simple-tab-${index}`,
    44  - 'aria-controls': `simple-tabpanel-${index}`,
    45  - };
    46  -}
    47  -
    48  -function IssueTabs({value, handleChange}) {
    49  - return (
    50  - <Box>
    51  - <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
    52  - <Tabs value={value} onChange={handleChange} aria-label="">
    53  - <Tab label="Vulnerabilities" {...a11yProps(0)} />
    54  - <Tab label="Missing Patches" {...a11yProps(1)} />
    55  - <Tab label="Statistics" {...a11yProps(2)} />
    56  - </Tabs>
    57  - </Box>
    58  - <TabPanel value={value} index={0}>
    59  - 
    60  - <Box sx={{maxWidth: '650px', marginLeft: -5, marginTop: 2}}>
    61  - <HostFindingsDashboard />
    62  - </Box>
    63  - 
    64  - </TabPanel>
    65  - <TabPanel value={value} index={1}>
    66  - Item Two
    67  - </TabPanel>
    68  - <TabPanel value={value} index={2}>
    69  - Item Three
    70  - </TabPanel>
    71  - </Box>
    72  - );
    73  -}
    74  - 
    75 23  export default function IssuesNavigator() {
    76 24   const [value, setValue] = React.useState(0);
     25 + const [vulnList, setVulnList] = React.useState([]);
     26 + 
     27 + React.useEffect(() => {
     28 + //Get the list of vulnerabilities
     29 + //Make API post request to get the list of vulnerabilities for the ip parameter
     30 + const requestOptions = {
     31 + method: 'POST',
     32 + headers: { 'Content-Type': 'application/json' },
     33 + body: JSON.stringify({ ip: '' })
     34 + };
     35 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/svdb/report/vulnerability', requestOptions)
     36 + .then((response) => response.json())
     37 + .then((data) => {
     38 + setVulnList(data);
     39 + console.log("=======");
     40 + console.log(data);
     41 + });
     42 + }, [])
    77 43  
    78 44   const handleChange = (event: React.SyntheticEvent, newValue: number) => {
    79 45   setValue(newValue);
    skipped 1 lines
    81 47   };
    82 48   
    83 49   return (
    84  - <Container sx={{marginTop: 8, marginLeft: 3}}>
    85  - <Card>
     50 + <Container sx={{
     51 + justifyContent: 'left',
     52 + alignItems: 'left',
     53 + display: 'flex',
     54 + flexDirection: 'column',
     55 + }}>
     56 + <Card sx={{
     57 + borderRadius: 3,
     58 + boxShadow: 3,
     59 + minWidth: '1280px',
     60 + width: '100%',
     61 + }}>
    86 62   {value == 0 ?
    87 63   <CardHeader sx={{ fontSize: 54 }} title="Security Issues Navigator" subheader="Vulnerabilities" avatar={<BugReportIcon />} />
    88 64   : null}
    skipped 4 lines
    93 69   <CardHeader title="Security Issues Navigator" subheader="Statistics" avatar={<AnalyticsIcon />} />
    94 70   : null}
    95 71   <CardContent>
    96  - <IssueTabs value={value} handleChange={handleChange} />
     72 + <IssueTabs value={value} vulnList={vulnList} handleChange={handleChange} />
    97 73   </CardContent>
    98 74   {value == 0 ?
    99  - <SiriusIssues />
     75 + <SiriusIssues vulnList={vulnList} />
    100 76   : null}
    101 77   </Card>
    102 78   </Container>
    103 79   );
    104 80  }
     81 + 
     82 +function TabPanel(props: TabPanelProps) {
     83 + const { children, value, index, ...other } = props;
     84 + 
     85 + return (
     86 + <div>
     87 + {value === index && (
     88 + <Box>
     89 + {children}
     90 + </Box>
     91 + )}
     92 + </div>
     93 + );
     94 +}
     95 + 
     96 +function updateTab(value) {
     97 + const [newValue, setValue] = React.useState(0);
     98 + console.log("Updating tab");
     99 + setValue(value);
     100 +}
     101 + 
     102 +function a11yProps(index: number) {
     103 + return {
     104 + id: `simple-tab-${index}`,
     105 + 'aria-controls': `simple-tabpanel-${index}`,
     106 + };
     107 +}
     108 + 
     109 +function IssueTabs({value, vulnList, handleChange}) {
     110 + return (
     111 + <Box>
     112 + <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
     113 + <Tabs value={value} onChange={handleChange} aria-label="">
     114 + <Tab label="Vulnerabilities" {...a11yProps(0)} />
     115 + <Tab label="Missing Patches" {...a11yProps(1)} />
     116 + <Tab label="Dashboard" {...a11yProps(2)} />
     117 + </Tabs>
     118 + </Box>
     119 + <TabPanel value={value} index={0}>
     120 + 
     121 + <Box sx={{marginLeft: -5, marginTop: 2}}>
     122 + <HostFindingsDashboard vulnList={vulnList} />
     123 + </Box>
     124 + 
     125 + </TabPanel>
     126 + <TabPanel value={value} index={1}>
     127 + Patch tracking is not yet implemented but will launch with the Sirius agent!
     128 + </TabPanel>
     129 + <TabPanel value={value} index={2}>
     130 + Dashboard is not yet implemented. But it is coming soon!
     131 + </TabPanel>
     132 + </Box>
     133 + );
     134 +}
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/ScanControl.tsx
    skipped 10 lines
    11 11   
    12 12  import Scanner from "./containers/Scanner";
    13 13   
     14 +import config from '../../config.json';
     15 + 
    14 16  interface TabPanelProps {
    15 17   children?: React.ReactNode;
    16 18   index: number;
    skipped 6 lines
    23 25   
    24 26   React.useEffect(() => {
    25 27   //Get the list of hosts
    26  - fetch('http://localhost:8080/api/get/hosts')
     28 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/get/hosts')
    27 29   .then((response) => response.json())
    28 30   .then((data) => {
    29 31   setHostList(data);
    skipped 5 lines
    35 37   };
    36 38   
    37 39   return (
    38  - <Container sx={{marginTop: 8, marginLeft: 3}}>
     40 + <Container>
    39 41   <Card>
    40 42   {/* Navigator Tab Headers */}
    41 43   {value == 0 ?
    skipped 67 lines
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/SingleReport.tsx
    1  -import * as React from 'react';
     1 +import React, { useEffect, useState } from 'react';
    2 2  import { useSearchParams } from 'react-router-dom';
    3 3   
    4  -import { Card, CardContent, CardHeader, Paper } from "@mui/material";
    5  -import { Container } from "@mui/material";
    6  -import Box from '@mui/material/Box';
    7  -import Grid from '@mui/material/Grid';
     4 +import { Paper, Container, Box, Grid } from '@mui/material';
    8 5   
    9  -import { HostReportOverview, VulnReportOverview, ReportTitle, ReturnButton } from "./components/Reporting";
    10  -import HostReportTabs from "./components/HostReport";
    11  -import VulnReportTabs from "./components/VulnReport";
     6 +import {
     7 + VulnReportOverview,
     8 + ReportTitle,
     9 + ReturnButton,
     10 +} from './components/Reporting';
    12 11   
     12 +import { HostReportOverview } from './components/Reporting/HostReportOverview';
     13 +import HostReportTabs from './components/HostReport';
     14 +import VulnReportTabs from './components/VulnReport';
     15 + 
     16 +import { getHost, hostReport } from './api/api';
     17 +import { Vulnerability } from './api/types';
     18 + 
     19 +import config from '../../config.json';
    13 20   
    14 21  export default function SingleReport() {
    15  - const [value, setValue] = React.useState(0);
     22 + const [value, setValue] = useState(0);
     23 + const [vuln, setVuln] = useState<Vulnerability>();
     24 + const [vulnList, setVulnList] = useState([]);
     25 + const [hostData, setHostData] = useState<any>();
    16 26   
    17  - const handleChange = (event: React.SyntheticEvent, newValue: number) => {
    18  - setValue(newValue);
    19  - };
     27 + const handleChange = (event: React.SyntheticEvent, newValue: number) => {
     28 + setValue(newValue);
     29 + };
     30 + 
     31 + const [queryParameters] = useSearchParams();
     32 + const r = window.location.href.split('?')[0].split('/').pop();
     33 + const reportType = r.charAt(0).toUpperCase() + r.slice(1);
    20 34   
    21  - //Get the report type from the URL
    22  - const [queryParameters] = useSearchParams()
    23  - const r = window.location.href.split("?")[0].split("/").pop()
    24  - const reportType = r.charAt(0).toUpperCase() + r.slice(1)
     35 + const reportTitle = `${reportType} Report`;
    25 36   
    26  - const reportTitle = reportType + " Report";
     37 + useEffect(() => {
     38 + if (reportType === 'Host') {
     39 + hostReport(queryParameters.get('ip')).then((data: any) => setVulnList(data));
     40 + getHost(queryParameters.get('ip')).then((data: any) => setHostData(data));
     41 + } else if (reportType === 'Vulnerability') {
     42 + const requestOptions = {
     43 + method: 'POST',
     44 + headers: { 'Content-Type': 'application/json' },
     45 + body: JSON.stringify({ CVE: [queryParameters.get('id')] }),
     46 + };
     47 + fetch(`http://${config.server.host}:${config.server.port}/api/svdb/get/finding`, requestOptions)
     48 + .then((response) => response.json())
     49 + .then((data) => {
     50 + setVuln(data[0]);
     51 + });
     52 + }
     53 + }, [reportType, queryParameters]);
    27 54   
    28  - return (
    29  - <Container sx={{marginTop: 8, marginLeft: 3}}>
    30  - <Paper>
    31  - <Box sx={{
    32  - backgroundColor: "primary.main",
    33  - }}>
    34  - <Grid container>
    35  - <Grid xs={1.3}>
    36  - <ReturnButton />
    37  - </Grid>
    38  - <Grid xs={4}>
    39  - <ReportTitle title={reportTitle} />
    40  - </Grid>
    41  - </Grid>
    42  - </Box>
    43  - <Box sx={{
    44  - }}>
    45  - {reportType == "Host"
    46  - ?
    47  - <div>
    48  - <HostReportOverview title={reportTitle} />
    49  - <HostReportTabs value={value} handleChange={handleChange} />
    50  - </div>
    51  - : null
    52  - }
    53  - {reportType == "Vulnerability"
    54  - ?
    55  - <div>
    56  - <VulnReportOverview title={reportTitle} />
    57  - <VulnReportTabs value={value} handleChange={handleChange} />
    58  - </div>
    59  - : null
    60  - }
     55 + const renderContent = () => {
     56 + if (reportType === 'Host') {
     57 + return (
     58 + <>
     59 + <HostReportOverview hostData={hostData} vulnList={vulnList} />
     60 + <HostReportTabs value={value} handleChange={handleChange} />
     61 + </>
     62 + );
     63 + } else if (reportType === 'Vulnerability') {
     64 + return (
     65 + <>
     66 + <VulnReportOverview vuln={vuln} />
     67 + <VulnReportTabs value={value} handleChange={handleChange} />
     68 + </>
     69 + );
     70 + }
     71 + return null;
     72 + };
    61 73   
    62  - </Box>
    63  - </Paper>
    64  - </Container>
    65  - );
     74 + return (
     75 + <Container>
     76 + <Paper>
     77 + <Box sx={{ backgroundColor: 'primary.main' }}>
     78 + <Grid container>
     79 + <Grid item xs={1.3}>
     80 + <ReturnButton />
     81 + </Grid>
     82 + <Grid item xs={4}>
     83 + <ReportTitle title={reportTitle} />
     84 + </Grid>
     85 + </Grid>
     86 + </Box>
     87 + <Box>{renderContent()}</Box>
     88 + </Paper>
     89 + </Container>
     90 + );
    66 91  }
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/api/api.js
     1 +// Description: This file contains all the API calls for the UI
     2 +// Each call returns a promise that can be used to handle the response
     3 +// Example usage: hostReport("192.168.1.1").then((data: any) => console.log(data));
     4 + 
     5 + 
     6 +import config from '../../../config.json';
     7 + 
     8 +export function getHost(host) {
     9 + return new Promise((resolve) => {
     10 + console.log('Sirius API Call => getHost: ' + host)
     11 + const requestOptions = {
     12 + method: 'POST',
     13 + headers: { 'Content-Type': 'application/json' },
     14 + body: JSON.stringify({ ip: host })
     15 + };
     16 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/get/host', requestOptions)
     17 + .then((response) => response.json())
     18 + .then((data) => {
     19 + resolve(data)
     20 + });
     21 + })
     22 +}
     23 + 
     24 +export function hostReport(host) {
     25 + return new Promise((resolve) => {
     26 + console.log('Sirius API Call => hostReport: ' + host)
     27 + const requestOptions = {
     28 + method: 'POST',
     29 + headers: { 'Content-Type': 'application/json' },
     30 + body: JSON.stringify({ ip: host })
     31 + };
     32 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/svdb/report/host', requestOptions)
     33 + .then((response) => response.json())
     34 + .then((data) => {
     35 + resolve(data)
     36 + });
     37 + })
     38 +}
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/api/types.ts
     1 +export type Vulnerability = {
     2 + CVEDataMeta: {
     3 + ID: string,
     4 + ASSIGNER: string,
     5 + },
     6 + Description: {
     7 + description_data: [{
     8 + lang: string,
     9 + value: string,
     10 + }],
     11 + },
     12 + Impact: {
     13 + baseMetricV3: {
     14 + cvssV3: {
     15 + baseScore: number,
     16 + baseSeverity: string,
     17 + },
     18 + },
     19 + },
     20 +};
     21 + 
     22 +export type ScanRequest = {
     23 + scanID: string;
     24 + command: string;
     25 + targets: string[];
     26 + ScanReport: ScanReport;
     27 +};
     28 +export type ScanReport = {
     29 + scanID: string;
     30 + scanType: string;
     31 + scanStatus: string;
     32 + scanProgress: number;
     33 + CompletedHosts: string[];
     34 + ScanResults: SVDBHost[];
     35 +};
     36 +export type SVDBHost = {
     37 + hostname: string;
     38 + status: string;
     39 + ip: string;
     40 + os: string;
     41 + osVersion: string;
     42 +};
     43 + 
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/HostReport.tsx
    skipped 10 lines
    11 11  import HealingIcon from '@mui/icons-material/Healing';
    12 12  import AnalyticsIcon from '@mui/icons-material/Analytics';
    13 13   
     14 +import config from '../../../config.json';
    14 15   
    15 16  import VulnTable from "./VulnTable";
    16 17   
    skipped 16 lines
    33 34   headers: { 'Content-Type': 'application/json' },
    34 35   body: JSON.stringify({ ip: queryParameters.get("ip") })
    35 36   };
    36  - fetch('http://localhost:8080/api/svdb/report/host', requestOptions)
     37 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/svdb/report/host', requestOptions)
    37 38   .then((response) => response.json())
    38 39   .then((data) => {
    39 40   setVulnList(data);
    skipped 6 lines
    46 47   };
    47 48   
    48 49   return (
    49  - <div sx={{marginTop: 0, width: '100%'}}>
    50  - <Card>
    51  - {/* Navigator Tab Headers */}
    52  - 
    53  - <CardContent>
    54  - <HostTabs value={value} handleChange={handleChange} />
    55  - </CardContent>
    56  - 
    57  - {/* Navigator Tab Contents */}
    58  - {value == 0 ?
    59  - <VulnTable vulnList={vulnList}/>
    60  - : null}
     50 + <div sx={{ marginTop: 0, width: "100%" }}>
     51 + <Card>
     52 + {/* Navigator Tab Headers */}
     53 + <HostTabs value={value} vulnList={vulnList} handleChange={handleChange} />
    61 54   </Card>
    62 55   </div>
    63 56   );
    64 57  }
    65 58   
    66 59   
    67  -function HostTabs({value, handleChange}) {
    68  - return (
    69  - <Box>
    70  - <Box sx={{ borderBottom: 1, borderColor: 'divider' }}>
    71  - <Tabs value={value} onChange={handleChange} aria-label="">
    72  - <Tab label="Vulnerabilities" {...a11yProps(0)} />
    73  - <Tab label="Missing Patches" {...a11yProps(1)} />
    74  - <Tab label="Statistics" {...a11yProps(2)} />
    75  - </Tabs>
    76  - </Box>
    77  - <TabPanel value={value} index={0}>
    78  -
    79  - </TabPanel>
    80  - <TabPanel value={value} index={1}>
    81  - Item Two
    82  - </TabPanel>
    83  - <TabPanel value={value} index={2}>
    84  - Item Three
    85  - </TabPanel>
     60 +function HostTabs({ value, vulnList, handleChange }) {
     61 + return (
     62 + <Box>
     63 + <Box sx={{ borderBottom: 1, borderColor: "divider" }}>
     64 + <Tabs value={value} onChange={handleChange} aria-label="">
     65 + <Tab label="Vulnerabilities" {...a11yProps(0)} />
     66 + <Tab label="Missing Patches" {...a11yProps(1)} />
     67 + <Tab label="Statistics" {...a11yProps(2)} />
     68 + </Tabs>
    86 69   </Box>
    87  - );
    88  - }
     70 + <TabPanel value={value} index={0}>
     71 + <VulnTable vulnList={vulnList} />
     72 + </TabPanel>
     73 + <TabPanel value={value} index={1}>Item Two</TabPanel>
     74 + <TabPanel value={value} index={2}>Item Three</TabPanel>
     75 + </Box>
     76 + );
     77 +}
    89 78  
    90 79   function TabPanel(props: TabPanelProps) {
    91 80   const { children, value, index, ...other } = props;
    skipped 18 lines
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/HostTable.tsx
    skipped 28 lines
    29 29   const { row } = props;
    30 30   const [open, setOpen] = React.useState(false);
    31 31  
    32  - console.log(row);
    33  -
    34 32   return (
    35 33   <>
    36 34   {row}
    skipped 4 lines
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/Reporting/HostReportOverview.tsx
     1 +import { FunctionComponent } from 'react';
     2 +import { useSearchParams } from 'react-router-dom';
     3 +import { Grid, Box, Divider } from '@mui/material';
     4 +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
     5 +import { faWindows } from '@fortawesome/free-brands-svg-icons';
     6 + 
     7 +import { HostFindingsDashboard } from '../Reporting';
     8 +import OperatingSystemIcon from './OperatingSystemIcon';
     9 + 
     10 +type HostReportOverviewProps = {
     11 + vulnList: any[],
     12 + hostData: {
     13 + hostname?: string,
     14 + os?: string
     15 + } | undefined
     16 +};
     17 + 
     18 +export const HostReportOverview: FunctionComponent<HostReportOverviewProps> = ({ vulnList, hostData }) => {
     19 + const [queryParameters] = useSearchParams()
     20 + return (
     21 + <div>
     22 + <Grid>
     23 + <Box sx={{
     24 + fontSize: 30,
     25 + color: "white",
     26 + paddingTop: 1,
     27 + display: 'flex',
     28 + }}>
     29 + <HostFindingsDashboard vulnList={vulnList} />
     30 + </Box>
     31 + </Grid>
     32 + <Grid>
     33 + <Box sx={{
     34 + minWidth: 40,
     35 + height: 0,
     36 + fontSize: 30,
     37 + paddingTop: 2,
     38 + paddingLeft: 3,
     39 + paddingRight: 3,
     40 + display: 'flex',
     41 + }}>
     42 + <OperatingSystemIcon size={"3x"} osName={hostData?.os} />
     43 + <Box sx={{ paddingLeft: 30 }} />
     44 + </Box>
     45 + <Box sx={{
     46 + minWidth: 150,
     47 + minHeight: 40,
     48 + fontSize: 30,
     49 + paddingTop: 2,
     50 + paddingLeft: 17,
     51 + paddingRight: 1,
     52 + display: 'flex',
     53 + }}>
     54 + {hostData?.hostname}
     55 + </Box>
     56 + <Box sx={{
     57 + height: 50,
     58 + minWidth: 40,
     59 + minHeight: 40,
     60 + paddingLeft: 17
     61 + }}>
     62 + {hostData?.os}
     63 + </Box>
     64 + </Grid>
     65 + <Divider />
     66 + </div>
     67 + );
     68 +};
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/Reporting/OperatingSystemIcon.tsx
     1 +//Operating System Icon component that displays the OS icon based on the OS name
     2 +//Uses fontawesome icons
     3 + 
     4 +import React from 'react';
     5 +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
     6 +import { faWindows, faApple, faLinux } from '@fortawesome/free-brands-svg-icons';
     7 +import { faQuestionCircle } from '@fortawesome/free-solid-svg-icons';
     8 + 
     9 +interface OperatingSystemIconProps {
     10 + osName: string;
     11 +}
     12 + 
     13 +const OperatingSystemIcon: React.FC<OperatingSystemIconProps> = ({ size, osName }) => {
     14 + const getIcon = (os: string) => {
     15 + if (os?.toLowerCase().includes('windows')) {
     16 + return faWindows;
     17 + } else if (os?.toLowerCase().includes('mac') || os?.toLowerCase().includes('apple')) {
     18 + return faApple;
     19 + } else if (os?.toLowerCase().includes('linux')) {
     20 + return faLinux;
     21 + } else {
     22 + return faQuestionCircle;
     23 + }
     24 + };
     25 + 
     26 + const icon = getIcon(osName);
     27 + return icon ? <FontAwesomeIcon size={size} icon={icon} /> : null;
     28 +};
     29 + 
     30 +export default OperatingSystemIcon;
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/Reporting.tsx
     1 +import React, { useState } from 'react';
    1 2  import { useSearchParams } from 'react-router-dom';
     3 +import {useNavigate} from 'react-router-dom';
    2 4   
    3 5  import Box from '@mui/material/Box';
    4 6  import ArrowBackIcon from '@mui/icons-material/ArrowBack';
    skipped 3 lines
    8 10  import Item from '@mui/material/Grid';
    9 11   
    10 12  import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
    11  -import { faWindows } from '@fortawesome/free-brands-svg-icons';
     13 +import { faWindows, faLinux } from '@fortawesome/free-brands-svg-icons';
    12 14  import { faUser } from '@fortawesome/free-solid-svg-icons';
    13 15  import { solid, regular, brands, icon } from '@fortawesome/fontawesome-svg-core/import.macro'
    14 16   
    skipped 1 lines
    16 18  import "rsuite/dist/rsuite.min.css";
    17 19   
    18 20  export const ReturnButton = () => {
    19  - 
     21 + const navigate = useNavigate();
     22 + const prevPage = () => {
     23 + navigate(-1);
     24 + }
    20 25   return (
    21 26   <Box sx={{
    22 27   width: 90,
    skipped 7 lines
    30 35   opacity: [0.9, 0.8, 0.7],
    31 36   },
    32 37   cursor: 'pointer'
    33  - }}>
     38 + }}
     39 + onClick={prevPage}
     40 + >
    34 41   <ArrowBackIcon sx={{
    35 42   color: 'white',
    36 43   margin: 'auto',
    skipped 3 lines
    40 47   );
    41 48  };
    42 49   
    43  -export const HostFindingsDashboard = () => {
     50 +export const HostFindingsDashboard = (vulnList) => {
     51 + //From vulnList, count the number of each severity
     52 + var critical = 0;
     53 + var high = 0;
     54 + var medium = 0;
     55 + var low = 0;
     56 + var informational = 0;
     57 + var unknown = 0;
     58 + var total = 0;
     59 + 
     60 + if (vulnList.vulnList) {
     61 + vulnList.vulnList.map((vuln) => {
     62 + let severity = vuln.CVSSV3.baseSeverity.toLowerCase();
     63 + switch (severity) {
     64 + case "critical":
     65 + critical++;
     66 + break;
     67 + case "high":
     68 + high++;
     69 + break;
     70 + case "medium":
     71 + medium++;
     72 + break;
     73 + case "low":
     74 + low++;
     75 + break;
     76 + case "informational":
     77 + informational++;
     78 + break;
     79 + default:
     80 + unknown++;
     81 + break;
     82 + }
     83 + total++;
     84 + });
     85 + }
     86 + 
    44 87   
    45 88   return (
    46 89   <Grid sx={{marginLeft: 5}} spacing={1} container item xs={12}>
    47  - <Grid item xs={3}>
     90 + <Grid item xs={2}>
    48 91   <Box sx={{
    49 92   width: 150,
    50 93   borderBottom: '.2rem solid #bcd5ff',
    skipped 17 lines
    68 111   Critical
    69 112   </Typography>
    70 113   <Typography sx={{fontSize: 42, marginTop: '-15px'}} variant="button" display="block" gutterBottom>
    71  - 5
     114 + {critical}
    72 115   </Typography>
    73 116   </Box>
    74 117   </Grid>
    75  - <Grid item xs={3}>
     118 + <Grid item xs={2}>
    76 119   <Box sx={{
    77 120   width: 150,
    78 121   borderBottom: '.2rem solid #bcd5ff',
    skipped 17 lines
    96 139   High
    97 140   </Typography>
    98 141   <Typography sx={{fontSize: 42, marginTop: '-15px'}} variant="button" display="block" gutterBottom>
    99  - 13
     142 + {high}
    100 143   </Typography>
    101 144   </Box>
    102 145   </Grid>
    103  - <Grid item xs={3}>
     146 + <Grid item xs={2}>
    104 147   <Box sx={{
    105 148   width: 150,
    106 149   borderBottom: '.2rem solid #bcd5ff',
    skipped 17 lines
    124 167   Medium
    125 168   </Typography>
    126 169   <Typography sx={{fontSize: 42, marginTop: '-15px'}} variant="button" display="block" gutterBottom>
    127  - 86
     170 + {medium}
    128 171   </Typography>
    129 172   </Box>
    130 173   </Grid>
    131  - <Grid item xs={3}>
     174 + <Grid item xs={2}>
    132 175   <Box sx={{
    133 176   width: 150,
    134 177   borderBottom: '.2rem solid #bcd5ff',
    skipped 17 lines
    152 195   Low
    153 196   </Typography>
    154 197   <Typography sx={{fontSize: 42, marginTop: '-15px'}} variant="button" display="block" gutterBottom>
    155  - 129
     198 + {low}
    156 199   </Typography>
    157 200   </Box>
    158 201   </Grid>
     202 + { unknown > 0 ?
     203 + <Grid item xs={2}>
     204 + <Box sx={{
     205 + width: 150,
     206 + borderBottom: '.2rem solid #bcd5ff',
     207 + display: 'flex',
     208 + flexDirection: 'column',
     209 + justifyContent: 'center',
     210 + alignItems: "center",
     211 + color: '#fff',
     212 + height: 90,
     213 + minWidth: 40,
     214 + minHeight: 40,
     215 + display: 'flex',
     216 + backgroundColor: 'gray',
     217 + '&:hover': {
     218 + backgroundColor: '#ff8000',
     219 + opacity: [0.9, 0.8, 0.7],
     220 + },
     221 + cursor: 'pointer'
     222 + }}>
     223 + <Typography sx={{fontSize: 10, paddingTop: '15px'}} variant="button" display="block">
     224 + INFORMATIONAL
     225 + </Typography>
     226 + <Typography sx={{fontSize: 42, marginTop: '-15px'}} variant="button" display="block" gutterBottom>
     227 + {unknown}
     228 + </Typography>
     229 + </Box>
     230 + </Grid>
     231 + : null }
    159 232   </Grid>
    160 233   );
    161 234  };
    skipped 24 lines
    186 259   );
    187 260  };
    188 261   
    189  -export function HostReportOverview({title}) {
    190  - const [queryParameters] = useSearchParams()
     262 +export type Vulnerability = {
     263 + CVEDataMeta: {
     264 + ID: string,
     265 + ASSIGNER: string,
     266 + },
     267 + Description: {
     268 + description_data: [{
     269 + lang: string,
     270 + value: string,
     271 + }],
     272 + },
     273 + Impact: {
     274 + baseMetricV3: {
     275 + cvssV3: {
     276 + baseScore: number,
     277 + baseSeverity: string,
     278 + },
     279 + },
     280 + },
     281 + };
    191 282   
    192  - return (
    193  - <div>
    194  - <Grid>
    195  - <Box sx={{
    196  - minWidth: 40,
    197  - height: 0,
    198  - fontSize: 30,
    199  - paddingTop: 2,
    200  - paddingLeft: 3,
    201  - paddingRight: 1,
    202  - display: 'flex',
    203  - }}>
    204  - <FontAwesomeIcon size="3x" icon={faWindows} />
    205  - <Box sx={{
    206  - paddingLeft: 30,
    207  - }} />
    208  - <HostFindingsDashboard />
    209  - </Box>
    210  - <Box sx={{
    211  - minWidth: 500,
    212  - minHeight: 40,
    213  - fontSize: 30,
    214  - paddingTop: 2,
    215  - paddingLeft: 15,
    216  - paddingRight: 1,
    217  - display: 'flex',
    218  - }}>
    219  - WIN2k8svrDC1
    220  - </Box>
    221  - <Box sx={{
    222  - height: 50,
    223  - minWidth: 40,
    224  - minHeight: 40,
    225  - paddingLeft: 15
    226  - }}>
    227  - Windows Server 2008 R2 Standard
    228  - </Box>
    229  - </Grid>
    230  - <Divider />
    231  - </div>
    232  - );
    233  -};
    234 283   
    235  -export function VulnReportOverview({title}) {
     284 +export function VulnReportOverview(props: Vulnerability) {
    236 285   const [queryParameters] = useSearchParams()
    237 286   
     287 + if (props.vuln === undefined) {
     288 + return <div>Loading...</div>;
     289 + }
     290 + 
     291 + // switch case on severity
     292 + // if severity is high, then set color to red
     293 + switch (props.vuln.CVSSV3.baseSeverity) {
     294 + case "CRITICAL":
     295 + var color = {
     296 + primary: "black",
     297 + secondary: "#f7c1ac",
     298 + };
     299 + case "HIGH":
     300 + var color = {
     301 + primary: "red",
     302 + secondary: "#f7c1ac",
     303 + };
     304 + break;
     305 + case "MEDIUM":
     306 + var color = {
     307 + primary: "yellow",
     308 + secondary: "#f7c1ac",
     309 + };
     310 + break;
     311 + case "LOW":
     312 + var color = {
     313 + primary: "green",
     314 + secondary: "#f7c1ac",
     315 + };
     316 + break;
     317 + default:
     318 + var color = {
     319 + primary: "gray",
     320 + secondary: "#f7c1ac",
     321 + };
     322 + }
     323 + 
    238 324   const style = {
    239 325   width: 150,
    240 326   display: "inline-block",
    skipped 20 lines
    261 347   strokeLinecap="square"
    262 348   percent={80}
    263 349   status="active"
    264  - strokeColor="red"
    265  - trailColor="green"
     350 + strokeColor={color.primary}
     351 + trailColor={color.secondary}
    266 352   gapPosition="bottom"
    267 353   strokeLinecap="butt"
    268 354   strokeWidth={8}
    skipped 8 lines
    277 363   paddingLeft: 8,
    278 364   paddingRight: 1,
    279 365   }}>
    280  - HIGH
     366 + {props.vuln.CVSSV3.baseSeverity ? props.vuln.CVSSV3.baseSeverity : "INFO"}
     367 +
    281 368   </Box>
    282 369   </Box>
    283 370  
    skipped 3 lines
    287 374   minHeight: 150,
    288 375   paddingLeft: 30
    289 376   }}>
    290  - <h4>Sirius Threat Level 3</h4>
    291  - This vulnerability is rated as high severity. It is recommended that you take immediate action to remediate this vulnerability. An attacker with access to this vulnerability could exploit it to gain access to the system or network.
     377 + {props.vuln.CVSSV3.baseSeverity == "CRITICAL" ?
     378 + <div>
     379 + <h4>Sirius Threat Level 5</h4>
     380 + This vulnerability is rated as critical in severity. Immediate action is required to remediate this vulnerability. An attacker with access to this vulnerability could exploit it to actualize critical business risk!
     381 + </div>
     382 + : null}
     383 + {props.vuln.CVSSV3.baseSeverity == "HIGH" ?
     384 + <div>
     385 + <h4>Sirius Threat Level 4</h4>
     386 + This vulnerability is rated as high severity. It is recommended that you take immediate action to remediate this vulnerability. An attacker with access to this vulnerability could exploit it to gain access to the system or network.
     387 + </div>
     388 + : null}
     389 + {props.vuln.CVSSV3.baseSeverity == "MEDIUM" ?
     390 + <div>
     391 + <h4>Sirius Threat Level 3</h4>
     392 + This vulnerability is rated considered medium severity. It is recommended that you take action to remediate this vulnerability as soon as possible. Numerous medium vulnerabilities are often exploited together to gain access to the system or network.
     393 + </div>
     394 + : null}
     395 + {props.vuln.CVSSV3.baseSeverity == "LOW" ?
     396 + <div>
     397 + <h4>Sirius Threat Level 2</h4>
     398 + This vulnerability is rated as high severity. It is recommended that you take immediate action to remediate this vulnerability when time permits. Low rated vulnerabilities often indicate that the system or network is not properly configured or maintained and further vulnerabilities may exist.
     399 + </div>
     400 + : null}
     401 + {props.vuln.CVSSV3.baseSeverity ?
     402 + <></>
     403 + :
     404 + <div>
     405 + <h4>Sirius Threat Level 1</h4>
     406 + This vulnerability is listed for informational purposes only. No risk was directly identified by this condition. However, it is recommended that you take action to remediate this vulnerability as unforeseen circumstances could result in a higher risk.
     407 + </div>
     408 + }
     409 + 
    292 410   </Box>
    293 411   </Grid>
    294 412   <Divider />
    skipped 3 lines
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/ScanResults.tsx
     1 +import React, { Component, useCallback, useMemo } from 'react';
     2 +import {useHistory} from 'react-router-dom';
     3 +import {useNavigate} from 'react-router-dom';
     4 +import { Link } from 'react-router-dom';
     5 + 
     6 + 
     7 +import Box from '@mui/material/Box';
     8 +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
     9 +import { faWindows, faLinux } from '@fortawesome/free-brands-svg-icons';
     10 +import HelpCenterIcon from '@mui/icons-material/HelpCenter';
     11 +import LinearProgress, { linearProgressClasses, LinearProgressProps } from '@mui/material/LinearProgress';
     12 + 
     13 +import MaterialReactTable, {
     14 + MRT_ShowHideColumnsButton,
     15 + MRT_FullScreenToggleButton,
     16 + MRT_ToggleDensePaddingButton,
     17 + 
     18 +} from 'material-react-table';
     19 + 
     20 +import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
     21 +import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
     22 +import AddBox from '@mui/icons-material/AddBox';
     23 +import IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';
     24 +import UploadFileRoundedIcon from '@mui/icons-material/UploadFileRounded';
     25 + 
     26 +import { styled } from '@mui/material/styles';
     27 +import { createMuiTheme } from 'material-ui/styles';
     28 +import { VulnerabilityCount } from './VulnerabililtyTable/VulnerabilityCount';
     29 +import { VulnerabilityTableSearch } from './VulnerabililtyTable/VulnerabilityTableSearch';
     30 + 
     31 +import WifiTetheringErrorRoundedSharpIcon from '@mui/icons-material/WifiTetheringErrorRoundedSharp';
     32 +import NumbersIcon from '@mui/icons-material/Numbers';
     33 + 
     34 +import { ScanRequest } from '../api/types';
     35 + 
     36 +export default function ScanResults(props: { scanRequest: ScanRequest }) {
     37 + //Get the scan results from the props
     38 + const { scanRequest } = props;
     39 + console.log(scanRequest?.ScanReport);
     40 + 
     41 + let scanResults = scanRequest?.ScanReport?.ScanResults || [];
     42 + 
     43 + // For each host in scanResults, check to see if it is completed in the CompletedHosts array
     44 + // If it is completed, add the status to the host object
     45 + scanResults = scanResults.map((host) => {
     46 + const isCompleted = scanRequest?.ScanReport?.CompletedHosts?.includes(host.ip);
     47 + return {
     48 + ...host,
     49 + status: isCompleted ? 'Complete' : 'Scanning',
     50 + };
     51 + });
     52 + 
     53 + return (
     54 + <div className="rightcard">
     55 + <ScanTable data={scanResults} />
     56 + </div>
     57 + );
     58 +}
     59 + 
     60 +const ScanTable = (props: any) => {
     61 + const [filter, setFilter] = React.useState('');
     62 + const navigate = useNavigate();
     63 + const handleOnClick = useCallback((id: string) => navigate('/report/host?ip=' + id, {replace: false}), [navigate]);
     64 + 
     65 + console.log(props.data)
     66 + 
     67 + //should be memoized or stable
     68 + const columns = useMemo(
     69 + () => [
     70 + {
     71 + accessorFn: (row) => `${row.ip}`,
     72 + accessorKey: 'vulnerabilities',
     73 + header: <NumbersIcon />,
     74 + size: 5,
     75 + Cell: ({renderedCellValue, row}) => (
     76 + <Box
     77 + sx={{
     78 + display: 'flex',
     79 + alignItems: 'center',
     80 + gap: '1rem',
     81 + cursor: 'pointer',
     82 + }}
     83 + onClick={() => handleOnClick(row.ip)}
     84 + >
     85 + <VulnerabilityCount severity={row.ip} count={row.cve?.length} />
     86 + </Box>
     87 + ),
     88 + },
     89 + {
     90 + accessorKey: 'os', //access nested data with dot notation
     91 + header: 'OS',
     92 + size: 5,
     93 + Cell: ({renderedCellValue, row}) => (
     94 + <Box
     95 + sx={{
     96 + display: 'flex',
     97 + alignItems: 'center',
     98 + gap: '1rem',
     99 + cursor: 'pointer',
     100 + }}
     101 + onClick={() => handleOnClick(row.ip)}
     102 + >
     103 + {/* If os == windows give windows fa icon else linux */}
     104 + {row.os == "windows" ?
     105 + <FontAwesomeIcon size="2x" icon={faWindows} />
     106 + : row.os == "linux" ?
     107 + <FontAwesomeIcon size="2x" icon={faLinux} />
     108 + :
     109 + <HelpCenterIcon />
     110 + }
     111 + </Box>
     112 + ),
     113 + },
     114 + {
     115 + accessorFn: (row) => `${row.ip}`,
     116 + accessorKey: 'ip',
     117 + header: 'IP Address',
     118 + size: 10,
     119 + enableSorting: true,
     120 + sortAscFirst: true,
     121 + enableGlobalFilter: false,
     122 + Cell: ({renderedCellValue, row}) => (
     123 + <Box
     124 + sx={{
     125 + display: 'flex',
     126 + alignItems: 'center',
     127 + gap: '1rem',
     128 + cursor: 'pointer',
     129 + }}
     130 + onClick={() => handleOnClick(row.ip)}
     131 + >
     132 + <span>{renderedCellValue}</span>
     133 + </Box>
     134 + ),
     135 + },
     136 + {
     137 + accessorFn: (row) => `${row.hostname}`,
     138 + accessorKey: 'hostname', //access nested data with dot notation
     139 + header: 'Hostname',
     140 + size: 10,
     141 + Cell: ({renderedCellValue, row}) => (
     142 + <Box
     143 + sx={{
     144 + display: 'flex',
     145 + alignItems: 'center',
     146 + gap: '1rem',
     147 + cursor: 'pointer',
     148 + }}
     149 + onClick={() => handleOnClick(row.ip)}
     150 + >
     151 + {renderedCellValue}
     152 + </Box>
     153 + ),
     154 + },
     155 + {
     156 + accessorFn: (row) => `${row.status}`,
     157 + header: 'Status',
     158 + size: 10,
     159 + Cell: ({ renderedCellValue, row }) => (
     160 + <Box
     161 + sx={{
     162 + display: 'flex',
     163 + alignItems: 'center',
     164 + gap: '1rem',
     165 + cursor: 'pointer',
     166 + }}
     167 + onClick={() => handleOnClick(row.ip)}
     168 + >
     169 + <span>{renderedCellValue}</span>
     170 + </Box>
     171 + ),
     172 + },
     173 + {
     174 + accessorFn: (row) => `${row.status}`,
     175 + header: 'Progress',
     176 + size: 200,
     177 + Cell: ({ renderedCellValue, row }) => (
     178 + <span>
     179 + <LoadingBar loading={renderedCellValue !== "Complete"} />
     180 + </span>
     181 + ),
     182 + },
     183 + ],
     184 + [],
     185 + );
     186 + 
     187 + return <MaterialReactTable
     188 + columns={columns}
     189 + data={props.data}
     190 + enableColumnActions={false}
     191 + state={{
     192 + globalFilter: filter,
     193 + }}
     194 + muiTableHeadCellProps={{
     195 + //simple styling with the `sx` prop, works just like a style prop in this example
     196 + sx: {
     197 + fontWeight: 'bold',
     198 + fontSize: '14px',
     199 + },
     200 + }}
     201 + renderToolbarInternalActions={({ table }) => (
     202 + <>
     203 + {/* add your own custom print button or something */}
     204 + 
     205 + {/* built-in buttons (must pass in table prop for them to work!) */}
     206 + <MRT_ShowHideColumnsButton table={table} />
     207 + <MRT_FullScreenToggleButton table={table} />
     208 + <MRT_ToggleDensePaddingButton table={table} />
     209 + </>
     210 + )}
     211 + //add custom action buttons to top-left of top toolbar
     212 + renderTopToolbarCustomActions={({ table }) => (
     213 + <Box sx={{ display: 'flex', gap: '1rem', p: '4px' }}>
     214 +
     215 + </Box>
     216 + )}
     217 + />;
     218 +};
     219 + 
     220 +// Centered Loading Bar Component
     221 +const LoadingBar = ({loading}: {loading: bool}) => {
     222 + return (
     223 + <Box sx={{ width: '50%', display: 'flex', alignItems: 'center' }}>
     224 + <Box sx={{ width: '300px', mr: -10 }}>
     225 + {loading ?
     226 + <LoadingLinearProgress variant="indeterminate" />
     227 + :
     228 + <LoadingLinearProgress variant="determinate" value={100} />
     229 + }
     230 + </Box>
     231 + </Box>
     232 + )
     233 +}
     234 + 
     235 +const LoadingLinearProgress = styled(LinearProgress)(({ theme }) => ({
     236 + height: 20,
     237 + borderRadius: 4,
     238 + [`&.${linearProgressClasses.colorPrimary}`]: {
     239 + backgroundColor: '#eaeaea',
     240 + },
     241 + [`& .${linearProgressClasses.bar}`]: {
     242 + borderRadius: 4,
     243 + backgroundColor: theme.palette.mode === 'light' ? '#428dd1' : '#428dd1',
     244 + animationDuration: '2.5s',
     245 + },
     246 + }));
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/VulnDetails.tsx
    skipped 36 lines
    37 37   open: false,
    38 38   setOpen: false,
    39 39   };
    40  - this.props.vulnList.map((row) => console.log(row));
    41 40   }
    42 41   
    43 42   render() {
    44 43   return (
    45 44   <div>
    46  - {this.props.vulnList.map((row) => (
     45 + {this.props.vulnList && this.props.vulnList.map((row) => (
    47 46   <Card sx={{marginTop: -2, paddingLeft: 3}} key={row.CVEDataMeta.ID}>
    48 47   
    49 48   <Table sx={{maxWidth: '80%'}} aria-label="collapsible table">
    skipped 32 lines
    82 81   </Table>
    83 82   
    84 83   <br />
    85  - <h6>References</h6>
     84 + <Typography variant="h6" sx={{fontWeight: 'bold'}}>
     85 + References
     86 + </Typography>
     87 + <Typography variant="body1">
    86 88   {row.References.map((ref, i) => (
    87 89   <div key={i}>
    88 90   <li>
    skipped 1 lines
    90 92   </li>
    91 93   </div>
    92 94   ))}
     95 + </Typography>
    93 96   <Divider sx={{marginTop: 2, marginBottom: 2}} />
    94 97   
    95 98   </Card>
    skipped 6 lines
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/VulnReport.tsx
    skipped 11 lines
    12 12   
    13 13  import VulnDetails from "./VulnDetails";
    14 14   
     15 +import config from '../../../config.json';
     16 + 
    15 17  interface TabPanelProps {
    16 18   children?: React.ReactNode;
    17 19   index: number;
    skipped 13 lines
    31 33   headers: { 'Content-Type': 'application/json' },
    32 34   body: JSON.stringify({ CVE: [queryParameters.get("id")] })
    33 35   };
    34  - fetch('http://localhost:8080/api/svdb/get/finding', requestOptions)
     36 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/svdb/get/finding', requestOptions)
    35 37   .then((response) => response.json())
    36 38   .then((data) => {
    37 39   setVulnList(data);
    skipped 6 lines
    44 46   };
    45 47   
    46 48   return (
    47  - <div sx={{marginTop: 0, width: '100%'}}>
    48  - <Card>
    49  - {/* Navigator Tab Headers */}
     49 + <div sx={{ marginTop: 0, width: '100%' }}>
     50 + <Card>
     51 + {/* Navigator Tab Headers */}
    50 52   
    51  - <CardContent>
    52  - <HostTabs value={value} handleChange={handleChange} />
    53  - </CardContent>
     53 + <CardContent>
     54 + <HostTabs value={value} handleChange={handleChange} />
     55 + </CardContent>
    54 56   
    55  - {/* Navigator Tab Contents */}
    56  - {value == 0 ?
    57  - <VulnDetails vulnList={vulnList}/>
    58  - : null}
     57 + {/* Navigator Tab Contents */}
     58 + <VulnDetails vulnList={vulnList} hidden={value !== 0} />
     59 + {/* Add other components for other tabs here with similar hidden attribute logic */}
    59 60   </Card>
    60 61   </div>
    61 62   );
    skipped 10 lines
    72 73   <Tab label="Statistics" {...a11yProps(2)} />
    73 74   </Tabs>
    74 75   </Box>
    75  - <TabPanel value={value} index={0}>
    76  -
    77  - </TabPanel>
    78  - <TabPanel value={value} index={1}>
    79  - Item Two
    80  - </TabPanel>
    81  - <TabPanel value={value} index={2}>
    82  - Item Three
    83  - </TabPanel>
    84 76   </Box>
    85 77   );
    86 78   }
    skipped 21 lines
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/VulnTable-old.tsx
     1 +import React, { Component, useCallback, useMemo } from 'react';
     2 +import {useHistory} from 'react-router-dom';
     3 +import {useNavigate} from 'react-router-dom';
     4 +import { Link } from 'react-router-dom';
     5 + 
     6 +import Paper from '@mui/material/Paper';
     7 +import Card from '@mui/material/Card';
     8 +import Badge from '@mui/material/Badge';
     9 +import CardActions from '@mui/material/CardActions';
     10 +import CardContent from '@mui/material/CardContent';
     11 +import Typography from '@mui/material/Typography';
     12 +import Table from '@mui/material/Table';
     13 +import TableBody from '@mui/material/TableBody';
     14 +import TableCell from '@mui/material/TableCell';
     15 +import TableContainer from '@mui/material/TableContainer';
     16 +import TableHead from '@mui/material/TableHead';
     17 +import TableRow from '@mui/material/TableRow';
     18 +import Collapse from '@mui/material/Collapse';
     19 +import IconButton from '@mui/material/IconButton';
     20 +import Box from '@mui/material/Box';
     21 +import Checkbox from '@mui/material/Checkbox';
     22 +import TablePagination from '@mui/material/TablePagination';
     23 +import TableSortLabel from '@mui/material/TableSortLabel';
     24 + 
     25 +import MaterialReactTable from 'material-react-table';
     26 + 
     27 +import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
     28 +import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
     29 +import AddBox from '@mui/icons-material/AddBox';
     30 +import IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';
     31 +import UploadFileRoundedIcon from '@mui/icons-material/UploadFileRounded';
     32 + 
     33 +import { createMuiTheme } from 'material-ui/styles';
     34 + 
     35 +type VulnerabilityList = [{
     36 + CVEDataMeta: {
     37 + ID: string,
     38 + ASSIGNER: string,
     39 + },
     40 + Description: {
     41 + description_data: [{
     42 + lang: string,
     43 + value: string,
     44 + }],
     45 + },
     46 + Impact: {
     47 + baseMetricV3: {
     48 + cvssV3: {
     49 + baseScore: number,
     50 + baseSeverity: string,
     51 + },
     52 + },
     53 + },
     54 +}];
     55 + 
     56 +export default function VulnTable(props: any) {
     57 + const [pg, setpg] = React.useState(0);
     58 + const [rpg, setrpg] = React.useState(5);
     59 + 
     60 + function handleChangePage(event, newpage) {
     61 + setpg(newpage);
     62 + }
     63 + 
     64 + function handleChangeRowsPerPage(event) {
     65 + setrpg(parseInt(event.target.value, 10));
     66 + setpg(0);
     67 + }
     68 + 
     69 + 
     70 + //nested data is ok, see accessorKeys in ColumnDef below
     71 +const data = [
     72 + {
     73 + name: {
     74 + firstName: 'John',
     75 + lastName: 'Doe',
     76 + },
     77 + address: '261 Erdman Ford',
     78 + city: 'East Daphne',
     79 + state: 'Kentucky',
     80 + },
     81 + {
     82 + name: {
     83 + firstName: 'Jane',
     84 + lastName: 'Doe',
     85 + },
     86 + address: '769 Dominic Grove',
     87 + city: 'Columbus',
     88 + state: 'Ohio',
     89 + },
     90 + {
     91 + name: {
     92 + firstName: 'Joe',
     93 + lastName: 'Doe',
     94 + },
     95 + address: '566 Brakus Inlet',
     96 + city: 'South Linda',
     97 + state: 'West Virginia',
     98 + },
     99 + {
     100 + name: {
     101 + firstName: 'Kevin',
     102 + lastName: 'Vandy',
     103 + },
     104 + address: '722 Emie Stream',
     105 + city: 'Lincoln',
     106 + state: 'Nebraska',
     107 + },
     108 + {
     109 + name: {
     110 + firstName: 'Joshua',
     111 + lastName: 'Rolluffs',
     112 + },
     113 + address: '32188 Larkin Turnpike',
     114 + city: 'Charleston',
     115 + state: 'South Carolina',
     116 + },
     117 +];
     118 + 
     119 + 
     120 + return (
     121 + <div className="rightcard">
     122 + 
     123 + 
     124 + <Example data={props.vulnList} />
     125 + 
     126 + 
     127 + <TableContainer component={Paper}>
     128 + <Table aria-label="collapsible table">
     129 + <TableHead>
     130 + <TableRow>
     131 + <TableCell>
     132 + <Checkbox
     133 + color="primary"
     134 + inputProps={{
     135 + 'aria-label': 'select all desserts',
     136 + }}
     137 + />
     138 + </TableCell>
     139 + <TableCell>Vulnerability</TableCell>
     140 + <TableCell align="left">Description</TableCell>
     141 + {props.allHosts ? <TableCell align="left">Affected Systems</TableCell> : null }
     142 + <TableCell align="center">Severity</TableCell>
     143 + <TableCell align="center">CVSSv3</TableCell>
     144 + </TableRow>
     145 + </TableHead>
     146 + <TableBody>
     147 + {Array.isArray(props.vulnList) && props.vulnList.map((row: VulnerabilityList) => (
     148 + <Row key={row.CVEDataMeta.ID} row={row} />
     149 + ))}
     150 + </TableBody>
     151 + </Table>
     152 + <TablePagination
     153 + rowsPerPageOptions={[5, 10, 25]}
     154 + component="div"
     155 + count={props.vulnList.length}
     156 + rowsPerPage={rpg}
     157 + page={pg}
     158 + onPageChange={handleChangePage}
     159 + onRowsPerPageChange={handleChangeRowsPerPage}
     160 + />
     161 + </TableContainer>
     162 + 
     163 + </div>
     164 + );
     165 +}
     166 + 
     167 + 
     168 +{/* HostTable */}
     169 +function Row(props) {
     170 + const { row } = props;
     171 + const [open, setOpen] = React.useState(false);
     172 + 
     173 + 
     174 + const navigate = useNavigate();
     175 + const handleOnClick = useCallback((row) => navigate('/report/vulnerability?id=' + row.CVEDataMeta.ID, {replace: false}), [navigate]);
     176 + 
     177 + 
     178 + return (
     179 + <>
     180 + <TableRow sx={{ '&:last-child td, &:last-child th': { border: 0 } }} sx={{ '& > *': { borderBottom: 'unset', cursor: 'pointer' } }}>
     181 + <TableCell width="5%" component="th" scope="row">
     182 + <Checkbox />
     183 + </TableCell>
     184 + <TableCell width="20%" component="th" scope="row" onClick={() => handleOnClick(row)}>
     185 + {row.CVEDataMeta.ID}
     186 + </TableCell>
     187 + <TableCell width="65%" align="left" onClick={() => handleOnClick(row)}>
     188 + <Box sx={{ textOverflow: 'ellipsis' }}>
     189 + {row.Description.description_data[0].value.slice(0,75)}...
     190 + </Box>
     191 + </TableCell>
     192 + {row.AffectedHosts ? <TableCell width="5%" align="left">{row.AffectedHosts.length}</TableCell> : null}
     193 +
     194 + <TableCell width="5%" align="center" onClick={() => handleOnClick(row)}>{row.CVSSV3.baseSeverity}</TableCell>
     195 + <TableCell width="5%" align="center" onClick={() => handleOnClick(row)}>{row.CVSSV3.baseScore}</TableCell>
     196 + </TableRow>
     197 + </>
     198 + );
     199 +}
     200 + 
     201 + 
     202 +const Example = (props) => {
     203 + //should be memoized or stable
     204 + const columns = useMemo(
     205 + () => [
     206 + {
     207 + accessorKey: 'CVEDataMeta.ID', //access nested data with dot notation
     208 + header: 'Vulnerability',
     209 + },
     210 + {
     211 + accessorFn: (row) => `${row.Description.description_data[0].value}`,
     212 + header: 'Description',
     213 + Cell: ({ renderedCellValue, row }) => (
     214 + <Box
     215 + sx={{
     216 + display: 'flex',
     217 + alignItems: 'center',
     218 + gap: '1rem',
     219 + }}
     220 + >
     221 + {/* using renderedCellValue instead of cell.getValue() preserves filter match highlighting */}
     222 + <span>{renderedCellValue}</span>
     223 + </Box>
     224 + ),
     225 + },
     226 + {
     227 + accessorKey: 'AffectedHosts.length',
     228 + header: 'Affected Systems',
     229 + },
     230 + {
     231 + accessorKey: 'CVSSV3.baseSeverity',
     232 + header: 'Severity',
     233 + },
     234 + {
     235 + accessorKey: 'CVSSV3.baseScore',
     236 + header: 'CVSSv3',
     237 + },
     238 + ],
     239 + [],
     240 + );
     241 + 
     242 + return <MaterialReactTable columns={columns} data={props.data} />;
     243 +};
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/VulnTable.tsx
    1  -import React, { Component, useCallback } from 'react';
     1 +import React, { Component, useCallback, useMemo } from 'react';
    2 2  import {useHistory} from 'react-router-dom';
    3 3  import {useNavigate} from 'react-router-dom';
    4 4  import { Link } from 'react-router-dom';
    5 5   
    6  -import Paper from '@mui/material/Paper';
    7  -import Card from '@mui/material/Card';
    8  -import Badge from '@mui/material/Badge';
    9  -import CardActions from '@mui/material/CardActions';
    10  -import CardContent from '@mui/material/CardContent';
    11  -import Typography from '@mui/material/Typography';
    12  -import Table from '@mui/material/Table';
    13  -import TableBody from '@mui/material/TableBody';
    14  -import TableCell from '@mui/material/TableCell';
    15  -import TableContainer from '@mui/material/TableContainer';
    16  -import TableHead from '@mui/material/TableHead';
    17  -import TableRow from '@mui/material/TableRow';
    18  -import Collapse from '@mui/material/Collapse';
    19  -import IconButton from '@mui/material/IconButton';
    20 6  import Box from '@mui/material/Box';
    21 7   
    22  -import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
    23  -import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
    24  -import AddBox from '@mui/icons-material/AddBox';
    25  -import IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';
    26  -import UploadFileRoundedIcon from '@mui/icons-material/UploadFileRounded';
     8 +import MaterialReactTable, {
     9 + MRT_ShowHideColumnsButton,
     10 + MRT_FullScreenToggleButton,
     11 + MRT_ToggleDensePaddingButton,
    27 12   
    28  -import { createMuiTheme } from 'material-ui/styles';
     13 +} from 'material-react-table';
    29 14   
    30  -type VulnerabilityList = {
     15 +import { SeverityBadge } from './VulnerabililtyTable/SeverityBadge';
     16 +import { VulnerabilityTableSearch } from './VulnerabililtyTable/VulnerabilityTableSearch';
     17 + 
     18 +import WifiTetheringErrorRoundedSharpIcon from '@mui/icons-material/WifiTetheringErrorRoundedSharp';
     19 +import NumbersIcon from '@mui/icons-material/Numbers';
     20 + 
     21 +type VulnerabilityList = [{
    31 22   CVEDataMeta: {
    32 23   ID: string,
    33 24   ASSIGNER: string,
    skipped 12 lines
    46 37   },
    47 38   },
    48 39   },
    49  -};
     40 +}];
    50 41   
    51  -class VulnTable extends React.Component {
    52  - constructor(props) {
    53  - super(props);
    54  -
    55  - this.state = {
    56  - open: false,
    57  - setOpen: false,
    58  - };
    59  - }
     42 +export default function VulnTable(props: any) {
     43 + //Re-order the vulnList by severity
     44 + const vulnList = (props.vulnList || []).sort((a, b) => {
     45 + if (a.CVSSV3.baseSeverity < b.CVSSV3.baseSeverity) {
     46 + return 1;
     47 + }
     48 + if (a.CVSSV3.baseSeverity > b.CVSSV3.baseSeverity) {
     49 + return -1;
     50 + }
     51 + return 0;
     52 + });
    60 53  
    61  - render() {
    62  - return (
    63  - <div className="rightcard">
    64  - <TableContainer component={Paper}>
    65  - <Table aria-label="collapsible table">
    66  - <TableHead>
    67  - <TableRow>
    68  - <TableCell>Vulnerability</TableCell>
    69  - <TableCell align="left">Description</TableCell>
    70  - {this.props.allHosts ? <TableCell align="left">Affected Systems</TableCell> : null }
    71  - <TableCell align="center">Severity</TableCell>
    72  - <TableCell align="center">CVSSv3</TableCell>
    73  - </TableRow>
    74  - </TableHead>
    75  - <TableBody>
    76  - {Array.isArray(this.props.vulnList) && this.props.vulnList.map((row: VulnerabilityList) => (
    77  - <Row key={row.CVEDataMeta.ID} row={row} />
    78  - ))}
    79  - </TableBody>
    80  - </Table>
    81  - </TableContainer>
    82  - </div>
    83  - );
    84  - }
    85  -}
    86  -export default VulnTable;
    87 54   
    88  -function hostClick(row) {
    89  - console.log(row.ip);
     55 + return (
     56 + <div className="rightcard">
     57 + <VulnerabilityTable data={vulnList} />
     58 + </div>
     59 + );
    90 60  }
    91 61   
    92  -{/* HostTable */}
    93  -function Row(props) {
    94  - const { row } = props;
    95  - const [open, setOpen] = React.useState(false);
     62 +const VulnerabilityTable = (props: any) => {
     63 + const [filter, setFilter] = React.useState('');
    96 64   const navigate = useNavigate();
    97  - const handleOnClick = useCallback((row) => navigate('/report/vulnerability?id=' + row.CVEDataMeta.ID, {replace: true}), [navigate]);
     65 + const handleOnClick = useCallback((id: string) => navigate('/report/vulnerability?id=' + id, {replace: false}), [navigate]);
    98 66   
     67 + //should be memoized or stable
     68 + const columns = useMemo(
     69 + () => [
     70 + {
     71 + accessorFn: (row) => `${row.CVSSV3.baseSeverity}`,
     72 + accessorKey: 'CVSSV3.baseSeverity',
     73 + header: <WifiTetheringErrorRoundedSharpIcon />,
     74 + size: 10,
     75 + enableSorting: true,
     76 + sortAscFirst: true,
     77 + enableGlobalFilter: false,
     78 + Cell: ({renderedCellValue, row}) => (
     79 + <Box
     80 + sx={{
     81 + display: 'flex',
     82 + alignItems: 'center',
     83 + gap: '1rem',
     84 + cursor: 'pointer',
     85 + }}
     86 + onClick={() => handleOnClick(row.original.CVEDataMeta.ID)}
     87 + >
     88 + <SeverityBadge severity={row.original.CVSSV3.baseSeverity} />
     89 + </Box>
     90 + ),
     91 + },
     92 + {
     93 + accessorKey: 'CVEDataMeta.ID', //access nested data with dot notation
     94 + header: 'Vulnerability',
     95 + size: 50,
     96 + Cell: ({renderedCellValue, row}) => (
     97 + <Box
     98 + sx={{
     99 + display: 'flex',
     100 + alignItems: 'center',
     101 + gap: '1rem',
     102 + cursor: 'pointer',
     103 + }}
     104 + onClick={() => handleOnClick(row.original.CVEDataMeta.ID)}
     105 + >
     106 + {renderedCellValue}
     107 + </Box>
     108 + ),
     109 + },
     110 + {
     111 + accessorFn: (row) => `${row.Description.description_data[0].value.slice(0,75)}...`,
     112 + header: 'Description',
     113 + size: 500,
     114 + Cell: ({ renderedCellValue, row }) => (
     115 + <Box
     116 + sx={{
     117 + display: 'flex',
     118 + alignItems: 'center',
     119 + gap: '1rem',
     120 + cursor: 'pointer',
     121 + }}
     122 + onClick={() => handleOnClick(row.original.CVEDataMeta.ID)}
     123 + >
     124 + <span>{renderedCellValue}</span>
     125 + </Box>
     126 + ),
     127 + },
     128 + {
     129 + accessorKey: 'AffectedHosts.length',
     130 + header: <NumbersIcon />,
     131 + size: 10,
     132 + },
     133 + {
     134 + accessorKey: 'CVSSV3.baseScore',
     135 + header: 'CVSS',
     136 + size: 10,
     137 + },
     138 + ],
     139 + [],
     140 + );
    99 141   
    100  - return (
    101  - <>
    102  - <TableRow sx={{ '&:last-child td, &:last-child th': { border: 0 } }} onClick={() => handleOnClick(row)} sx={{ '& > *': { borderBottom: 'unset' } }}>
    103  - <TableCell width="20%" component="th" scope="row">
    104  - {row.CVEDataMeta.ID}
    105  - </TableCell>
    106  - <TableCell width="65%" align="left">
    107  - <Box sx={{ textOverflow: 'ellipsis' }}>
    108  - {row.Description.description_data[0].value.slice(0,75)}...
    109  - </Box>
    110  - </TableCell>
    111  - {row.AffectedHosts ? <TableCell width="5%" align="left">{row.AffectedHosts.length}</TableCell> : null}
     142 + return <MaterialReactTable
     143 + columns={columns}
     144 + data={props.data}
     145 + enableColumnActions={false}
     146 + enableSelectAll={true}
     147 + enableRowSelection
     148 + state={{
     149 + globalFilter: filter,
     150 + }}
     151 + muiTableHeadCellProps={{
     152 + //simple styling with the `sx` prop, works just like a style prop in this example
     153 + sx: {
     154 + fontWeight: 'bold',
     155 + fontSize: '14px',
     156 + },
     157 + }}
     158 + renderToolbarInternalActions={({ table }) => (
     159 + <>
     160 + {/* add your own custom print button or something */}
    112 161   
    113  - <TableCell width="5%" align="center">{row.CVSSV3.baseSeverity}</TableCell>
    114  - <TableCell width="5%" align="center">{row.CVSSV3.baseScore}</TableCell>
    115  - </TableRow>
    116  - </>
    117  - );
    118  -}
     162 + {/* built-in buttons (must pass in table prop for them to work!) */}
     163 + <MRT_ShowHideColumnsButton table={table} />
     164 + <MRT_FullScreenToggleButton table={table} />
     165 + <MRT_ToggleDensePaddingButton table={table} />
     166 + </>
     167 + )}
     168 + //add custom action buttons to top-left of top toolbar
     169 + renderTopToolbarCustomActions={({ table }) => (
     170 + <Box sx={{ display: 'flex', gap: '1rem', p: '4px' }}>
     171 + <VulnerabilityTableSearch setFilter={setFilter} />
     172 + 
     173 + </Box>
     174 + )}
     175 + />;
     176 +};
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/VulnerabililtyTable/SeverityBadge.tsx
     1 +import React from 'react';
     2 + 
     3 +export const SeverityBadge = (severity: any) => {
     4 + // Set the color of the badge based on the severity
     5 + let badgeColor = '';
     6 + switch (severity.severity) {
     7 + case 'CRITICAL':
     8 + badgeColor = 'black';
     9 + break;
     10 + case 'HIGH':
     11 + badgeColor = 'red';
     12 + break;
     13 + case 'MEDIUM':
     14 + badgeColor = 'orange';
     15 + break;
     16 + case 'LOW':
     17 + badgeColor = 'yellow';
     18 + break;
     19 + default:
     20 + badgeColor = 'grey';
     21 + break;
     22 + }
     23 + 
     24 + return (
     25 + <div>
     26 + <div
     27 + style={{
     28 + backgroundColor: badgeColor,
     29 + width: '30px',
     30 + height: '20px',
     31 + borderRadius: '3px',
     32 + color: 'white',
     33 + textAlign: 'center',
     34 + }}
     35 + >
     36 + {severity.severity ? severity.severity.slice(0, 1) : 'I'}
     37 + </div>
     38 + </div>
     39 + );
     40 +};
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/VulnerabililtyTable/VulnerabilityCount.tsx
     1 +import React from 'react';
     2 + 
     3 +export const VulnerabilityCount = (props: any) => {
     4 + // Set the color of the badge based on the vulnerability count
     5 + const badgeColor = getBadgeColor(props.count);
     6 + 
     7 + return (
     8 + <div>
     9 + <div
     10 + style={{
     11 + backgroundColor: badgeColor,
     12 + width: '30px',
     13 + height: '20px',
     14 + borderRadius: '3px',
     15 + color: 'white',
     16 + textAlign: 'center',
     17 + }}
     18 + >
     19 + {props.count | 0}
     20 + </div>
     21 + </div>
     22 + );
     23 +};
     24 + 
     25 +const getBadgeColor = (count: number) => {
     26 + if (count > 10) {
     27 + return 'black';
     28 + } else if (count > 7) {
     29 + return 'red';
     30 + } else if (count > 4) {
     31 + return 'orange';
     32 + } else if (count > 1) {
     33 + return 'yellow';
     34 + } else {
     35 + return 'grey';
     36 + }
     37 +};
     38 + 
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/components/VulnerabililtyTable/VulnerabilityTableSearch.tsx
     1 +import React from 'react';
     2 +import SearchIcon from '@mui/icons-material/Search';
     3 +import Box from '@mui/material/Box';
     4 +import Button from '@mui/material/Button';
     5 +import TextField from '@mui/material/TextField';
     6 +import Grid from '@mui/material/Grid';
     7 + 
     8 +export const VulnerabilityTableSearch = (props: any) => {
     9 + // MUI Search Bar with Styled Search Icon Button
     10 + const [search, setSearch] = React.useState("");
     11 + 
     12 + return (
     13 + <div>
     14 + <Grid
     15 + container
     16 + spacing={24}
     17 + direction="row"
     18 + >
     19 + <Grid item xs={8}>
     20 + <Box
     21 + component="form"
     22 + sx={{
     23 + '& > :not(style)': { m: 1, width: '25ch' },
     24 + }}
     25 + noValidate
     26 + autoComplete="off"
     27 + >
     28 + <TextField
     29 + id="outlined-basic"
     30 + label="Vulnerability Search"
     31 + variant="outlined"
     32 + sx={{
     33 + display: 'flex',
     34 + minWidth: '400px',
     35 + width: '500px',
     36 + height: '30px',
     37 + borderRadius: '0px',
     38 + }}
     39 + onChange={(e) => props.setFilter(e.target.value)}
     40 + />
     41 + </Box>
     42 + </Grid>
     43 + <Grid item xs={1}>
     44 + <Box
     45 + sx={{
     46 + display: 'flex',
     47 + justifyContent: 'center',
     48 + alignItems: 'center',
     49 + mt: '7px',
     50 + ml: '-118px',
     51 + width: '40px',
     52 + height: '57px',
     53 + }}
     54 + >
     55 + <Button
     56 + variant="contained"
     57 + sx={{
     58 + width: '100%',
     59 + height: '100%',
     60 + borderRadius: '0 5px 5px 0',
     61 + boxShadow: 'none',
     62 + }}
     63 + >
     64 + <SearchIcon />
     65 + </Button>
     66 + </Box>
     67 + </Grid>
     68 + </Grid>
     69 + </div>
     70 + );
     71 +};
  • ■ ■ ■ ■ ■ ■
    UI/src/sirius/containers/InventoryHost.tsx
    1  -import React, { Component, useCallback } from 'react';
    2  -import {useHistory} from 'react-router-dom';
    3  -import {useNavigate} from 'react-router-dom';
    4  -import { Link } from 'react-router-dom';
     1 +import React, { useCallback } from 'react';
     2 +import { useHistory, useNavigate } from 'react-router-dom';
    5 3   
    6 4  import Paper from '@mui/material/Paper';
    7  -import Card from '@mui/material/Card';
    8  -import Badge from '@mui/material/Badge';
    9  -import CardActions from '@mui/material/CardActions';
    10  -import CardContent from '@mui/material/CardContent';
    11  -import Typography from '@mui/material/Typography';
    12 5  import Table from '@mui/material/Table';
    13 6  import TableBody from '@mui/material/TableBody';
    14 7  import TableCell from '@mui/material/TableCell';
    15 8  import TableContainer from '@mui/material/TableContainer';
    16 9  import TableHead from '@mui/material/TableHead';
    17 10  import TableRow from '@mui/material/TableRow';
    18  -import Collapse from '@mui/material/Collapse';
    19  -import IconButton from '@mui/material/IconButton';
    20  -import Box from '@mui/material/Box';
    21  - 
    22  -import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
    23  -import KeyboardArrowUpIcon from '@mui/icons-material/KeyboardArrowUp';
    24  -import AddBox from '@mui/icons-material/AddBox';
    25  -import IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';
    26  -import UploadFileRoundedIcon from '@mui/icons-material/UploadFileRounded';
    27 11   
    28 12  import { createMuiTheme } from 'material-ui/styles';
    29 13   
    30  -class InventoryHost extends React.Component {
    31  - constructor(props) {
    32  - super(props);
    33  -
    34  - this.state = {
    35  - open: false,
    36  - setOpen: false,
    37  - };
    38  - this.props.hostList.map((row) => console.log(row.os));
    39  - }
     14 +function InventoryHost(props) {
     15 + return (
     16 + <div className="rightcard">
     17 + <TableContainer component={Paper}>
     18 + <Table aria-label="collapsible table">
     19 + <TableHead>
     20 + <TableRow>
     21 + <TableCell>IP Address</TableCell>
     22 + <TableCell>Hostname</TableCell>
     23 + <TableCell>Operating System</TableCell>
     24 + <TableCell>Version</TableCell>
     25 + </TableRow>
     26 + </TableHead>
     27 + <TableBody>
     28 + {props.hostList.map((row) => (
     29 + <Row key={row.ip} row={row} />
     30 + ))}
     31 + </TableBody>
     32 + </Table>
     33 + </TableContainer>
     34 + </div>
     35 + );
     36 +}
    40 37   
    41  - render() {
    42  - return (
    43  - <div className="rightcard">
    44  - <TableContainer component={Paper}>
    45  - <Table aria-label="collapsible table">
    46  - <TableHead>
    47  - <TableRow>
    48  - <TableCell>Host</TableCell>
    49  - <TableCell align="right">Name</TableCell>
    50  - <TableCell align="right">Operating System</TableCell>
    51  - <TableCell align="right">Version</TableCell>
    52  - <TableCell align="right">Issues</TableCell>
    53  - <TableCell align="right">Risk</TableCell>
    54  - </TableRow>
    55  - </TableHead>
    56  - <TableBody>
    57  - {this.props.hostList.map((row) => (
    58  - <Row key={row.ip} row={row} />
    59  - ))}
    60  - </TableBody>
    61  - </Table>
    62  - </TableContainer>
    63  - </div>
    64  - );
    65  - }
    66  -}
    67 38  export default InventoryHost;
    68 39   
    69  -function hostClick(row) {
    70  - console.log(row.ip);
    71  -}
    72  - 
    73  -{/* HostTable */}
    74 40  function Row(props) {
    75 41   const { row } = props;
    76 42   const [open, setOpen] = React.useState(false);
    77 43   const navigate = useNavigate();
    78  - const handleOnClick = useCallback((row) => navigate('/report/host?ip=' + row.ip, {replace: true}), [navigate]);
    79  - 
     44 + const handleOnClick = useCallback(() => navigate(`/report/host?ip=${row.ip}`, { replace: false }), [navigate, row.ip]);
    80 45   
    81 46   return (
    82  - <>
    83  - {/* <HostTable /> */}
    84  -
    85  - <TableRow onClick={() => handleOnClick(row)} sx={{ '& > *': { borderBottom: 'unset' } }}>
    86  - <TableCell component="th" scope="row">
    87  - {row.ip}
    88  - </TableCell>
    89  - <TableCell align="right">{row.hostname}</TableCell>
    90  - <TableCell align="right">{row.os}</TableCell>
    91  - <TableCell align="right">{row.osversion}</TableCell>
    92  - <TableCell align="right">10</TableCell>
    93  - <TableCell align="right">3</TableCell>
    94  - </TableRow>
    95  -
    96  - </>
     47 + <TableRow onClick={handleOnClick} sx={{ '& > *': { borderBottom: 'unset' } }}>
     48 + <TableCell component="th" scope="row">
     49 + {row.ip}
     50 + </TableCell>
     51 + <TableCell>{row.hostname}</TableCell>
     52 + <TableCell>{row.os}</TableCell>
     53 + <TableCell>{row.osversion}</TableCell>
     54 + </TableRow>
    97 55   );
    98 56  }
    99  - 
    100  - 
    101  - 
  • ■ ■ ■ ■ ■
    UI/src/sirius/containers/Scanner.tsx
    skipped 1 lines
    2 2  import {useHistory} from 'react-router-dom';
    3 3  import {useNavigate} from 'react-router-dom';
    4 4  import { Link } from 'react-router-dom';
     5 +import { useEffect } from 'react';
    5 6   
     7 +import { alpha, styled } from '@mui/material/styles';
    6 8  import Card from '@mui/material/Card';
    7 9  import Button from '@mui/material/Button';
    8 10  import TextField from '@mui/material/TextField';
    9 11  import Box from '@mui/material/Box';
     12 +import Typography from '@mui/material/Typography';
     13 + 
     14 +import LinearProgress, { linearProgressClasses, LinearProgressProps } from '@mui/material/LinearProgress';
    10 15   
    11 16  import { createMuiTheme } from 'material-ui/styles';
    12 17   
     18 +import { ScanRequest } from '../api/types';
     19 +import ScanResults from '../components/ScanResults';
     20 + 
     21 +import config from '../../../config.json';
     22 + 
    13 23  export default function Scanner() {
    14  - const [scanResults, setScanResults] = React.useState({Targets: []});
     24 + const [scanStatus, setScanStatus] = React.useState(0);
     25 + const [scanResults, setScanResults] = React.useState({Targets: []} as ScanRequest);
     26 + const [scanRequest, setScanRequest] = React.useState({targets: []} as ScanRequest);
    15 27   const [target, setTarget] = React.useState("");
     28 + const [scanID, setScanID] = React.useState("");
     29 + const [showScanResults, setShowScanResults] = React.useState(true);
    16 30   
    17 31   function executeScan() {
    18  - StartScan(target, setScanResults);
     32 + StartScan(target, scanID, setScanResults, setScanStatus, setScanID);
    19 33   }
    20 34   
    21 35   return (
    22 36   <>
    23  - <Card sx={{paddingLeft: 3, paddingBottom: 5}}>
    24  - <TextField
    25  - id="outlined-basic"
    26  - label="Target IP Address"
    27  - variant="outlined"
    28  - sx={{marginTop: 2, marginLeft: 2, width: 300}}
    29  - onChange={(e) => setTarget(e.target.value)}
    30  - />
    31  - <Button onClick={() => executeScan()} variant="contained" sx={{marginTop: 2, marginLeft: 2}}>Start Scan</Button>
    32  - 
    33  - {scanResults.Targets.length ? <ScanResults scanResults={scanResults} /> : null}
     37 + <Card>
     38 + {scanStatus == 0 ?
     39 + <Box>
     40 + <TextField
     41 + id="outlined-basic"
     42 + label="Target IP Address"
     43 + variant="outlined"
     44 + sx={{marginTop: 2, marginLeft: 2, width: 300}}
     45 + onChange={(e) => setTarget(e.target.value)}
     46 + />
     47 + <Button onClick={() => executeScan()} variant="contained" sx={{marginTop: 2, marginLeft: 2}}>Start Scan</Button>
     48 + </Box>
     49 + :
     50 + <Box>
     51 + <ScanProgress target={target} />
     52 + </Box>
     53 + }
     54 + <Box>
     55 + <ScanResults scanRequest={scanResults} />
     56 + </Box>
    34 57   </Card>
    35 58   </>
    36 59   );
    37 60  }
    38 61   
    39  -function StartScan(target: string, setScanResults: any) {
     62 +function StartScan(target: string, scanID: string, setScanResults: any, setScanStatus: any, setScanID: any) {
    40 63   console.log("Starting Scan: " + target)
     64 + setScanStatus(1);
    41 65   
    42 66   //Create list of targets based on input
    43 67   if (target.split(",").length > 1) {
    skipped 7 lines
    51 75   headers: { 'Content-Type': 'application/json' },
    52 76   body: JSON.stringify({ targets: targets })
    53 77   };
    54  - fetch('http://localhost:8080/api/scan/new', requestOptions)
     78 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/scan/new', requestOptions)
     79 + .then((response) => response.json())
     80 + .then((data) => {
     81 + setScanID(data);
     82 + 
     83 + //Monitor the scan status until it is complete
     84 + setInterval(() => {
     85 + var status = MonitorScanStatus(data, setScanStatus, setScanResults);
     86 + if (status == true) {
     87 + clearInterval();
     88 + }
     89 + }, 5000);
     90 + })
     91 +}
     92 + 
     93 +function MonitorScanStatus(scanID: string, setScanStatus: any, setScanResults: any) {
     94 + console.log("Monitoring Scan Status: " + scanID)
     95 + 
     96 + const requestOptions = {
     97 + method: 'POST',
     98 + headers: { 'Content-Type': 'application/json' },
     99 + body: JSON.stringify({ ScanID: scanID })
     100 + };
     101 + 
     102 + //Check the scan status
     103 + fetch('http://' + config.server.host + ':' + config.server.port + '/api/scan/report', requestOptions)
    55 104   .then((response) => response.json())
    56 105   .then((data) => {
    57  - setScanResults(data);
    58  - });
     106 + //Update the scan request object with the latest results
     107 + setScanResults(data);
     108 + 
     109 + 
     110 + //If scan command is complete exit scan monitor loop
     111 + if (data.Command == "complete") {
     112 + console.log("Scan Complete")
     113 + setScanStatus(0);
     114 + return true;
     115 + }
     116 + }
     117 + )
    59 118  }
    60 119   
    61  -export const ScanResults = (scanResults: {}) => {
     120 +export const ScanProgress = (target: any) => {
    62 121   return (
    63  - <Box>
    64  - <h1>Scan Results</h1>
    65  - {scanResults.scanResults.Targets.map((target: any) => (
    66  - <Box key={target}>
    67  - <h5>Target IP Address: {target}</h5>
    68  - </Box>
    69  - ))}
     122 + <Box sx={{ml:3, mb:5}}>
     123 + <Typography variant="h4">Scanning Job Started</Typography>
     124 + <Typography variant="h6">Target: {target.target}</Typography>
     125 + <hr />
     126 + <LoadingBar />
    70 127   </Box>
    71 128   );
    72 129  };
     130 + 
     131 +// Centered Loading Bar Component
     132 +const LoadingBar = () => {
     133 + return (
     134 + <Box sx={{ width: '50%', display: 'flex', alignItems: 'center' }}>
     135 + <Box sx={{ width: '100%', mr: 1 }}>
     136 + <LoadingLinearProgress variant="indeterminate" />
     137 + </Box>
     138 + </Box>
     139 + )
     140 +}
     141 + 
     142 +const LoadingLinearProgress = styled(LinearProgress)(({ theme }) => ({
     143 + height: 25,
     144 + borderRadius: 5,
     145 + [`&.${linearProgressClasses.colorPrimary}`]: {
     146 + backgroundColor: '#eaeaea',
     147 + },
     148 + [`& .${linearProgressClasses.bar}`]: {
     149 + borderRadius: 5,
     150 + backgroundColor: theme.palette.mode === 'light' ? '#428dd1' : '#428dd1',
     151 + animationDuration: '2s',
     152 + },
     153 +}));
  • ■ ■ ■ ■ ■
    UI/src/sirius/containers/SiriusIssues.tsx
    skipped 25 lines
    26 26   
    27 27  import { createMuiTheme } from 'material-ui/styles';
    28 28   
     29 +import config from '../../../config.json';
     30 + 
    29 31  import VulnTable from "../components/VulnTable";
    30 32   
    31  -export default function HostReportTabs() {
     33 +export default function HostReportTabs(props: any) {
    32 34   const [value, setValue] = React.useState(0);
    33  - const [vulnList, setVulnList] = React.useState([]);
    34  - 
    35  - React.useEffect(() => {
    36  - //Get the list of vulnerabilities
    37  - //Make API post request to get the list of vulnerabilities for the ip parameter
    38  - const requestOptions = {
    39  - method: 'POST',
    40  - headers: { 'Content-Type': 'application/json' },
    41  - body: JSON.stringify({ ip: '192.168.1.69' })
    42  - };
    43  - fetch('http://localhost:8080/api/svdb/report/vulnerability', requestOptions)
    44  - .then((response) => response.json())
    45  - .then((data) => {
    46  - setVulnList(data);
    47  - });
    48  - }, [])
    49  - 
    50 35   
    51 36   const handleChange = (event: React.SyntheticEvent, newValue: number) => {
    52 37   setValue(newValue);
    53 38   };
    54 39   
    55 40   return (
    56  - <div sx={{marginTop: 0, width: '100%'}}>
     41 + <div sx={{
     42 + marginTop: 0,
     43 + width: '100%'
     44 + }}>
    57 45   <Card>
    58  - <VulnTable allHosts="true" vulnList={vulnList}/>
     46 + <VulnTable allHosts="true" vulnList={props.vulnList}/>
    59 47   </Card>
    60 48   </div>
    61 49   );
    skipped 16 lines
    78 66   description,
    79 67   };
    80 68  }
    81  - 
    82  -function Row(props: { row: ReturnType<typeof createData> }) {
    83  - const { row } = props;
    84  - const [open, setOpen] = React.useState(false);
    85  - 
    86  - return (
    87  - <>
    88  - <TableRow sx={{ '& > *': { borderBottom: 'unset' } }}>
    89  - <TableCell>
    90  - <IconButton
    91  - aria-label="expand row"
    92  - size="small"
    93  - onClick={() => setOpen(!open)}
    94  - >
    95  - {open ? <KeyboardArrowUpIcon /> : <KeyboardArrowDownIcon />}
    96  - </IconButton>
    97  - </TableCell>
    98  - <TableCell component="th" scope="row">
    99  - {row.CVEDataMeta.ID}
    100  - </TableCell>
    101  - <TableCell align="right">{row.CVSSV3.baseSeverity}</TableCell>
    102  - <TableCell align="right">{row.Tags}</TableCell>
    103  - <TableCell align="right">{row.CVSSV3.baseScore}</TableCell>
    104  - </TableRow>
    105  - <TableRow>
    106  - <TableCell style={{ paddingBottom: 0, paddingTop: 0 }} colSpan={6}>
    107  - <Collapse in={open} timeout="auto" unmountOnExit>
    108  - <Box sx={{ margin: 1 }}>
    109  - <Typography variant="h6" gutterBottom component="div">
    110  - Vulnerability Summary
    111  - </Typography>
    112  - <Typography variant="subtitle1" gutterBottom component="div">
    113  - {row.Description.description_data[0].value}
    114  - </Typography>
    115  - <Typography variant="h6" gutterBottom component="div">
    116  - Impact
    117  - </Typography>
    118  - <Typography variant="subtitle1" gutterBottom component="div">
    119  - <Table size="small" aria-label="purchases">
    120  - <TableHead>
    121  - <TableRow>
    122  - <TableCell>Confidentiality Impact</TableCell>
    123  - <TableCell>Integrity Impact</TableCell>
    124  - <TableCell>Availability Impact</TableCell>
    125  - </TableRow>
    126  - </TableHead>
    127  - <TableBody>
    128  - <TableRow>
    129  - <TableCell>High</TableCell>
    130  - <TableCell>High</TableCell>
    131  - <TableCell>High</TableCell>
    132  - </TableRow>
    133  - </TableBody>
    134  - </Table>
    135  - </Typography>
    136  - <Typography variant="h6" gutterBottom component="div">
    137  - References
    138  - </Typography>
    139  - <Typography variant="subtitle1" gutterBottom component="div">
    140  - {row.References[0]}
    141  - </Typography>
    142  - </Box>
    143  - </Collapse>
    144  - </TableCell>
    145  - </TableRow>
    146  - </>
    147  - );
    148  -}
  • ■ ■ ■ ■ ■
    UI/tsconfig.json
    skipped 13 lines
    14 14   "resolveJsonModule": true,
    15 15   "isolatedModules": true,
    16 16   "noEmit": true,
    17  - "jsx": "react-jsx"
     17 + "jsx": "react-jsx",
     18 + "typeRoots": ["./src/sirius/api/types"]
    18 19   },
    19 20   "include": ["src"],
    20 21   "references": [{ "path": "./tsconfig.node.json" }]
    skipped 2 lines
  • ■ ■ ■ ■ ■ ■
    UI/yarn.lock
    skipped 188 lines
    189 189   dependencies:
    190 190   regenerator-runtime "^0.12.0"
    191 191   
    192  -"@babel/runtime@^7.0.0", "@babel/runtime@^7.16.0", "@babel/runtime@^7.2.0", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.1":
     192 +"@babel/runtime@^7.0.0", "@babel/runtime@^7.16.0", "@babel/runtime@^7.2.0", "@babel/runtime@^7.20.0", "@babel/runtime@^7.20.1", "@babel/runtime@^7.21.0":
    193 193   version "7.21.0"
    194 194   resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.21.0.tgz#5b55c9d394e5fcf304909a8b00c07dc217b56673"
    195 195   integrity sha512-xwII0//EObnq89Ji5AKYQaRYiW/nZ3llSv29d49IuxPhKbtJoLP+9QUUZ4nVragQVtaVGeZrpB+ZtG/Pdy/POw==
    skipped 59 lines
    255 255   source-map "^0.5.7"
    256 256   stylis "4.1.3"
    257 257   
     258 +"@emotion/babel-plugin@^11.10.6":
     259 + version "11.10.6"
     260 + resolved "https://registry.yarnpkg.com/@emotion/babel-plugin/-/babel-plugin-11.10.6.tgz#a68ee4b019d661d6f37dec4b8903255766925ead"
     261 + integrity sha512-p2dAqtVrkhSa7xz1u/m9eHYdLi+en8NowrmXeF/dKtJpU8lCWli8RUAati7NcSl0afsBott48pdnANuD0wh9QQ==
     262 + dependencies:
     263 + "@babel/helper-module-imports" "^7.16.7"
     264 + "@babel/runtime" "^7.18.3"
     265 + "@emotion/hash" "^0.9.0"
     266 + "@emotion/memoize" "^0.8.0"
     267 + "@emotion/serialize" "^1.1.1"
     268 + babel-plugin-macros "^3.1.0"
     269 + convert-source-map "^1.5.0"
     270 + escape-string-regexp "^4.0.0"
     271 + find-root "^1.1.0"
     272 + source-map "^0.5.7"
     273 + stylis "4.1.3"
     274 + 
    258 275  "@emotion/cache@^11.10.5":
    259 276   version "11.10.5"
    260 277   resolved "https://registry.npmjs.org/@emotion/cache/-/cache-11.10.5.tgz"
    skipped 22 lines
    283 300   resolved "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.8.0.tgz"
    284 301   integrity sha512-G/YwXTkv7Den9mXDO7AhLWkE3q+I92B+VqAE+dYG4NGPaHZGvt3G8Q0p9vmE+sq7rTGphUbAvmQ9YpbfMQGGlA==
    285 302   
     303 +"@emotion/react@^11.10.6":
     304 + version "11.10.6"
     305 + resolved "https://registry.yarnpkg.com/@emotion/react/-/react-11.10.6.tgz#dbe5e650ab0f3b1d2e592e6ab1e006e75fd9ac11"
     306 + integrity sha512-6HT8jBmcSkfzO7mc+N1L9uwvOnlcGoix8Zn7srt+9ga0MjREo6lRpuVX0kzo6Jp6oTqDhREOFsygN6Ew4fEQbw==
     307 + dependencies:
     308 + "@babel/runtime" "^7.18.3"
     309 + "@emotion/babel-plugin" "^11.10.6"
     310 + "@emotion/cache" "^11.10.5"
     311 + "@emotion/serialize" "^1.1.1"
     312 + "@emotion/use-insertion-effect-with-fallbacks" "^1.0.0"
     313 + "@emotion/utils" "^1.2.0"
     314 + "@emotion/weak-memoize" "^0.3.0"
     315 + hoist-non-react-statics "^3.3.1"
     316 + 
    286 317  "@emotion/react@^11.4.1":
    287 318   version "11.10.5"
    288 319   resolved "https://registry.npmjs.org/@emotion/react/-/react-11.10.5.tgz"
    skipped 23 lines
    312 343   version "1.2.1"
    313 344   resolved "https://registry.npmjs.org/@emotion/sheet/-/sheet-1.2.1.tgz"
    314 345   integrity sha512-zxRBwl93sHMsOj4zs+OslQKg/uhF38MB+OMKoCrVuS0nyTkqnau+BM3WGEoOptg9Oz45T/aIGs1qbVAsEFo3nA==
     346 + 
     347 +"@emotion/styled@^11.10.6":
     348 + version "11.10.6"
     349 + resolved "https://registry.yarnpkg.com/@emotion/styled/-/styled-11.10.6.tgz#d886afdc51ef4d66c787ebde848f3cc8b117ebba"
     350 + integrity sha512-OXtBzOmDSJo5Q0AFemHCfl+bUueT8BIcPSxu0EGTpGk6DmI5dnhSzQANm1e1ze0YZL7TDyAyy6s/b/zmGOS3Og==
     351 + dependencies:
     352 + "@babel/runtime" "^7.18.3"
     353 + "@emotion/babel-plugin" "^11.10.6"
     354 + "@emotion/is-prop-valid" "^1.2.0"
     355 + "@emotion/serialize" "^1.1.1"
     356 + "@emotion/use-insertion-effect-with-fallbacks" "^1.0.0"
     357 + "@emotion/utils" "^1.2.0"
    315 358   
    316 359  "@emotion/styled@^11.3.0":
    317 360   version "11.10.5"
    skipped 229 lines
    547 590   prop-types "^15.8.1"
    548 591   react-is "^18.2.0"
    549 592   
     593 +"@mui/[email protected]":
     594 + version "5.0.0-alpha.119"
     595 + resolved "https://registry.yarnpkg.com/@mui/base/-/base-5.0.0-alpha.119.tgz#923e148ceb84898fdd28da069b7c42635053c128"
     596 + integrity sha512-XA5zhlYfXi67u613eIF0xRmktkatx6ERy3h+PwrMN5IcWFbgiL1guz8VpdXON+GWb8+G7B8t5oqTFIaCqaSAeA==
     597 + dependencies:
     598 + "@babel/runtime" "^7.21.0"
     599 + "@emotion/is-prop-valid" "^1.2.0"
     600 + "@mui/types" "^7.2.3"
     601 + "@mui/utils" "^5.11.11"
     602 + "@popperjs/core" "^2.11.6"
     603 + clsx "^1.2.1"
     604 + prop-types "^15.8.1"
     605 + react-is "^18.2.0"
     606 + 
     607 +"@mui/core-downloads-tracker@^5.11.12":
     608 + version "5.11.12"
     609 + resolved "https://registry.yarnpkg.com/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.12.tgz#b2ea89ba71321a79c89dfb6b2a1b1886dc7de6e4"
     610 + integrity sha512-LHh8HZQ5nPVcW5QnyLwkAZ40txc/S2bzKMQ3bTO+5mjuwAJ2AzQrjZINLVy1geY7ei1pHXVqO1hcWHg/QdT44w==
     611 + 
    550 612  "@mui/core-downloads-tracker@^5.11.3":
    551 613   version "5.11.3"
    552 614   resolved "https://registry.npmjs.org/@mui/core-downloads-tracker/-/core-downloads-tracker-5.11.3.tgz"
    skipped 6 lines
    559 621   dependencies:
    560 622   "@babel/runtime" "^7.20.6"
    561 623   
     624 +"@mui/icons-material@^5.11.11":
     625 + version "5.11.11"
     626 + resolved "https://registry.yarnpkg.com/@mui/icons-material/-/icons-material-5.11.11.tgz#d4e01bd405b0dac779f5e060586277f91f3acb6e"
     627 + integrity sha512-Eell3ADmQVE8HOpt/LZ3zIma8JSvPh3XgnhwZLT0k5HRqZcd6F/QDHc7xsWtgz09t+UEFvOYJXjtrwKmLdwwpw==
     628 + dependencies:
     629 + "@babel/runtime" "^7.21.0"
     630 + 
    562 631  "@mui/material@^5.0.2":
    563 632   version "5.11.3"
    564 633   resolved "https://registry.npmjs.org/@mui/material/-/material-5.11.3.tgz"
    skipped 12 lines
    577 646   react-is "^18.2.0"
    578 647   react-transition-group "^4.4.5"
    579 648   
     649 +"@mui/material@^5.11.12":
     650 + version "5.11.12"
     651 + resolved "https://registry.yarnpkg.com/@mui/material/-/material-5.11.12.tgz#b113c854fb1bb0aa473686a36a92322c6c754121"
     652 + integrity sha512-M6BiIeJjySeEzWeiFJQ9pIjJy6mx5mHPWeMT99wjQdAmA2GxCQhE9A0fh6jQP4jMmYzxhOIhjsGcp0vSdpseXg==
     653 + dependencies:
     654 + "@babel/runtime" "^7.21.0"
     655 + "@mui/base" "5.0.0-alpha.119"
     656 + "@mui/core-downloads-tracker" "^5.11.12"
     657 + "@mui/system" "^5.11.12"
     658 + "@mui/types" "^7.2.3"
     659 + "@mui/utils" "^5.11.12"
     660 + "@types/react-transition-group" "^4.4.5"
     661 + clsx "^1.2.1"
     662 + csstype "^3.1.1"
     663 + prop-types "^15.8.1"
     664 + react-is "^18.2.0"
     665 + react-transition-group "^4.4.5"
     666 + 
     667 +"@mui/private-theming@^5.11.12":
     668 + version "5.11.12"
     669 + resolved "https://registry.yarnpkg.com/@mui/private-theming/-/private-theming-5.11.12.tgz#07c60abac0547b89cc6ac68821c2366e8fab5389"
     670 + integrity sha512-hnJ0svNI1TPeWZ18E6DvES8PB4NyMLwal6EyXf69rTrYqT6wZPLjB+HiCYfSOCqU/fwArhupSqIIkQpDs8CkAw==
     671 + dependencies:
     672 + "@babel/runtime" "^7.21.0"
     673 + "@mui/utils" "^5.11.12"
     674 + prop-types "^15.8.1"
     675 + 
    580 676  "@mui/private-theming@^5.11.2":
    581 677   version "5.11.2"
    582 678   resolved "https://registry.npmjs.org/@mui/private-theming/-/private-theming-5.11.2.tgz"
    skipped 13 lines
    596 692   csstype "^3.1.1"
    597 693   prop-types "^15.8.1"
    598 694   
     695 +"@mui/styled-engine@^5.11.11":
     696 + version "5.11.11"
     697 + resolved "https://registry.yarnpkg.com/@mui/styled-engine/-/styled-engine-5.11.11.tgz#9084c331fdcff2210ec33adf37f34e94d67202e4"
     698 + integrity sha512-wV0UgW4lN5FkDBXefN8eTYeuE9sjyQdg5h94vtwZCUamGQEzmCOtir4AakgmbWMy0x8OLjdEUESn9wnf5J9MOg==
     699 + dependencies:
     700 + "@babel/runtime" "^7.21.0"
     701 + "@emotion/cache" "^11.10.5"
     702 + csstype "^3.1.1"
     703 + prop-types "^15.8.1"
     704 + 
     705 +"@mui/system@^5.11.12":
     706 + version "5.11.12"
     707 + resolved "https://registry.yarnpkg.com/@mui/system/-/system-5.11.12.tgz#e7234c4e73e9af2b8e985fbed048d8b274338561"
     708 + integrity sha512-sYjsXkiwKpZDC3aS6O/6KTjji0jGINLQcrD5EJ5NTkIDiLf19I4HJhnufgKqlTWNfoDBlRohuTf3TzfM06c4ug==
     709 + dependencies:
     710 + "@babel/runtime" "^7.21.0"
     711 + "@mui/private-theming" "^5.11.12"
     712 + "@mui/styled-engine" "^5.11.11"
     713 + "@mui/types" "^7.2.3"
     714 + "@mui/utils" "^5.11.12"
     715 + clsx "^1.2.1"
     716 + csstype "^3.1.1"
     717 + prop-types "^15.8.1"
     718 + 
    599 719  "@mui/system@^5.11.2":
    600 720   version "5.11.2"
    601 721   resolved "https://registry.npmjs.org/@mui/system/-/system-5.11.2.tgz"
    skipped 13 lines
    615 735   resolved "https://registry.npmjs.org/@mui/types/-/types-7.2.3.tgz"
    616 736   integrity sha512-tZ+CQggbe9Ol7e/Fs5RcKwg/woU+o8DCtOnccX6KmbBc7YrfqMYEYuaIcXHuhpT880QwNkZZ3wQwvtlDFA2yOw==
    617 737   
     738 +"@mui/utils@^5.11.11", "@mui/utils@^5.11.12":
     739 + version "5.11.12"
     740 + resolved "https://registry.yarnpkg.com/@mui/utils/-/utils-5.11.12.tgz#627f491c0e7267398590af5e6cb14b306170d914"
     741 + integrity sha512-5vH9B/v8pzkpEPO2HvGM54ToXV6cFdAn8UrvdN8TMEEwpn/ycW0jLiyBcgUlPsQ+xha7hqXCPQYHaYFDIcwaiw==
     742 + dependencies:
     743 + "@babel/runtime" "^7.21.0"
     744 + "@types/prop-types" "^15.7.5"
     745 + "@types/react-is" "^16.7.1 || ^17.0.0"
     746 + prop-types "^15.8.1"
     747 + react-is "^18.2.0"
     748 + 
    618 749  "@mui/utils@^5.11.2":
    619 750   version "5.11.2"
    620 751   resolved "https://registry.npmjs.org/@mui/utils/-/utils-5.11.2.tgz"
    skipped 29 lines
    650 781   classnames "^2.2.5"
    651 782   insert-css "^2.0.0"
    652 783   lodash "^4.17.20"
     784 + 
     785 +"@tanstack/[email protected]":
     786 + version "8.7.6"
     787 + resolved "https://registry.yarnpkg.com/@tanstack/match-sorter-utils/-/match-sorter-utils-8.7.6.tgz#ccf54a37447770e0cf0fe49a579c595fd2655b16"
     788 + integrity sha512-2AMpRiA6QivHOUiBpQAVxjiHAA68Ei23ZUMNaRJrN6omWiSFLoYrxGcT6BXtuzp0Jw4h6HZCmGGIM/gbwebO2A==
     789 + dependencies:
     790 + remove-accents "0.4.2"
     791 + 
     792 +"@tanstack/[email protected]":
     793 + version "8.7.9"
     794 + resolved "https://registry.yarnpkg.com/@tanstack/react-table/-/react-table-8.7.9.tgz#9efcd168fb0080a7e0bc213b5eac8b55513babf4"
     795 + integrity sha512-6MbbQn5AupSOkek1+6IYu+1yZNthAKTRZw9tW92Vi6++iRrD1GbI3lKTjJalf8lEEKOqapPzQPE20nywu0PjCA==
     796 + dependencies:
     797 + "@tanstack/table-core" "8.7.9"
     798 + 
     799 +"@tanstack/[email protected]":
     800 + version "3.0.0-beta.47"
     801 + resolved "https://registry.yarnpkg.com/@tanstack/react-virtual/-/react-virtual-3.0.0-beta.47.tgz#de783aad28ab3a860ea9b132e3ffcfbaa744f68a"
     802 + integrity sha512-RnZTzzrmmL9WDNtmNTHGRB6e+yKJuRsrQjlIhK2bGVU0HEVvC7w/X6VUWCSAqJSriypniE8daRXSAisgQzhbsA==
     803 + dependencies:
     804 + "@tanstack/virtual-core" "3.0.0-beta.47"
     805 + 
     806 +"@tanstack/[email protected]":
     807 + version "8.7.9"
     808 + resolved "https://registry.yarnpkg.com/@tanstack/table-core/-/table-core-8.7.9.tgz#0e975f8a5079972f1827a569079943d43257c42f"
     809 + integrity sha512-4RkayPMV1oS2SKDXfQbFoct1w5k+pvGpmX18tCXMofK/VDRdA2hhxfsQlMvsJ4oTX8b0CI4Y3GDKn5T425jBCw==
     810 + 
     811 +"@tanstack/[email protected]":
     812 + version "3.0.0-beta.47"
     813 + resolved "https://registry.yarnpkg.com/@tanstack/virtual-core/-/virtual-core-3.0.0-beta.47.tgz#e7063a3f7647a36e28b591e80646b6173588fbcc"
     814 + integrity sha512-/sh1pycClyW5BBpMAItKxP9qD7w0KSL7k/tHLsOFulMOrGTGhWRUiZE7VDEN0nHk5DNMx5TsPfaXC1jy6DxnVA==
    653 815   
    654 816  "@types/chai@^4.3.3":
    655 817   version "4.3.4"
    skipped 509 lines
    1165 1327   dependencies:
    1166 1328   function-bind "^1.1.1"
    1167 1329   
     1330 +[email protected]:
     1331 + version "1.2.1"
     1332 + resolved "https://registry.yarnpkg.com/highlight-words/-/highlight-words-1.2.1.tgz#6de4194bb28fc647431859af7c50531bb93af80e"
     1333 + integrity sha512-FtF50tuaaYathtSPFk5FwGf0Zex5iqNsTx/OsVM6mdsB3xqs5nM+PAoPWs/gIUxGF3/Qqu2v86sAUenTh6oL3Q==
     1334 + 
    1168 1335  history@^5.1.0:
    1169 1336   version "5.3.0"
    1170 1337   resolved "https://registry.npmjs.org/history/-/history-5.3.0.tgz"
    skipped 150 lines
    1321 1488   resolved "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz"
    1322 1489   integrity sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==
    1323 1490   
     1491 +json-loader@^0.5.7:
     1492 + version "0.5.7"
     1493 + resolved "https://registry.yarnpkg.com/json-loader/-/json-loader-0.5.7.tgz#dca14a70235ff82f0ac9a3abeb60d337a365185d"
     1494 + integrity sha512-QLPs8Dj7lnf3e3QYS1zkCo+4ZwqOiF9d/nZnYozTISxXWCfNs9yuky5rJw4/W34s7POaNlbZmQGaB5NiXCbP4w==
     1495 + 
    1324 1496  json-parse-even-better-errors@^2.3.0:
    1325 1497   version "2.3.1"
    1326 1498   resolved "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz"
    skipped 52 lines
    1379 1551   dependencies:
    1380 1552   "@babel/runtime" "^7.12.5"
    1381 1553   remove-accents "0.4.2"
     1554 + 
     1555 +material-react-table@^1.8.5:
     1556 + version "1.8.5"
     1557 + resolved "https://registry.yarnpkg.com/material-react-table/-/material-react-table-1.8.5.tgz#cdc4289d7726f983b6f8525986d5c1fa7851a5f8"
     1558 + integrity sha512-poA3+sd0dnG8Q6avq0Z7r1O7N1huR6p6ra7HaA1ovAt4S0s7nnKQHyUoJB/tKFMGU9nnaDB22di7j1IDd20ptA==
     1559 + dependencies:
     1560 + "@tanstack/match-sorter-utils" "8.7.6"
     1561 + "@tanstack/react-table" "8.7.9"
     1562 + "@tanstack/react-virtual" "3.0.0-beta.47"
     1563 + highlight-words "1.2.1"
    1382 1564   
    1383 1565  "memoize-one@>=3.1.1 <6":
    1384 1566   version "5.2.1"
    skipped 655 lines
  • ■ ■ ■ ■ ■ ■
    docker-compose.yaml
    1 1  version: '3.4'
    2 2  services:
    3 3   mongo:
    4  - vscommand: mongod --quiet --logpath /dev/null
     4 + command: mongod --quiet --logpath /dev/null
    5 5   image: mongo
    6 6   restart: always
    7 7   ports:
    8 8   - 27017:27017
    9 9  
     10 + rabbitmq:
     11 + image: rabbitmq:3-management
     12 + restart: always
     13 + logging:
     14 + driver: none
     15 + ports:
     16 + - 5672:5672
     17 + - 15672:15672
     18 + volumes:
     19 + - ./rabbit-mq/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf:ro
     20 + healthcheck:
     21 + test: [ "CMD", "rabbitmqctl", "status"]
     22 + interval: 30s
     23 + timeout: 15s
     24 + retries: 5
     25 + 
     26 + 
    10 27   sirius-api:
    11 28   build: ./API/
    12 29   restart: always
    skipped 10 lines
    23 40   - "5173:5173"
    24 41   volumes:
    25 42   - ./UI:/app
     43 + - /app/node_modules
    26 44   depends_on:
    27 45   - sirius-api
     46 + 
     47 + sirius-engine:
     48 + build: ./Engine/
     49 + restart: always
     50 + ports:
     51 + - "5174:5174"
     52 + volumes:
     53 + - ./Engine:/engine
     54 + depends_on:
     55 + - rabbitmq
  • ■ ■ ■ ■ ■
    rabbit-mq/rabbitmq.conf
     1 +listeners.tcp.default = 5672
Please wait...
Page is in error, reload to recover