close the open ports in python [closed]“Guess the Number” game in PythonOpen a text file and remove any...

Hiring someone is unethical to Kantians because you're treating them as a means?

Fully-Firstable Anagram Sets

How does one intimidate enemies without having the capacity for violence?

How does strength of boric acid solution increase in presence of salicylic acid?

A newer friend of my brother's gave him a load of baseball cards that are supposedly extremely valuable. Is this a scam?

What typically incentivizes a professor to change jobs to a lower ranking university?

Today is the Center

Why does Kotter return in Welcome Back Kotter?

Is it tax fraud for an individual to declare non-taxable revenue as taxable income? (US tax laws)

Can an x86 CPU running in real mode be considered to be basically an 8086 CPU?

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

Is it unprofessional to ask if a job posting on GlassDoor is real?

Why Is Death Allowed In the Matrix?

The Clique vs. Independent Set Problem

Unknown notation: What do three bars mean?

Watching something be written to a file live with tail

Fencing style for blades that can attack from a distance

US citizen flying to France today and my passport expires in less than 2 months

What are these boxed doors outside store fronts in New York?

Why is consensus so controversial in Britain?

a relationship between local compactness and closure

What's the point of deactivating Num Lock on login screens?

How old can references or sources in a thesis be?

Approximately how much travel time was saved by the opening of the Suez Canal in 1869?



close the open ports in python [closed]


“Guess the Number” game in PythonOpen a text file and remove any blank linesPython rewrite the code to become more elegantlyCatch the turtle - PythonAutomating renaming .pdfs and assisting with uploading filesPython Guess the Word GamePython method to round up to the nearest 10Flagging employees whose spending is close to the budgeted amountPython Automate the Boring Stuff Collatz exerciseLowest open space in memory






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







-3












$begingroup$


I need to generate a program to close the open ports of a computer, I have done the part of the code where I scan the open ports but I did not find anything to tell me how to close them, here the code if necessary:



def scan(self):
port = []
print("Starting scan on host: {} ".format(self.ip))
for i in range(20, 100000):
s = socket(AF_INET, SOCK_STREAM)
try:
s.connect((self.ip, i))
port.append(i)
print('Port {}: OPEN'.format(i))
s.close()
except:
s.close()
return port









share|improve this question









$endgroup$



closed as off-topic by Toby Speight, Reinderien, Sᴀᴍ Onᴇᴌᴀ, 200_success, indi Mar 29 at 23:08


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Toby Speight, Reinderien, Sᴀᴍ Onᴇᴌᴀ, 200_success, indi

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 2




    $begingroup$
    Welcome to Code Review! Your code is only eligible for review, if it is working and complete. Questions on how to add certain functionality or to fix errors are off -topic for Code Review. Your question would fit better on Stack Overflow.
    $endgroup$
    – Alex
    Mar 29 at 12:52


















-3












$begingroup$


I need to generate a program to close the open ports of a computer, I have done the part of the code where I scan the open ports but I did not find anything to tell me how to close them, here the code if necessary:



def scan(self):
port = []
print("Starting scan on host: {} ".format(self.ip))
for i in range(20, 100000):
s = socket(AF_INET, SOCK_STREAM)
try:
s.connect((self.ip, i))
port.append(i)
print('Port {}: OPEN'.format(i))
s.close()
except:
s.close()
return port









share|improve this question









$endgroup$



closed as off-topic by Toby Speight, Reinderien, Sᴀᴍ Onᴇᴌᴀ, 200_success, indi Mar 29 at 23:08


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Toby Speight, Reinderien, Sᴀᴍ Onᴇᴌᴀ, 200_success, indi

If this question can be reworded to fit the rules in the help center, please edit the question.












  • 2




    $begingroup$
    Welcome to Code Review! Your code is only eligible for review, if it is working and complete. Questions on how to add certain functionality or to fix errors are off -topic for Code Review. Your question would fit better on Stack Overflow.
    $endgroup$
    – Alex
    Mar 29 at 12:52














-3












-3








-3





$begingroup$


I need to generate a program to close the open ports of a computer, I have done the part of the code where I scan the open ports but I did not find anything to tell me how to close them, here the code if necessary:



def scan(self):
port = []
print("Starting scan on host: {} ".format(self.ip))
for i in range(20, 100000):
s = socket(AF_INET, SOCK_STREAM)
try:
s.connect((self.ip, i))
port.append(i)
print('Port {}: OPEN'.format(i))
s.close()
except:
s.close()
return port









share|improve this question









$endgroup$




I need to generate a program to close the open ports of a computer, I have done the part of the code where I scan the open ports but I did not find anything to tell me how to close them, here the code if necessary:



def scan(self):
port = []
print("Starting scan on host: {} ".format(self.ip))
for i in range(20, 100000):
s = socket(AF_INET, SOCK_STREAM)
try:
s.connect((self.ip, i))
port.append(i)
print('Port {}: OPEN'.format(i))
s.close()
except:
s.close()
return port






python-3.x






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 29 at 12:03









jemfjemf

1




1




closed as off-topic by Toby Speight, Reinderien, Sᴀᴍ Onᴇᴌᴀ, 200_success, indi Mar 29 at 23:08


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Toby Speight, Reinderien, Sᴀᴍ Onᴇᴌᴀ, 200_success, indi

If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by Toby Speight, Reinderien, Sᴀᴍ Onᴇᴌᴀ, 200_success, indi Mar 29 at 23:08


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – Toby Speight, Reinderien, Sᴀᴍ Onᴇᴌᴀ, 200_success, indi

If this question can be reworded to fit the rules in the help center, please edit the question.








  • 2




    $begingroup$
    Welcome to Code Review! Your code is only eligible for review, if it is working and complete. Questions on how to add certain functionality or to fix errors are off -topic for Code Review. Your question would fit better on Stack Overflow.
    $endgroup$
    – Alex
    Mar 29 at 12:52














  • 2




    $begingroup$
    Welcome to Code Review! Your code is only eligible for review, if it is working and complete. Questions on how to add certain functionality or to fix errors are off -topic for Code Review. Your question would fit better on Stack Overflow.
    $endgroup$
    – Alex
    Mar 29 at 12:52








2




2




$begingroup$
Welcome to Code Review! Your code is only eligible for review, if it is working and complete. Questions on how to add certain functionality or to fix errors are off -topic for Code Review. Your question would fit better on Stack Overflow.
$endgroup$
– Alex
Mar 29 at 12:52




$begingroup$
Welcome to Code Review! Your code is only eligible for review, if it is working and complete. Questions on how to add certain functionality or to fix errors are off -topic for Code Review. Your question would fit better on Stack Overflow.
$endgroup$
– Alex
Mar 29 at 12:52










0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

is 'sed' thread safeWhat should someone know about using Python scripts in the shell?Nexenta bash script uses...

How do i solve the “ No module named 'mlxtend' ” issue on Jupyter?

Pilgersdorf Inhaltsverzeichnis Geografie | Geschichte | Bevölkerungsentwicklung | Politik | Kultur...