Skip to content

Commit 601c551

Browse files
committed
Corrected 3 issues identified by jlee-r7
1 parent 081a343 commit 601c551

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/post/windows/gather/enum_snmp.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def community_strings
6363
if not comm_str.nil? and not comm_str.empty?
6464
comm_str.each do |c|
6565

66-
#comm_type is for human display, access_type is passed to the credential
67-
#code using labels consistent with the SNMP login scanner
66+
# comm_type is for human display, access_type is passed to the credential
67+
# code using labels consistent with the SNMP login scanner
6868
case registry_getvaldata(key,c)
6969
when 4
7070
comm_type = 'READ ONLY'
@@ -86,7 +86,7 @@ def community_strings
8686
# Save data to table
8787
tbl << [c,comm_type]
8888

89-
register_creds(session.sock.peerhost, 161, '', c, 'snmp', access_type)
89+
register_creds(session.session_host, 161, '', c, 'snmp', access_type)
9090
end
9191
print_status("")
9292

@@ -156,14 +156,14 @@ def register_creds(client_ip, client_port, user, pass, service_name, access_type
156156
credential_data = {
157157
access_level: access_type,
158158
origin_type: :session,
159+
session_id: session_db_id,
159160
post_reference_name: self.fullname,
160161
private_data: pass,
161162
private_type: :password,
162163
username: user,
163164
workspace_id: myworkspace_id
164165
}
165166

166-
credential_data[:session_id] = session.db_record.id if !session.db_record.nil?
167167
credential_data.merge!(service_data)
168168
credential_core = create_credential(credential_data)
169169

0 commit comments

Comments
 (0)