@@ -63,46 +63,20 @@ def run_host(ip)
63
63
connection_timeout : 30
64
64
)
65
65
66
- service_data = {
67
- address : ip ,
68
- port : rport ,
69
- service_name : 'afp' ,
70
- protocol : 'tcp' ,
71
- workspace_id : myworkspace_id
72
- }
73
-
74
66
scanner . scan! do |result |
67
+ credential_data = result . to_h
68
+ credential_data . merge! (
69
+ module_fullname : self . fullname ,
70
+ workspace_id : myworkspace_id
71
+ )
75
72
if result . success?
76
- credential_data = {
77
- module_fullname : self . fullname ,
78
- origin_type : :service ,
79
- private_data : result . credential . private ,
80
- private_type : :password ,
81
- username : result . credential . public
82
- }
83
- credential_data . merge! ( service_data )
84
-
85
73
credential_core = create_credential ( credential_data )
74
+ credential_data [ :core ] = credential_core
75
+ create_credential_login ( credential_data )
86
76
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
77
print_good "#{ ip } :#{ rport } - LOGIN SUCCESSFUL: #{ result . credential } "
96
78
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 : nil ,
104
- realm_value : nil ,
105
- status : result . status )
79
+ invalidate_login ( credential_data )
106
80
print_status "#{ ip } :#{ rport } - LOGIN FAILED: #{ result . credential } (#{ result . status } : #{ result . proof } )"
107
81
end
108
82
end
0 commit comments