In Line 12 is wrong but u dont know how i make it right can some one help me pls | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

In Line 12 is wrong but u dont know how i make it right can some one help me pls

import socket import sys from datetime import datetime target = "scanme.nmap.org" targetIP = socket.gethostbyname(target) tstart = datetime.now() try: for p in range(1, 45000): sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) res = sock.connect_ex((targetIP, p)) if res == 0: print("Offene Verbindung in Port " + str(p)) sock.close() except Exeption: print("There was an error.") sys.exit()

13th Mar 2023, 9:10 PM
Sakatora
Sakatora - avatar
5 Answers
+ 9
Sakatora , sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # this line needs additional indentation >>> except Exeption: # this line has a typo in Exeption: should be Exception. should also have the same indentation level as *try*. ^
13th Mar 2023, 9:39 PM
Lothar
Lothar - avatar
+ 6
Sakatora > it is recommended to learn from a tutorial, in this case you should start with *introduction to python*. > this course will cover basic knowledge like indentation and much more.
14th Mar 2023, 7:41 AM
Lothar
Lothar - avatar
+ 2
Sry but i dont understand it i dont how i additional it
13th Mar 2023, 9:42 PM
Sakatora
Sakatora - avatar
+ 1
But thx for help
13th Mar 2023, 9:46 PM
Sakatora
Sakatora - avatar
+ 1
Нету отступа у цикла for
15th Mar 2023, 12:05 PM
Савелий Лодкин
Савелий Лодкин - avatar