1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
From 0ee73bd14c71e44ce53bc1016b871dcb6965e443 Mon Sep 17 00:00:00 2001
From: "Rick Farina (Zero_Chaos)" <zerochaos@gentoo.org>
Date: Tue, 17 Mar 2015 12:57:16 -0400
Subject: [PATCH] update kismet_shootout
make a little more detailed, 100.00 instead of 100.
also extend space for name now that wlan0mon is a common interface name
---
ruby/kismet_shootout.rb | 30 +++++++++++++++++++++++-------
1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/ruby/kismet_shootout.rb b/ruby/kismet_shootout.rb
index 931360f..61f70b0 100755
--- a/ruby/kismet_shootout.rb
+++ b/ruby/kismet_shootout.rb
@@ -48,7 +48,7 @@ $lines_per_header = 10
$num_printed = 10
# output type (std, pretty, csv)
-$output_type = "std"
+$output_type = "pretty"
def sourcecb(proto, fields)
if fields["error"] != "0"
@@ -102,11 +102,11 @@ def sourcecb(proto, fields)
hstr = ""
if $output_type == "pretty"
- hstr = sprintf("%s %6.6s %5.5s %8.8s %4.4s", hstr, "", "PPS", "Packets", "Pcnt")
+ hstr = sprintf("%s %8.8s %5.5s %8.8s %7.7s", hstr, "Name", "PPS", "Packets", "Percent")
else
$cards.each { |c|
- hstr = sprintf("%s %6.6s %5.5s %8.8s %4.4s", hstr, c, "PPS", "Total", "Pcnt")
+ hstr = sprintf("%s %8.8s %5.5s %8.8s %7.7s", hstr, c, "PPS", "Total", "Percent")
}
end
@@ -141,7 +141,7 @@ def sourcecb(proto, fields)
$card_records.each { |cr|
cr[1]["printed"] = 1
- printf(" %6.6s %5.5s %8.8s %3d%%\n", cr[1]["interface"], cr[1]["packets"] - cr[1]["last_packets"], cr[1]["packets"], (cr[1]["packets"].to_f / best.to_f) * 100)
+ printf(" %8.8s %5.5s %8.8s %6.2f%%\n", cr[1]["interface"], cr[1]["packets"] - cr[1]["last_packets"], cr[1]["packets"], (cr[1]["packets"].to_f / best.to_f) * 100)
}
t = Time.now.to_i - $start_time
@@ -163,7 +163,7 @@ def sourcecb(proto, fields)
tu += "#{t}s"
end
- printf(" %6.6s %5.5s %8.8s %4.4s %6.6s %6.6s\n", "", "", "", "", total - lasttotal, tu)
+ printf(" %8.8s %5.5s %8.8s %7.7s %6.6s %6.6s\n", "", "", "", "", total - lasttotal, tu)
else
$card_records.each { |cr|
cr[1]["printed"] = 1
@@ -171,7 +171,7 @@ def sourcecb(proto, fields)
cname = ""
cname = cr[1]["interface"] if $output_type == "pretty"
- str = sprintf("%s %6.6s %5.5s %8.8s %3d%%", str, cname, cr[1]["packets"] - cr[1]["last_packets"], cr[1]["packets"], (cr[1]["packets"].to_f / best.to_f) * 100)
+ str = sprintf("%s %8.8s %5.5s %8.8s %6.2f%%", str, cname, cr[1]["packets"] - cr[1]["last_packets"], cr[1]["packets"], (cr[1]["packets"].to_f / best.to_f) * 100)
}
t = Time.now.to_i - $start_time
@@ -282,10 +282,18 @@ OptionParser.new do |opts|
options[:channel] = c
end
- opts.on("--pretty", "Format output with pretty ANSI codes") do
+ opts.on("--pretty", "Format output with pretty ANSI codes (default)") do
options[:pretty] = true
end
+ opts.on("--std", "Do not format output with pretty ANSI codes") do
+ options[:std] = true
+ end
+
+ #opts.on("--csv", "Format output as comma separated values") do
+ # options[:csv] = true
+ #end
+
end.parse!
if options[:host]
@@ -315,6 +323,14 @@ if options[:pretty]
$output_type = "pretty"
end
+if options[:std]
+ $output_type = "std"
+end
+
+if options[:csv]
+ $output_type = "csv"
+end
+
$cards = ARGV
puts "INFO: Kismet NIC Shootout"
--
2.0.5
|