@@ -148,16 +148,20 @@ func runFlowCaptureOnAddr(port int, filename string) {
148148 // terminate capture if max bytes reached
149149 totalBytes = totalBytes + int64 (bytes )
150150 if totalBytes > maxBytes {
151- log .Infof ("Capture reached %s, exiting now..." , sizestr .ToString (maxBytes ))
152- return
151+ if exit := onLimitReached (); exit {
152+ log .Infof ("Capture reached %s, exiting now..." , sizestr .ToString (maxBytes ))
153+ return
154+ }
153155 }
154156
155157 // terminate capture if max time reached
156158 now := currentTime ()
157159 duration := now .Sub (startupTime )
158160 if int (duration ) > int (maxTime ) {
159- log .Infof ("Capture reached %s, exiting now..." , maxTime )
160- return
161+ if exit := onLimitReached (); exit {
162+ log .Infof ("Capture reached %s, exiting now..." , maxTime )
163+ return
164+ }
161165 }
162166
163167 captureStarted = true
@@ -242,7 +246,7 @@ func toSize(fieldName string) int {
242246func updateTable () {
243247 // don't refresh terminal too often to avoid blinking
244248 now := currentTime ()
245- if int (now .Sub (lastRefresh )) > int (maxRefreshRate ) {
249+ if ! captureEnded && int (now .Sub (lastRefresh )) > int (maxRefreshRate ) {
246250 lastRefresh = now
247251 resetTerminal ()
248252
@@ -252,12 +256,18 @@ func updateTable() {
252256 fmt .Printf ("Log level: %s " , logLevel )
253257 fmt .Printf ("Duration: %s " , duration .Round (time .Second ))
254258 fmt .Printf ("Capture size: %s\n " , sizestr .ToString (totalBytes ))
255- if len (strings .TrimSpace (filter )) > 0 {
256- fmt .Printf ("Filters: %s\n " , filter )
259+ if len (strings .TrimSpace (options )) > 0 {
260+ fmt .Printf ("Options: %s\n " , options )
261+ }
262+ if strings .Contains (options , "background=true" ) {
263+ fmt .Printf ("Showing last: %d\n " , flowsToShow )
264+ fmt .Printf ("Display: %s\n " , strings .Join (display , "," ))
265+ fmt .Printf ("Enrichment: %s\n " , strings .Join (enrichement , "," ))
266+ } else {
267+ fmt .Printf ("Showing last: %d Use Up / Down keyboard arrows to increase / decrease limit\n " , flowsToShow )
268+ fmt .Printf ("Display: %s Use Left / Right keyboard arrows to cycle views\n " , strings .Join (display , "," ))
269+ fmt .Printf ("Enrichment: %s Use Page Up / Page Down keyboard keys to cycle enrichment scopes\n " , strings .Join (enrichement , "," ))
257270 }
258- fmt .Printf ("Showing last: %d Use Up / Down keyboard arrows to increase / decrease limit\n " , flowsToShow )
259- fmt .Printf ("Display: %s Use Left / Right keyboard arrows to cycle views\n " , strings .Join (display , "," ))
260- fmt .Printf ("Enrichment: %s Use Page Up / Page Down keyboard keys to cycle enrichment scopes\n " , strings .Join (enrichement , "," ))
261271 }
262272
263273 if slices .Contains (display , rawDisplay ) {
@@ -394,7 +404,6 @@ func updateTable() {
394404 fmt .Printf ("Type anything to filter incoming flows in view\n " )
395405 }
396406 }
397-
398407 }
399408}
400409
0 commit comments