This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
scan-parallel.rb
executable file
·50 lines (42 loc) · 1.74 KB
/
scan-parallel.rb
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
#!/usr/bin/env ruby
# coding: utf-8
require "yaml"
require_relative "scan_common"
manifest_path = ARGV[0] || "directors.yml"
manifest = YAML.load_file manifest_path
teams = manifest.fetch("teams")
def report_full(team, director, resultish, name)
Thread.new do
result = if resultish.is_a?(Proc)
resultish.call
else
resultish
end
printf "%-15.15s | %-25.25s | %-40.40s | %s\n", team, director, name, result
STDOUT.flush
end
end
threads = []
teams.each_slice(4) do |teams|
teams.each do |team|
directors = team.fetch("directors")
directors.each do |director|
report = lambda do |result, name|
threads << report_full(team.fetch("name"), director, result, name)
end
report.call lambda { scan_user(director) }, "director admin/admin"
report.call lambda { scan_hm(director) }, "director hm/hm-password"
report.call lambda { scan_nats(director) }, "nats"
report.call lambda { scan_agent(director, "mbus", "mbus-password") }, "agent mbus/mbus-password"
report.call lambda { scan_agent(director, "mbus-user", "mbus-password") }, "agent mbus-user/mbus-password"
report.call lambda { scan_postgres(director) }, "postgres"
report.call lambda { scan_blobstore(director, "director", "director-password") }, "blobstore director/director-password"
report.call lambda { scan_blobstore(director, "agent", "agent-password") }, "blobstore agent/agent-password"
report.call lambda { scan_registry(director, "admin", "admin") }, "registry admin/admin"
report.call lambda { scan_redis(director) }, "redis"
report.call lambda { scan_hm_http(director) }, "hm http"
end
end
threads.each(&:join)
threads = []
end