小编Son*_*rma的帖子

使用javascript发送HTTP请求并接收HTTP响应

我想发送HTTP请求,例如" http://google.com/ " 的简单请求,然后在屏幕上打印HTTP响应标头.怎么做到呢?我想要基本代码,以便我可以使用它来发送更复杂的GET和POST请求.

<html>
<body>

<script type="text/javascript">
function sendgetreq()
{
    var req = new XMLHttpRequest();
    req.open('GET', "https://www.google.com/search?q=asd", true);
    req.send(null);
    var headers = req.getAllResponseHeaders().toLowerCase();
    //document.write("Headers are:"+headers);
    alert(headers);
}
</script>
<INPUT TYPE=BUTTON OnClick="sendgetreq();" VALUE="Send Request">

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这显示了一个空的弹出框.

javascript http response request

5
推荐指数
1
解决办法
2万
查看次数

Python Ctype分段错误

这是使用ctype运行shellcode的代码.shellcode在64位linux上运行"whoami".但是这个程序给了我一个"分段错误".但是我无法弄清楚它中的错误.代码的结构来自: ctypes:将字符串转换为函数?

#!/usr/bin/python

from ctypes import *

# /usr/bin/whoami
shellcode_data = ("\x6a\x3b\x58\x99\x48\xbb\x2f\x62\x69\x6e\x2f\x73\x68\x00\x53"
"\x48\x89\xe7\x68\x2d\x63\x00\x00\x48\x89\xe6\x52\xe8\x10\x00"
"\x00\x00\x2f\x75\x73\x72\x2f\x62\x69\x6e\x2f\x77\x68\x6f\x61"
"\x6d\x69\x00\x56\x57\x48\x89\xe6\x0f\x05");

shellcode = c_char_p(shellcode_data)
function = cast(shellcode, CFUNCTYPE(None))
function()
Run Code Online (Sandbox Code Playgroud)

对于32位架构,这将是shell代码:

shellcode_data = ("\x6a\x0b\x58\x99\x52\x66\x68\x2d\x63\x89\xe7\x68\x2f\x73\x68"
"\x00\x68\x2f\x62\x69\x6e\x89\xe3\x52\xe8\x10\x00\x00\x00\x2f"
"\x75\x73\x72\x2f\x62\x69\x6e\x2f\x77\x68\x6f\x61\x6d\x69\x00"
"\x57\x53\x89\xe1\xcd\x80");
Run Code Online (Sandbox Code Playgroud)

python ctype shellcode

3
推荐指数
1
解决办法
1587
查看次数

标签 统计

ctype ×1

http ×1

javascript ×1

python ×1

request ×1

response ×1

shellcode ×1