Converting a str to an int
<p>My Problem is that the type <code>'ip'</code> is str, but i need integer.</p>

<p>So i did the convert <code>int(ip)</code>. Then i got error </p>

<blockquote>
  <p>invalid literal for int() with base 10:</p>
</blockquote>

<p>So i did a little bit of research and found that i had to put int <code>int(float(ip))</code>. </p>

<p>Now i get "could not convert string to float".    </p>

<pre><code>import socket
def retrieveBanner(ip, port):
    s = socket.socket()
    s.connect((int(float(ip)),port))
    banner = s.recv(1024).decode()
    print("Bitte geben Sie eine IP und ein Port ein")

ip = input("IP? ")
port = input("Port? ")
retrieveBanner(ip, port)
if ("NASFTPD" in banner):
    print("Vulnerable")
</code></pre>

<p>According to the <a href="https://docs.python.org/3/library/socket.html#socket.socket.connect" rel="nofollow">documentation</a>, <code>connect</code> expects a tuple <code>(string, int)</code>, with the string being the ip address and the int being the port. You can modify your code this way to fix it :</p>

<pre><code>s.connect((ip, int(port)))
</code></pre>

<p>Hope it'll be helpful.</p>

python