-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathexploit_incompat.diff
More file actions
53 lines (51 loc) · 1.47 KB
/
exploit_incompat.diff
File metadata and controls
53 lines (51 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
Index: lib/msf/core/exploit.rb
===================================================================
--- lib/msf/core/exploit.rb (revision 7526)
+++ lib/msf/core/exploit.rb (working copy)
@@ -712,7 +713,48 @@
return payloads;
end
+ #
+ # Returns a list of incompatible payloads based on platform, architecture,
+ # and size requirements.
+ #
+ def incompatible_payloads
+ payloads = []
+
+ c_platform = (target and target.platform) ? target.platform : platform
+ c_arch = (target and target.arch) ? target.arch : (arch == []) ? nil : arch
+ c_arch ||= [ ARCH_X86 ]
+ framework.payloads.each_module(
+ 'Platform' => c_platform,
+ 'Arch' => c_arch ) { |name, mod|
+
+ incompat = false
+
+ # Are we compatible in terms of conventions and connections and
+ # what not?
+ next if (compatible?(framework.payloads.instance(name)) == false)
+
+ # Skip over payloads that are too big
+ if ((payload_space) and
+ (framework.payloads.sizes[name]) and
+ (framework.payloads.sizes[name] > payload_space))
+ incompat = true
+ end
+
+ # If the payload is privileged but the exploit does not give
+ # privileged access, then it would fail
+ incompat = true if (self.privileged == false and
+ framework.payloads.instance(name).privileged == true)
+
+ next if(not incompat)
+
+ # This one be compatible!
+ payloads << [ name, mod ]
+
+ }
+ return payloads;
+ end
+
#
# Returns a list of compatible encoders based on architecture
#