Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Background Reading Before starting, you are encouraged to review the following paper to understand the RBS method, which is effective in detecting network worms and

Background Reading
Before starting, you are encouraged to review the following paper to understand the RBS method, which is effective in detecting network worms and port scanners by measuring the rate of connections to new destinations:
Jung, Jaeyeon, Rodolfo A. Milito, and Vern Paxson. "On the adaptive real-time detection of fast-propagating network worms." International Conference on Detection of Intrusions and Malware, and Vulnerability Assessment. Springer, Berlin, Heidelberg, 2007. Read the paper hereLinks to an external site.. Part 1: PortScanner Detector
Task: Create a tool that records and analyzes first-contact connection requests ( to ) within a LAN, including self-initiated scans.
Data Management: Use a Python dictionary to log these first-contact requests with their timestamps. Entries older than 10 minutes should be continuously cleared.
Analysis: Calculate the "fan-out rate" for each source IP, which is defined as the rate of establishing first-contact connections. Calculate this rate over three intervals: per second, per minute, and per 5 minutes.
Detection Criteria: A source IP is flagged as a port scanner if its fan-out rate exceeds any of the following thresholds: 5 per second, 100 per minute, or 300 per 5 minutes.
Output: For each detected port scanner, display the source IP, average fan-out rates, and the specific reason for detection.
Example Output:
A scanner detected on source IP x
avg. fan-out per sec: y, avg fan-out per min: z, fan-out per 5min: d
reason for detection: fan-out rate per sec =6(must be less than 5).
Part 2: PortScanner Update
Task: Modify the port scanner developed in Lab 2 to accept a waiting time (in milliseconds) between each scan to different destinations. Also, enhance it to scan a range of network addresses (CIDR notation).
Functionality: The updated scanner should adhere to the specified waiting time between consecutive scans. Below is my lab 2 code : import socket
def tcp_scanner(target, port):
try:
tcp_sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
tcp_sock.connect((target, port))
tcp_sock.close()
return True
except:
return False
def udp_scanner(target, port):
try:
udp_sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
udp_sock.settimeout(2.0)
# udp_sock.sendto(bytes("", "utf-8"),(target, port)) # Send a UDP packet to the IP and port of the target
data = b'\x00\x00\x01\x00\x00\x01\x00\x00\x00\x00\x00\x00\x07example\x03com\x00\x00\x01\x00\x01'
udp_sock.sendto(data,(target, port))
response, addr = udp_sock.recvfrom(1024)
if response:
return True
except socket.timeout as e:
return False
def main():
target = input("[+] Enter Target IP: ")
for portNumber in range(1,1024):
if udp_scanner(target, portNumber):
print('Port', portNumber, '/udp','is DEFINITELY open')
for portNumber in range(1,1024):
if tcp_scanner(target, portNumber):
print('[*] Port', portNumber, '/tcp','is open')
if __name__=="__main__":
main()**lab 2 code ends **
Part 3: Testing Environment Setup
Configuration: Utilize two Kali VMs (one original, one copy) in the same LAN (192.168.10.0/24). Designate one VM for defense and the other for attacks.
Execution: Run the PortScanner Detector on the defense VM and execute the updated port scanner on the attack VM under five different waiting times (1 ms,0.5s,1s,5s,10s). Collect your results under each of these five scenarios.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Structured Search For Big Data From Keywords To Key-objects

Authors: Mikhail Gilula

1st Edition

012804652X, 9780128046524

More Books

Students also viewed these Databases questions

Question

1.who the father of Ayurveda? 2. Who the father of taxonomy?

Answered: 1 week ago

Question

Commen Name with scientific name Tiger - Wolf- Lion- Cat- Dog-

Answered: 1 week ago

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago