repsheet_visualizer 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/repsheet_visualizer/application/app.rb +28 -11
- data/lib/repsheet_visualizer/version.rb +1 -1
- metadata +2 -2
data/Gemfile.lock
CHANGED
@@ -47,25 +47,42 @@ class RepsheetVisualizer < Sinatra::Base
|
|
47
47
|
suspects = {}
|
48
48
|
blacklisted = {}
|
49
49
|
|
50
|
-
connection.
|
51
|
-
|
52
|
-
blacklist = connection.get("#{actor}:repsheet:blacklist")
|
53
|
-
|
54
|
-
if !detected.empty? && blacklist != "true"
|
50
|
+
if connection.exists("offenders")
|
51
|
+
connection.zrevrangebyscore("offenders", "+inf", "0").each do |actor|
|
55
52
|
suspects[actor] = Hash.new 0
|
56
|
-
suspects[actor][:detected] = detected
|
57
|
-
connection.
|
58
|
-
suspects[actor][:total] += connection.get("#{actor}:#{rule}:count").to_i
|
59
|
-
end
|
53
|
+
suspects[actor][:detected] = connection.smembers("#{actor}:detected").join(", ")
|
54
|
+
suspects[actor][:total] = connection.zscore("offenders", actor)
|
60
55
|
end
|
61
56
|
|
62
|
-
|
57
|
+
connection.keys("*:*:blacklist").map {|d| d.split(":").first}.reject {|ip| ip.empty?}.each do |actor|
|
58
|
+
connection.get("#{actor}:repsheet:blacklist") == "true"
|
63
59
|
blacklisted[actor] = Hash.new 0
|
64
|
-
blacklisted[actor][:detected] = detected
|
60
|
+
blacklisted[actor][:detected] = connection.smembers("#{actor}:detected").join(", ")
|
65
61
|
connection.smembers("#{actor}:detected").each do |rule|
|
66
62
|
blacklisted[actor][:total] += connection.get("#{actor}:#{rule}:count").to_i
|
67
63
|
end
|
68
64
|
end
|
65
|
+
else
|
66
|
+
connection.keys("*:requests").map {|d| d.split(":").first}.reject {|ip| ip.empty?}.each do |actor|
|
67
|
+
detected = connection.smembers("#{actor}:detected").join(", ")
|
68
|
+
blacklist = connection.get("#{actor}:repsheet:blacklist")
|
69
|
+
|
70
|
+
if !detected.empty? && blacklist != "true"
|
71
|
+
suspects[actor] = Hash.new 0
|
72
|
+
suspects[actor][:detected] = detected
|
73
|
+
connection.smembers("#{actor}:detected").each do |rule|
|
74
|
+
suspects[actor][:total] += connection.get("#{actor}:#{rule}:count").to_i
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
if blacklist == "true"
|
79
|
+
blacklisted[actor] = Hash.new 0
|
80
|
+
blacklisted[actor][:detected] = detected
|
81
|
+
connection.smembers("#{actor}:detected").each do |rule|
|
82
|
+
blacklisted[actor][:total] += connection.get("#{actor}:#{rule}:count").to_i
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
69
86
|
end
|
70
87
|
|
71
88
|
[suspects.sort_by{|k,v| -v[:total]}.take(10), blacklisted]
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repsheet_visualizer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-06-
|
12
|
+
date: 2013-06-20 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: geoip
|