Question

Create a script that prompts the user for which computer they want to ping. The user...

Create a script that prompts the user for which computer they want to ping. The user can input SWS, DC, or DM –if they input anything else make them reenter their input. Depending upon the valid user input, print out a message which option was selected then ping the correct IP-Address. Paste code here:
0 0
Add a comment Improve this question Transcribed image text
Answer #1
#!/usr/bin/python3
#pingscanner.py
import sys
from scapy.all import *
inp=""
while not(inp == "SWS" or inp=="DC" or inp== "DM"):
    inp=input("input sws/dc/dm : ")
    inp=inp.upper()

ip=input("Input ip(a.b.c.d) :")

print("pinging the target....")

icmp = IP(dst=ip)/ICMP()
#IP defines the protocol for IP addresses
#dst is the destination IP address
#TCP defines the protocol for the ports
resp = sr1(icmp,timeout=10)
if resp == None:
    print("This host is down")
else:
    print("This host is up")

Add a comment
Know the answer?
Add Answer to:
Create a script that prompts the user for which computer they want to ping. The user...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • You are writing a Python script that prompts a user to guess the current contents of...

    You are writing a Python script that prompts a user to guess the current contents of a variable called temperature (assume previously set, and not shown). What is the missing statement? guess = float(input("Please enter your guess ")) ____________________________    # Fill in the missing line of code      print ("You're right!") else:      print ("Please try again") You are writing a Python script that prompts a user to guess the current contents of a variable called temperature (assume previously set,...

  • BCS 215 (Unix Operating Systems) Create a bash shell script that displays a coffee vending machine...

    BCS 215 (Unix Operating Systems) Create a bash shell script that displays a coffee vending machine menu and asks the user to make a choice - 1. Print "Please enter your choice: decaf|regular|latte|cappuccino" 2. Depending on the user input, print out the related price - decaf: 2 dollars regular: 2 dollars latte: 3 dollars cappuccino: 3 dollars For anything else, please display "Please make a valid choice." 3. Upon a successful execution of the script, display "Thank you for using...

  • Write a program which: - prompts the user for 2 numerical inputs - stores their two...

    Write a program which: - prompts the user for 2 numerical inputs - stores their two inputs in variables as floats - Use a while in loop to ask a user for a valid operation: (if the user's input operation isn't one of those listed above, instead print a message telling them so, and continue asking for the valid operation) - prompts the user for an arithmetic operation ( + - * / %) - stores the user's input as...

  • Write a code segment that prompts the user to enter a double number between (5.55 and...

    Write a code segment that prompts the user to enter a double number between (5.55 and 123.3) inclusive. If the input is invalid, print an error message and loop until the input is valid. Code in c++

  • The first script is validate.sh. This is a simple form validation script that will be used...

    The first script is validate.sh. This is a simple form validation script that will be used to verify the inputs given. Normally, this would be done to validate input from a website or another program before entry into a database or other record storage. In this case, we will keep it simple and only focus on the input validation step. In particular, the script should prompt the user for four values: first name, last name, zip code, and email address....

  • Create a script file which prompts the user for the water level of the tank pictured below. The t...

    Needs to be solved by a script in MATLAB. Use of if, else, and ifelse statements are encouraged. My main issue is figuring out what order to place if statements in. Please comment if any more info is needed Create a script file which prompts the user for the water level of the tank pictured below. The tank has a cylindrical base with a height of 25 ft and a diameter of 40 ft. The top of the tank is...

  • Problem 1 Write a BASH script to create a user account from the Linux system on...

    Problem 1 Write a BASH script to create a user account from the Linux system on which your script is run. The script should process two positional parameters. First positional parameter is supposed to be a string with a user name (e.g., user_name) Second positional parameter is supposed to be a string with a user password (e.g., user_password) In your script: Check if two positional parameters were passed to your script when it was invoked If NOT, print an appropriate...

  • Write a script in matlab that prompts the user to input the day, month, and year;...

    Write a script in matlab that prompts the user to input the day, month, and year; determine the day of the year (the number of days including the current day). Be sure to take leap year into account. Use a for loop Test your code on the following dates: February 28, 2015 April 9, 1976 October 12, 1887 Create a script that performs the same function as repmat. The only built-in commands you may use are input, size, and disp.

  • 1) First, the script prompts user to input the volume of the rigid container in cubic meters 2) S...

    1) First, the script prompts user to input the volume of the rigid container in cubic meters 2) Second, the script prompts user to input the total mass of the water (in any phase) in the tank 3) Third, the script prompts user to input the initial temperature 4) Fourth, the script prompts user to input the initial mixture quality Thereafter, the script computes the state at which all of the water is transformed to saturated vapor, and the energy...

  • 5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters...

    5.2 Write a program that repeatedly prompts a user for integer numbers until the user enters 'done'. Once 'done' is entered, print out the largest and smallest of the numbers. If the user enters anything other than a valid number catch it with a try/except and put out an appropriate message and ignore the number. Enter 7, 2, bob, 10, and 4 and match the output below. ​ 1 largest = None 2 smallest = None 3 while True: 4...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT