Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: use explicit naming #35

Merged
merged 1 commit into from
Oct 3, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions lib/rogue_one/detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ def inspect
return unless @memo.empty?

# read domains outside of the async blocks
domains
load_domains

normal = bulk_resolve(normal_resolver, domains)
normal_resolutions = bulk_resolve(normal_resolver, domains)
resolutions = bulk_resolve(target_resolver, domains)

results = resolutions.map do |domain, addresses|
normal_addresses = normal.dig(domain) || []
normal_addresses = normal_resolutions.dig(domain) || []
address = (addresses || []).first
[domain, address] if address && !normal_addresses.include?(address)
end.compact.to_h
Expand All @@ -104,6 +104,10 @@ def inspect
@verbose_memo = results if verbose
end

def load_domains
domains
end

def domains
@domains ||= custom_list ? custom_domains : top_100_domains
end
Expand Down