Let us worry about your assignment instead!

We Helped With This Python Programming Assignment: Have A Similar One?

SOLVED
CategoryProgramming
SubjectPython
DifficultyUndergraduate
StatusSolved
More InfoPython Assignment
10191

Short Assignment Requirements

I have a programming assignment and I know it is last minute, but i believe experts will have no problem completing this within the time range, please take a look. I am willing to pay more for expediting it.

Assignment Description

Use MUST use Python 3

 

You are required to submit 2 zip files with instructions given in Submission Guidelines

 

 

Part 1: Network Port Scanner                             [10 Points]

Network ports are entry points to any host on the Internet. If a socket is listening on a port, it will accept incoming traffic, process it, and possibly respond to the client. An attacker can “scan” for open ports on a host and subsequently send malicious payload to hack the host. Port scanners are used by attackers to identify possible entry points to a target host.

 

In this programming task, you are asked to implement a TCP port scanner to identify ports running TCP applications. Recall that TCP based applications are listening for new connections at open ports. If you send a connection request to these open ports, they will respond to the connection requests. The workflow of a typical TCP port scanner is as follows.

 

·        Sweep through the ports you are interested in scanning for an IP address

·        Establish a TCP connection to the IP address and port number using the socket API

o   If a connection is successfully established, mark the port as open and close the connection

o   Otherwise, mark the port as closed

 

Note: You MUST close all TCP connections you open to avoid overloading the server.

                            

 

 

 

Use your port scanner to answer the following questions.

 

Question 1. Identify the ports running TCP applications for each of the following IP addresses:

Your answer should look something like this:

IP addresses

Open ports

31.13.74.36

53.163.225.50

40.97.142.194

132.163.4.107

 

Question 2. Briefly describe the nature of the applications that are running on the identified ports. Consult your textbook and online resources (e.g., Google or Wikipedia). If you cannot identify the application running over a port, write N/A.

Your answer should look something like this:

Port number

Application description

80

...

...

...

...

...

...

...

 

Submission Guideline:

You are required to submit the following files in a single ZIP file (named port_scan):

  • Source code for TCP port scanner (5 points)
  • PDF document answering the two questions (2.5 points each)

 

 

 

 

 

 

 

Part 2: Tracking IPv4 Usage               [5 Extra Credit Points]

For this task, you are required to track the IPv4 address space of a subnet give to you. Recall that you can identify whether a host is connected to the network or not by simply sending an ICMP ping request. So, for this task, you need to do the following:

·         Identify all the IP addresses belonging to the subnet prefix provided to you

·         For each IP address, use the <check_host> function in utils.py to check if the host is connected to the network

·         Maintain an array of active hosts

·         Repeat this process to answer the questions below

 

utils.py:

            We have provided you with utils.py which contains <check_host(host)> function. This function allows you to check if a given IP address <host> is currently active or not by sending ping packets. The output of this function is True/False depending on the status of the <host> IP address.

Like previous assignment, you should put this file in the same folder as your solution file.

Note: You must run this script in administrator mode since python requires elevated privileges to send ICMP ping packets.


Example usage of utils.py:

            You can check if IP address 31.13.74.36 is up or not as follows

           

            from utils import *

           

if check_host(‘31.13.74.36’):

            print(‘There is a host active on the given IP address’)

else:

            print(‘There is no host active on the given IP address’)

 

 

Python’s ‘ipaddress’ library:

In order to identify IP addresses belonging to a particular subnet, you may want to look in the ‘ipaddress’ python library. This library has a function <ip_network(subnet)> which returns all the ip addresses belonging to the subnet <subnet> you provided.

 

Example usage of ip_network:

            You can print all IP addresses belonging to 192.168.1.0/30 as follows

 

            from ipaddress import *

 

            # This code will print out the 4 IP addresses

            # 192.168.1.0, 192.168.1.1, 192.168.1.2, 192.168.1.3

            ips = ip_network(‘192.168.1.0/30’, strict=False)

            for ip in ips:

                        print(str(ip) + ‘ belongs to the 192.168.1.0/30 subnet’)

           

Question 1: Track the IP addresses belonging to the UIowa’s subnet (129.255.0.0/24) at 2 different instances and note the active IP addresses.

 

Your answer should look something like this:

 

129.255.0.0

129.255.0.1

129.255.0.256

Observation 1

Inactive (0)

1

1

Observation 2

Active (1)

1

0

 

 

 

Question 2: Do you observe any difference in the active IP addresses across your 2 observations? If yes, formulate a hypothesis based on this observation.

 

 

 

 

 

 

 

 

 

 

 

Submission Guideline:

You are required to submit the following files in a single ZIP file (named ip_tracker):

  • Source code for IPv4 tracker along with utils.py (2 points)
  • PDF document answering the two questions (1.5 points each)

 

 

 

 

Assignment Code


'''
Got the following code snippet from 
http://stackoverflow.com/questions/2953462/pinging-servers-in-python

This is used to identify whether a host ip address is "up" or not.
You need to run the "check_host" function with administrator privileges since it employs ping function call
'''
from platform import system as system_name # Returns the system/OS name
from os import system as system_call       # Execute a shell command

def check_host(host):
    """
    Returns True if host (str) responds to a ping request.
    Remember that some hosts may not respond to a ping request even if the host name is valid.
    """

    # Ping parameters as function of OS
    parameters = "-n 1 >nul 2>nul" if system_name().lower()=="windows" else "-c 1 >/dev/null 2>&1"

    # Pinging
    return system_call("ping " + parameters + " " + host) == 0

Customer Feedback

"Thanks for explanations after the assignment was already completed... Emily is such a nice tutor! "

Order #13073

Find Us On

soc fb soc insta


Paypal supported