Skip to content

Commit 1b3f911

Browse files
committed
Change credential status from untried to successful
1 parent b6936fe commit 1b3f911

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

modules/auxiliary/scanner/pcanywhere/pcanywhere_login.rb

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ def run_host(ip)
3939

4040
each_user_pass do |user, pass|
4141
next if user.blank? or pass.blank?
42-
print_status "Trying #{user}:#{pass}"
42+
print_status("Trying #{user}:#{pass}")
4343
result = do_login(user, pass)
4444
case result
4545
when :success
46-
print_good "#{ip}:#{rport} Login Successful #{user}:#{pass}"
46+
print_good("#{ip}:#{rport} Login Successful #{user}:#{pass}")
4747
report_cred(
4848
ip: rhost,
4949
port: datastore['RPORT'],
@@ -52,16 +52,16 @@ def run_host(ip)
5252
password: pass,
5353
)
5454
return if datastore['STOP_ON_SUCCESS']
55-
print_status "Waiting to Re-Negotiate Connection (this may take a minute)..."
55+
print_status('Waiting to Re-Negotiate Connection (this may take a minute)...')
5656
select(nil, nil, nil, 40)
5757
connect
5858
hsr = pca_handshake(ip)
5959
return if hsr == :handshake_failed
6060
when :fail
61-
print_status "#{ip}:#{rport} Login Failure #{user}:#{pass}"
61+
print_status("#{ip}:#{rport} Login Failure #{user}:#{pass}")
6262
when :reset
63-
print_status "#{ip}:#{rport} Login Failure #{user}:#{pass}"
64-
print_status "Connection Reset Attempting to reconnect in 1 second"
63+
print_status("#{ip}:#{rport} Login Failure #{user}:#{pass}")
64+
print_status('Connection reset attempting to reconnect in 1 second')
6565
select(nil, nil, nil, 1)
6666
connect
6767
hsr = pca_handshake(ip)
@@ -90,7 +90,7 @@ def report_cred(opts)
9090

9191
login_data = {
9292
core: create_credential(credential_data),
93-
status: Metasploit::Model::Login::Status::UNTRIED,
93+
status: Metasploit::Model::Login::Status::SUCCESSFUL,
9494
}.merge(service_data)
9595

9696
create_credential_login(login_data)
@@ -110,18 +110,18 @@ def do_login(user, pass, nsock=self.sock)
110110
end
111111

112112
# Check if we are now at the password prompt
113-
unless res and res.include? "Enter password"
114-
print_error "Problem Sending Login: #{res.inspect}"
113+
unless res and res.include? 'Enter password'
114+
print_error("Problem Sending Login: #{res.inspect}")
115115
return :abort
116116
end
117117

118118
epass = encryption_header(encrypt(pass))
119119
nsock.put(epass)
120120
res = nsock.get_once(-1,20)
121-
if res.include? "Login unsuccessful"
121+
if res.include? 'Login unsuccessful'
122122
disconnect()
123123
return :reset
124-
elsif res.include? "Invalid login"
124+
elsif res.include? 'Invalid login'
125125
return :fail
126126
else
127127
disconnect()
@@ -130,38 +130,38 @@ def do_login(user, pass, nsock=self.sock)
130130
end
131131

132132
def pca_handshake(ip, nsock=self.sock)
133-
print_status "Handshaking with the pcAnywhere service"
133+
print_status('Handshaking with the pcAnywhere service')
134134
nsock.put("\x00\x00\x00\x00")
135135
res = nsock.get_once(-1,5)
136-
unless res and res.include? "Please press <Enter>"
137-
print_error "Handshake(1) failed on Host #{ip} aborting. (Error: #{res.inspect} )"
136+
unless res and res.include? 'Please press <Enter>'
137+
print_error("Handshake(1) failed on Host #{ip} aborting. Error: #{res.inspect}")
138138
return :handshake_failed
139139
end
140140

141141
nsock.put("\x6F\x06\xff")
142142
res = nsock.get_once(-1,5)
143143
unless res and res.include? "\x78\x02\x1b\x61"
144-
print_error "Handshake(2) failed on Host #{ip} aborting. (Error: #{res.inspect} )"
144+
print_error("Handshake(2) failed on Host #{ip} aborting. Error: #{res.inspect}")
145145
return :handshake_failed
146146
end
147147

148148
nsock.put("\x6f\x61\x00\x09\x00\xfe\x00\x00\xff\xff\x00\x00\x00\x00")
149149
res = nsock.get_once(-1,5)
150150
unless res and res == "\x1b\x62\x00\x02\x00\x00\x00"
151-
print_error "Handshake(3) failed on Host #{ip} aborting. (Error: #{res.inspect} )"
151+
print_error("Handshake(3) failed on Host #{ip} aborting. Error: #{res.inspect}")
152152
return :handshake_failed
153153
end
154154

155155
nsock.put("\x6f\x62\x01\x02\x00\x00\x00")
156156
res = nsock.get_once(-1,5)
157157
unless res and res.include? "\x00\x7D\x08"
158-
print_error "Handshake(4) failed on Host #{ip} aborting. (Error: #{res.inspect} )"
158+
print_error("Handshake(4) failed on Host #{ip} aborting. Error: #{res.inspect}")
159159
return :handshake_failed
160160
end
161161

162162
res = nsock.get_once(-1,5) unless pca_at_login?(res)
163163
unless pca_at_login?(res)
164-
print_error "Handshake(5) failed on Host #{ip} aborting. (Error: #{res.inspect} )"
164+
print_error("Handshake(5) failed on Host #{ip} aborting. Error: #{res.inspect}")
165165
return :handshake_failed
166166
end
167167
end

0 commit comments

Comments
 (0)