Module: Msf::Module::Failure

Included in:
Msf::Module
Defined in:
lib/msf/core/module/failure.rb

Overview

Constants indicating the reason for an unsuccessful module attempt

Constant Summary collapse

BadConfig =

The exploit settings were incorrect

'bad-config'
Disconnected =

The network service disconnected us mid-attempt

'disconnected'
NoAccess =

The application replied indication we do not have access

'no-access'
None =

No confidence in success or failure

'none'
NoTarget =

The target is not compatible with this exploit or settings

'no-target'
NotFound =

The application endpoint or specific service was not found

'not-found'
NotVulnerable =

The application response indicated it was not vulnerable

'not-vulnerable'
PayloadFailed =

The payload was delivered but no session was opened (AV, network, etc)

'payload-failed'
TimeoutExpired =

The exploit triggered some form of timeout

'timeout-expired'
UnexpectedReply =

The application replied in an unexpected fashion

'unexpected-reply'
Unknown =

No confidence in success or failure

'unknown'
Unreachable =

The network service was unreachable (connection refused, etc)

'unreachable'
UserInterrupt =

The exploit was interrupted by the user

'user-interrupt'

Instance Method Summary collapse

Instance Method Details

#report_failureObject



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/msf/core/module/failure.rb', line 43

def report_failure
  return unless framework.db and framework.db.active

  info = {
    timestamp: Time.now.utc,
    workspace: framework.db.find_workspace(self.workspace),
    module: self.fullname,
    fail_reason: self.fail_reason,
    fail_detail: self.fail_detail,
    username: self.owner,
    refs: self.references,
    run_id: self.datastore['RUN_ID']
  }
  info[:target_name] = self.target.name if self.respond_to?(:target)

  if self.datastore['RHOST'] && (self.options['RHOST'] || self.options['RHOSTS'])
    # Only include RHOST if it's a single valid host, not a multi-value string or file path
    rhost = self.datastore['RHOST'].to_s
    # Check if RHOST is a valid IP address to avoid ActiveRecord issues on validation
    if Rex::Socket.is_ip_addr?(rhost)
      info[:host] = rhost
    end
  end
  
  if self.datastore['RPORT'] and self.options['RPORT']
    info[:port] = self.datastore['RPORT']
    if self.class.ancestors.include?(Msf::Exploit::Remote::Tcp)
      info[:proto] = 'tcp'
    end
  end

  framework.db.report_exploit_failure(info)
end