Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
rapid7
GitHub Repository: rapid7/metasploit-framework
Path: blob/master/lib/msf/core/module/failure.rb
19516 views
1
# Constants indicating the reason for an unsuccessful module attempt
2
module Msf::Module::Failure
3
# The exploit settings were incorrect
4
BadConfig = 'bad-config'
5
6
# The network service disconnected us mid-attempt
7
Disconnected = 'disconnected'
8
9
# The application replied indication we do not have access
10
NoAccess = 'no-access'
11
12
# No confidence in success or failure
13
None = 'none'
14
15
# The target is not compatible with this exploit or settings
16
NoTarget = 'no-target'
17
18
# The application endpoint or specific service was not found
19
NotFound = 'not-found'
20
21
# The application response indicated it was not vulnerable
22
NotVulnerable = 'not-vulnerable'
23
24
# The payload was delivered but no session was opened (AV, network, etc)
25
PayloadFailed = 'payload-failed'
26
27
# The exploit triggered some form of timeout
28
TimeoutExpired = 'timeout-expired'
29
30
# The application replied in an unexpected fashion
31
UnexpectedReply = 'unexpected-reply'
32
33
# No confidence in success or failure
34
Unknown = 'unknown'
35
36
# The network service was unreachable (connection refused, etc)
37
Unreachable = 'unreachable'
38
39
# The exploit was interrupted by the user
40
UserInterrupt = 'user-interrupt'
41
42
43
def report_failure
44
return unless framework.db and framework.db.active
45
46
info = {
47
timestamp: Time.now.utc,
48
workspace: framework.db.find_workspace(self.workspace),
49
module: self.fullname,
50
fail_reason: self.fail_reason,
51
fail_detail: self.fail_detail,
52
username: self.owner,
53
refs: self.references,
54
run_id: self.datastore['RUN_ID']
55
}
56
info[:target_name] = self.target.name if self.respond_to?(:target)
57
58
if self.datastore['RHOST'] && (self.options['RHOST'] || self.options['RHOSTS'])
59
info[:host] = self.datastore['RHOST']
60
end
61
62
if self.datastore['RPORT'] and self.options['RPORT']
63
info[:port] = self.datastore['RPORT']
64
if self.class.ancestors.include?(Msf::Exploit::Remote::Tcp)
65
info[:proto] = 'tcp'
66
end
67
end
68
69
framework.db.report_exploit_failure(info)
70
end
71
72
end
73
74