1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
otez555 [7]
3 years ago
13

Write an If/else statement to check whether host is online. If it is online, then print system is online otherwise print system

is unreachable.
Computers and Technology
1 answer:
Reika [66]3 years ago
4 0

Answer:

from socket import *

hostname = input('Enter the host to be scanned: ')

ip_add = gethostbyname(hostname)

connections = [ ]    

for i in range(133, 136):

   s = socket(AF_INET, SOCK_STREAM)

     

   conn = s.connect_ex((ip_add, i))

   print(conn)

   connections.append(conn)

if 0 in connections:

   print ('Host is online')

   s.close()

else:

   print ('system is unreachable')

Explanation:

The python source code above scans for all the available range of ports in the provided hostname, if any port is available, the host is online else the program print the error message "system is unreachable.

You might be interested in
Why is it difficult to detect a Trojan horse?
marishachu [46]

Answer:

Explanation:

Because the virus disguises it self as something you are trying to download, then it attackes your device

8 0
3 years ago
Read 2 more answers
Match the different sources of payments to their descriptions. an electronic device that aids consumers to make online payments
LekaFEV [45]

<u>Automatic Draft-</u> A convenient payment method where funds are automatically debited from your account.

<u>Cash-</u> The physical form of currency.

<u>Credit Card-</u> Allows you to make a purchase and pay for it later.

<u>Digital Wallet-</u> An electronic device that aids consumers to make online payments through various websites.

For anyone still looking, hope this helps.

6 0
3 years ago
What is the database and presentation for files​
Nutka1998 [239]

Answer:

Database Management System ppt DBMS

I don't know if that is right. Sorry if it's not.

6 0
3 years ago
Read 2 more answers
Anyone got E-aqa login?​
pashok25 [27]

Answer:no

Explanation:

3 0
3 years ago
Please help me with these questions please
ki77a [65]

Answer:

The answer is 20, if this helps you please give the brainliest award.

4 0
2 years ago
Other questions:
  • Write any 2 differences between implicit variables and explicit variables.​Plz tell :' (
    10·1 answer
  • Building relationships during your career exploration is called
    6·1 answer
  • Which of the following events would most likely produce an earthquake
    7·1 answer
  • Should the use of hacktivists by a country against enemy organizations be considered an act of war? Why or why not? How about th
    8·1 answer
  • During project management, who executes tasks and produces the deliverables as stated in the project plan and as directed by the
    9·1 answer
  • If you play gta and don't know the song ''Glamorous'' Then what do you even do when you play?
    6·2 answers
  • Hi I need help with an assignment. We're learning about encryption and decryption in code.org. i need help with three of the tex
    14·1 answer
  • Maya is preparing a presentation for her science class on how solar panels produce energy. Why would a
    11·2 answers
  • Design algorithm and the corresponding flow chart for adding the subject score of 5, total value and rank.​
    14·1 answer
  • 9
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!