Skip to content

Instantly share code, notes, and snippets.

@danshearmur
Created April 19, 2013 15:09
Show Gist options
  • Save danshearmur/5420977 to your computer and use it in GitHub Desktop.
Save danshearmur/5420977 to your computer and use it in GitHub Desktop.
<!doctype html>
<script>
(function () {
var id = 'sendhack';
function sendPost(url, data) {
var iframe = document.createElement('iframe');
iframe.id = iframe.name = id;
iframe.style.display = 'none';
iframe.src = 'javascript:';
var fields = '';
for (var key in data) {
fields += '<textarea name="' + key + '">' + data[key].replace(/</g,"&lt;") + '</textarea>';
}
var html =
'<form method="post" action="' + url + '">' +
fields +
'</form>' +
'<script>onload=function(){setTimeout(function(){document.forms[0].submit()},10);}\x3c/script>';
document.body.appendChild(iframe);
var iDoc = iframe.contentWindow || iframe.contentDocument;
iDoc = iDoc.document || iDoc;
iDoc = iDoc || document.frames['sendhack'].document;
iDoc.open();
iDoc.write(html);
iDoc.close()
setTimeout(function () {
iframe.parent.removeChild(iframe);
}, 10000);
}
window.sendPost = sendPost;
})();
window.onload = function () {
sendPost("http://192.168.4.129:3000", {
thing1: "things",
thing2: "stuff"
});
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment