Skip to content

Commit 905377e

Browse files
committed
Improve rendering conciseness
1 parent d9a130d commit 905377e

25 files changed

+29
-13
lines changed

pkg/bincapz/render.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func forceWrap(s string, x int) string {
2525
fw := []string{}
2626
for _, w := range words {
2727
if len(w) > x-2 {
28+
klog.Infof("wrapping %s - longer than %d", w, x-2)
2829
w = w[0:x-2] + ".."
2930
}
3031
fw = append(fw, w)
@@ -85,19 +86,21 @@ func RenderTable(fr *FileReport, w io.Writer) {
8586
data = append(data, []string{"", "", "", ""})
8687
}
8788

88-
valWidth := 24
8989
width := terminalWidth()
90-
if width > 110 {
91-
valWidth += (width - 110)
90+
valWidth := 8
91+
92+
if width > 90 {
93+
valWidth = (width - 90)
9294
}
95+
9396
if valWidth > 65 {
9497
valWidth = 65
9598
}
9699

97100
klog.Infof("terminal width: %d / val width: %d", width, valWidth)
98101

99102
for _, k := range kbs {
100-
val := strings.Join(k.Behavior.Strings, "|||")
103+
val := strings.Join(k.Behavior.Strings, "\n")
101104
val = forceWrap(val, valWidth)
102105
val = strings.ReplaceAll(val, "|||", "\n")
103106

@@ -114,15 +117,15 @@ func RenderTable(fr *FileReport, w io.Writer) {
114117
}
115118
}
116119

117-
words, _ := tablewriter.WrapString(desc, 52)
120+
words, _ := tablewriter.WrapString(desc, 40)
118121
desc = strings.Join(words, "\n")
119122

120123
data = append(data, []string{fmt.Sprintf("%d/%s", k.Behavior.RiskScore, k.Behavior.RiskLevel), k.Key, val, desc})
121124
}
122125
table := tablewriter.NewWriter(os.Stdout)
123126
table.SetAutoWrapText(false)
124127
table.SetHeader([]string{"Risk", "Key", "Values", "Description"})
125-
//table.SetBorder(false)
128+
table.SetBorder(false)
126129
for _, d := range data {
127130
if strings.Contains(d[0], "LOW") {
128131
table.Rich(d, []tablewriter.Colors{tablewriter.Colors{tablewriter.Normal, tablewriter.FgGreenColor}})

pkg/bincapz/report.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ var yaraForgeJunkWords = map[string]bool{
6464
"encoded": true,
6565
"forensicartifacts": true,
6666
"lnx": true,
67+
"linux": true,
6768
}
6869

6970
var dateRe = regexp.MustCompile(`[a-z]{3}\d{1,2}`)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)