python - socket connect_ex error with .get()var -


what problem? .get()?

functions.py

import socket import pages.settings settings   def portscan():     try:         print(settings.ip.get())         print(settings.port.get())          p in range(1, 100):             print("after for")             s = socket.socket(socket.af_inet, socket.sock_stream)             res = s.connect_ex(str(settings.ip.get()), 80)             if res == 0:                 print("open port in:" + str(p))             s.close()      except exception:         print("check settings function portscan() = error") 

settings.py

    global ip     global port     global limit      ip = tk.stringvar()     port = tk.stringvar()     limit = tk.stringvar()      label_ip = tk.label(self, text="ip:")     label_ip.grid(row=0, column=0,  sticky=tk.e) 

error

1

192.168.100.101

80

after for

check settings function portscan() = error

i fixed it.

error: res = s.connect_ex(str(settings.ip.get()), 80) typeerror: connect_ex() takes 1 argument (2 given)  fix: res = s.connect_ex((str(settings.ip.get()), 80)) 

Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -