Skip to content

Commit 4706f8b

Browse files
author
HD Moore
committed
Add fail_with() stub and move Failure from Exploit
1 parent 0ef4b4c commit 4706f8b

File tree

1 file changed

+79
-0
lines changed

1 file changed

+79
-0
lines changed

lib/msf/core/module.rb

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,85 @@ def search_filter(search_string)
734734
false
735735
end
736736

737+
#
738+
# Support fail_with for all module types, allow specific classes to override
739+
#
740+
def fail_with(reason, msg=nil)
741+
raise RuntimeError, "#{reason.to_s}: #{msg}"
742+
end
743+
744+
#
745+
# Constants indicating the reason for an unsuccessful module attempt
746+
#
747+
module Failure
748+
749+
#
750+
# No confidence in success or failure
751+
#
752+
None = 'none'
753+
754+
#
755+
# No confidence in success or failure
756+
#
757+
Unknown = 'unknown'
758+
759+
#
760+
# The network service was unreachable (connection refused, etc)
761+
#
762+
Unreachable = 'unreachable'
763+
764+
#
765+
# The exploit settings were incorrect
766+
#
767+
BadConfig = 'bad-config'
768+
769+
#
770+
# The network service disconnected us mid-attempt
771+
#
772+
Disconnected = 'disconnected'
773+
774+
#
775+
# The application endpoint or specific service was not found
776+
#
777+
NotFound = 'not-found'
778+
779+
#
780+
# The application replied in an unexpected fashion
781+
#
782+
UnexpectedReply = 'unexpected-reply'
783+
784+
#
785+
# The exploit triggered some form of timeout
786+
#
787+
TimeoutExpired = 'timeout-expired'
788+
789+
#
790+
# The exploit was interrupted by the user
791+
#
792+
UserInterrupt = 'user-interrupt'
793+
794+
#
795+
# The application replied indication we do not have access
796+
#
797+
NoAccess = 'no-access'
798+
799+
#
800+
# The target is not compatible with this exploit or settings
801+
#
802+
NoTarget = 'no-target'
803+
804+
#
805+
# The application response indicated it was not vulnerable
806+
#
807+
NotVulnerable = 'not-vulnerable'
808+
809+
#
810+
# The payload was delivered but no session was opened (AV, network, etc)
811+
#
812+
PayloadFailed = 'payload-failed'
813+
end
814+
815+
737816
##
738817
#
739818
# Just some handy quick checks

0 commit comments

Comments
 (0)