Skip to content

Commit

Permalink
Merge pull request #219 from yasin-cs-ko-ak/bindconn
Browse files Browse the repository at this point in the history
bind port connections table for summarised data
  • Loading branch information
nyrahul authored Dec 15, 2022
2 parents 48c47ba + 8b58051 commit 8edc262
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ require (
)

require (
github.com/accuknox/auto-policy-discovery/src v0.0.0-20221129114555-66fc8ef6cfe4
github.com/accuknox/auto-policy-discovery/src v0.0.0-20221206061659-45c77dd83169
github.com/cavaliergopher/grab/v3 v3.0.1
github.com/charmbracelet/bubbles v0.14.0
github.com/charmbracelet/bubbletea v0.22.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdko
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg=
github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA=
github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8=
github.com/accuknox/auto-policy-discovery/src v0.0.0-20221129114555-66fc8ef6cfe4 h1:YMokhKwAQ0YU518HBeo5kDfoA+lTQ6F0efBKXG0at4U=
github.com/accuknox/auto-policy-discovery/src v0.0.0-20221129114555-66fc8ef6cfe4/go.mod h1:op1lUWTnZLiYtot7e3GqQa+aZstvMg/ZvRMU0QBoNV4=
github.com/accuknox/auto-policy-discovery/src v0.0.0-20221206061659-45c77dd83169 h1:3oijVWWFoIaFrbfRssaAU0lg5DPifxRsEQ7N3PHV3o4=
github.com/accuknox/auto-policy-discovery/src v0.0.0-20221206061659-45c77dd83169/go.mod h1:op1lUWTnZLiYtot7e3GqQa+aZstvMg/ZvRMU0QBoNV4=
github.com/agnivade/levenshtein v1.0.1/go.mod h1:CURSv5d9Uaml+FovSIICkLbAUZ9S4RqaHDIsdSBg7lM=
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
Expand Down
20 changes: 20 additions & 0 deletions summary/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ var (
SysFileHeader = []string{"Src Process", "Destination File Path", "Count", "Last Updated Time", "Status"}
// SysNwHeader variable contains protocol, command, POD/SVC/IP, Port, Namespace, and Labels
SysNwHeader = []string{"Protocol", "Command", "POD/SVC/IP", "Port", "Namespace", "Labels", "Count", "Last Updated Time"}
// SysBindNwHeader variable contains protocol, command, Bind Port, Bind Address, count and timestamp
SysBindNwHeader = []string{"Protocol", "Command", "Bind Port", "Bind Address", "Count", "Last Updated Time"}
)

// DisplaySummaryOutput function
Expand Down Expand Up @@ -141,6 +143,24 @@ func DisplaySummaryOutput(resp *opb.Response, revDNSLookup bool, requestType str
WriteTable(SysNwHeader, outNwRowData)
fmt.Printf("\n")
}

if len(resp.BindConnection) > 0 {
fmt.Printf("\nBind Points\n")
// Display bind connections details
bindNwRowData := [][]string{}
for _, bindConnection := range resp.BindConnection {
bindNwStrSlice := []string{}
bindNwStrSlice = append(bindNwStrSlice, bindConnection.Protocol)
bindNwStrSlice = append(bindNwStrSlice, bindConnection.Command)
bindNwStrSlice = append(bindNwStrSlice, bindConnection.BindPort)
bindNwStrSlice = append(bindNwStrSlice, bindConnection.BindAddress)
bindNwStrSlice = append(bindNwStrSlice, bindConnection.Count)
bindNwStrSlice = append(bindNwStrSlice, bindConnection.UpdatedTime)
bindNwRowData = append(bindNwRowData, bindNwStrSlice)
}
WriteTable(SysBindNwHeader, bindNwRowData)
fmt.Printf("\n")
}
}
}

Expand Down

0 comments on commit 8edc262

Please sign in to comment.