@@ -61,48 +61,20 @@ def run_host(ip)
61
61
connection_timeout : 30
62
62
)
63
63
64
- service_data = {
65
- address : ip ,
66
- port : rport ,
67
- service_name : 'db2' ,
68
- protocol : 'tcp' ,
69
- workspace_id : myworkspace_id
70
- }
71
-
72
64
scanner . scan! do |result |
65
+ credential_data = result . to_h
66
+ credential_data . merge! (
67
+ module_fullname : self . fullname ,
68
+ workspace_id : myworkspace_id
69
+ )
73
70
if result . success?
74
- credential_data = {
75
- module_fullname : self . fullname ,
76
- origin_type : :service ,
77
- private_data : result . credential . private ,
78
- private_type : :password ,
79
- realm_key : Metasploit ::Model ::Realm ::Key ::DB2_DATABASE ,
80
- realm_value : result . credential . realm ,
81
- username : result . credential . public
82
- }
83
- credential_data . merge! ( service_data )
84
-
85
71
credential_core = create_credential ( credential_data )
72
+ credential_data [ :core ] = credential_core
73
+ create_credential_login ( credential_data )
86
74
87
- login_data = {
88
- core : credential_core ,
89
- last_attempted_at : DateTime . now ,
90
- status : Metasploit ::Model ::Login ::Status ::SUCCESSFUL
91
- }
92
- login_data . merge! ( service_data )
93
-
94
- create_credential_login ( login_data )
95
75
print_good "#{ ip } :#{ rport } - LOGIN SUCCESSFUL: #{ result . credential } "
96
76
else
97
- invalidate_login (
98
- address : ip ,
99
- port : rport ,
100
- protocol : 'tcp' ,
101
- public : result . credential . public ,
102
- private : result . credential . private ,
103
- realm_key : Metasploit ::Model ::Realm ::Key ::DB2_DATABASE ,
104
- realm_value : result . credential . realm ,
105
- status : result . status )
77
+ invalidate_login ( credential_data )
106
78
print_status "#{ ip } :#{ rport } - LOGIN FAILED: #{ result . credential } (#{ result . status } : #{ result . proof } )"
107
79
end
108
80
end
0 commit comments