Python TCP Port Scanner

Job ID: 40505012

Budget: $30 – $250 USD

Part 1: Socket Connection Implementation (30 points)
Create a Python script that establishes a socket connection. Your implementation should:

Create a basic client-server communication system using two Python scripts:
1. Server script that listens for connections
2. Client script that connects to the server
Demonstrate proper socket initialization and connection handling
Include appropriate error handling
Include comments explaining your code
Follow Python best practices
Demonstration Requirements for Socket Connection:
1. Terminal/Command Prompt Screenshots showing:

Server script running and listening for connections
Client script successfully connecting to the server
Message exchange between client and server
Proper shutdown/disconnection handling
2. Required Test Cases (document with screenshots):

Successful connection and message exchange
Server receiving messages from client
Client receiving responses from server
Error handling when server is not running
Clean disconnection process
Example Test Sequence:
Start server (show terminal with listening message)
Start client (show successful connection)
Send test message from client to server
Show server receiving and processing message
Show server response reaching client
Demonstrate graceful disconnection
Show error handling when attempting connection to inactive server
Part 2: Port Scanner Implementation (30 points)
Develop a Python-based port scanner that can:

Scan a specified range of ports on a target host
Identify open ports
Handle connections appropriately
Include proper error handling
Include comments explaining your code
Follow Python best practices

Your local system (localhost/127.0.0.1)
scanme.nmap.org - a website specifically designed for testing port scanners
Scanning any other systems without explicit permission is strictly prohibited and may result in legal consequences.

Demonstration Requirements for Port Scanner:

1. Terminal/Command Prompt Screenshots showing:

Scanner execution against localhost (127.0.0.1 and/or scanme.nmap.org)
Results showing both open and closed ports
Proper error handling for invalid inputs
2. Required Test Cases (document with screenshots):
- Scanning common ports (e.g., 80, 443, 22, 21) on localhost
- Scanning a custom port range on localhost
- Scanning selected ports on scanme.nmap.org
- Error handling for invalid port numbers
- Error handling for unreachable hosts
- Performance with different port ranges

Example Test Sequence:
Run scanner against localhost with common ports
Show detailed output identifying open/closed ports
Demonstrate scanning a specific port range
Run scanner against scanme.nmap.org (limited port range)
Show error handling for invalid inputs
Include timestamp in screenshots for verification

Part 3: Documentation and Reflection
Upload all Python scripts to your GitHub repository

Submit either:
A link to your GitHub repository, OR
Screenshots showing successful upload to your repository
Provide screenshots demonstrating successful execution of both programs
Include timestamps in your screenshots
Show both successful and unsuccessful connection attempts
Demonstrate proper error handling


Hide Assignment Information
Turnitin™
Turnitin™ enabledThis assignment will be submitted to Turnitin™.
Instructions
Midterm Exam Information
Overview

This midterm examination consists of two programming assignments and a reflection component. You will demonstrate your understanding of network programming concepts by implementing socket connections and a port scanner in Python, similar to those demonstrated in the ITProTV instructional videos.

Part 1: Socket Connection Implementation (30 points)
Create a Python script that establishes a socket connection. Your implementation should:

Create a basic client-server communication system using two Python scripts:
1. Server script that listens for connections
2. Client script that connects to the server
Demonstrate proper socket initialization and connection handling
Include appropriate error handling
Include comments explaining your code
Follow Python best practices
Demonstration Requirements for Socket Connection:
1. Terminal/Command Prompt Screenshots showing:

Server script running and listening for connections
Client script successfully connecting to the server
Message exchange between client and server
Proper shutdown/disconnection handling
2. Required Test Cases (document with screenshots):

Successful connection and message exchange
Server receiving messages from client
Client receiving responses from server
Error handling when server is not running
Clean disconnection process
Example Test Sequence:
Start server (show terminal with listening message)
Start client (show successful connection)
Send test message from client to server
Show server receiving and processing message
Show server response reaching client
Demonstrate graceful disconnection
Show error handling when attempting connection to inactive server
Part 2: Port Scanner Implementation (30 points)
Develop a Python-based port scanner that can:

Scan a specified range of ports on a target host
Identify open ports
Handle connections appropriately
Include proper error handling
Include comments explaining your code
Follow Python best practices
Important Security and Legal Notice

For this assignment, you are ONLY authorized to scan:

Your local system (localhost/127.0.0.1)
scanme.nmap.org - a website specifically designed for testing port scanners
Scanning any other systems without explicit permission is strictly prohibited and may result in legal consequences.

Demonstration Requirements for Port Scanner:

1. Terminal/Command Prompt Screenshots showing:

Scanner execution against localhost (127.0.0.1 and/or scanme.nmap.org)
Results showing both open and closed ports
Proper error handling for invalid inputs
2. Required Test Cases (document with screenshots):
- Scanning common ports (e.g., 80, 443, 22, 21) on localhost
- Scanning a custom port range on localhost
- Scanning selected ports on scanme.nmap.org
- Error handling for invalid port numbers
- Error handling for unreachable hosts
- Performance with different port ranges

Example Test Sequence:
Run scanner against localhost with common ports
Show detailed output identifying open/closed ports
Demonstrate scanning a specific port range
Run scanner against scanme.nmap.org (limited port range)
Show error handling for invalid inputs
Include timestamp in screenshots for verification
Ethical Scanning Guidelines:
DO scan: localhost (127.0.0.1) and scanme.nmap.org
DON'T scan: Any other websites, servers, or systems
DON'T perform aggressive scanning or DOS attacks
DO include appropriate delays between scan attempts
DO respect rate limiting and scanning guidelines
DO document all testing activities in your submission
Part 3: Documentation and Reflection
Upload all Python scripts to your GitHub repository

Submit either:
A link to your GitHub repository, OR
Screenshots showing successful upload to your repository
Provide screenshots demonstrating successful execution of both programs
Include timestamps in your screenshots
Show both successful and unsuccessful connection attempts
Demonstrate proper error handling
Written Reflection

Write a 1-2 page reflection (in your own words) addressing the following:
Your approach to developing the socket connection and port scanner
Challenges encountered and how you overcame them
If/how you utilized AI tools (such as GitHub Copilot) in your development process
Include specific prompts you used with AI tools
Explain how you modified and improved upon AI-generated code
Security considerations and best practices you implemented
Legal and ethical considerations of creating and using a port scanner. This should include one reference cited in APA format
What you learned from this assignment and how it relates to security automation