Skip to content

Commit b6936fe

Browse files
committed
Update pcanywhere_login to use the new cred API
1 parent 4ee0a14 commit b6936fe

File tree

1 file changed

+31
-8
lines changed

1 file changed

+31
-8
lines changed

modules/auxiliary/scanner/pcanywhere/pcanywhere_login.rb

Lines changed: 31 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,12 @@ def run_host(ip)
4444
case result
4545
when :success
4646
print_good "#{ip}:#{rport} Login Successful #{user}:#{pass}"
47-
report_auth_info(
48-
:host => rhost,
49-
:port => datastore['RPORT'],
50-
:sname => 'pcanywhere_data',
51-
:user => user,
52-
:pass => pass,
53-
:source_type => "user_supplied",
54-
:active => true
47+
report_cred(
48+
ip: rhost,
49+
port: datastore['RPORT'],
50+
service_name: 'pcanywhere',
51+
user: user,
52+
password: pass,
5553
)
5654
return if datastore['STOP_ON_SUCCESS']
5755
print_status "Waiting to Re-Negotiate Connection (this may take a minute)..."
@@ -73,6 +71,31 @@ def run_host(ip)
7371

7472
end
7573

74+
def report_cred(opts)
75+
service_data = {
76+
address: opts[:ip],
77+
port: opts[:port],
78+
service_name: opts[:service_name],
79+
protocol: 'tcp',
80+
workspace_id: myworkspace_id
81+
}
82+
83+
credential_data = {
84+
origin_type: :service,
85+
module_fullname: fullname,
86+
username: opts[:user],
87+
private_data: opts[:password],
88+
private_type: :password
89+
}.merge(service_data)
90+
91+
login_data = {
92+
core: create_credential(credential_data),
93+
status: Metasploit::Model::Login::Status::UNTRIED,
94+
}.merge(service_data)
95+
96+
create_credential_login(login_data)
97+
end
98+
7699
def do_login(user, pass, nsock=self.sock)
77100
# Check if we are already at a logon prompt
78101
res = nsock.get_once(-1,5)

0 commit comments

Comments
 (0)