# Python3: Python Networking and Ethical Hacking # Summary: Type what each script does # Name: Type Name(s) # Date: Type Date # step 1: In this lab you are going to try some scripts to scan, sniff, or...

1 answer below »

Cyber Python - Reconnaissance


# Python3: Python Networking and Ethical Hacking # Summary: Type what each script does # Name: Type Name(s) # Date: Type Date # step 1: In this lab you are going to try some scripts to scan, sniff, or poison packets # 1) use either kali Linux or ITP 270 VM to test the scripts # 2) for some of the scripts, you need to run two side-by-side Terminal's windows to run/test them # 2) for each script record the run by taking a snip or screenshot of the results # 3) copy and paste the script under the snip or screenshot in the file to submit individually or as a group # Step 2: Sniffing/Scanning Packets Script # 1) go to Unit 11 > Assignments and Resources > Part1: Unit 10 Review # 2) download the provided code skeleton labeled sniffer Code Skeleton # 3) complete the skeleton and run the script using two side-by-side Terminal's windows (this is the Unit 10 review python problem) # Step 3: Sniffing/Scanning with Scapy # 1) go to https://thepacketgeek.com/scapy-p-04-looking-at-packets/. You will be using this simple tutorial to become familiar with using Scapy # 2) you may use the python interactive shell or create .py files to type and run the scapy code # 3) if done with the first tutorial, go to https://thepacketgeek.com/scapy-p-05-sending-our-first-packet-arp-response/ # 4) Repeat step 2 to document the results # Step 4: Sniffing/Scanning with Nmap # 1) Change the IP address to a valid one (it depends on your VM NW configurations) # 2) '''#!/usr/bin/python import nmap nm = nmap.PortScanner() print (nm.nmap_version()) nm.scan('192.168.146.1', '22-1024', '-v --version-all') print (nm.scanstats()) print (nm['192.168.146.1'].state()) print (nm['192.168.146.1'].all_protocols()) print (nm['192.168.146.1']['tcp'].keys())''' # Sniffer Program import ______________ # import missing packet import os # host to listen on host = _____ # the host can be a general interface or localhost port = _____ # assign the port to 0 # create a raw socket and bind it to the public interface if os.name == "nt": socket_protocol = socket.___________ # protocol should be IP else: socket_protocol = socket.___________ # protocol should be ICMP # create a socket that is used to sniff packets sniffer = socket.socket(socket.AF_INET, ___________, socket_protocol) # socket type should be a raw socket sniffer.bind((host, port)) print('[*] Listening on %s:%d' _________ )# display the host and port the socket is listening on # included the IP header in the capture sniffer.setsockopt(____________, socket.IP_HDRINCL, 1) # protocol should be an IP # if Windows platform is used, you need to send an IOCTL to set up promiscuous mode if os.name == "nt": sniffer.ioctl(socket.SIO_RCVALL, socket.RCVALL_ON) # read in a single packet print(sniffer.__________) # should read a number of bytes of buffer size equal to 65565 sent from the socket # if Windows platform is used, turn off promiscuous mode if(os.name == "nt"): sniffer.ioctl(socket.SIO_RCVALL, socket.RCVALL_OFF) Nmap Script #!/usr/bin/python import nmap nm = nmap.PortScanner() print (nm.nmap_version()) nm.scan('192.168.146.1', '22-1024', '-v --version-all') print (nm.scanstats()) print (nm['192.168.146.1'].state()) print (nm['192.168.146.1'].all_protocols()) print (nm['192.168.146.1']['tcp'].keys())
Answered Same DayApr 05, 2021

Answer To: # Python3: Python Networking and Ethical Hacking # Summary: Type what each script does # Name: Type...

Kshitij answered on Apr 09 2021
149 Votes
looking-at-pkt-1.PNG
looking-at-pkt-2.PNG
namp_script_result.PNG
nmapscript.py
import nmap
nm =
nmap.PortScanner()
print (nm.nmap_version())
nm.scan('192.168.56.1', '22-1024', '-v --version-all')
print (nm.scanstats())
print (nm['192.168.56.1'].state())
print (nm['192.168.56.1'].all_protocols())
print (nm['192.168.56.1']['tcp'].keys())
Send-arp-message-1.PNG
Send-arp-message-2.PNG
Send-arp-message-import.PNG
sniffing_program.PNG
sniffing_program.py
import socket
import os
import struct
from ctypes import *
# host to listen on
host = "192.168.56.1"
class IP(Structure):
_fields_ = [
("ihl", c_ubyte, 4),
("version", c_ubyte, 4),
("tos", c_ubyte),
("len", c_ushort),
("id", c_ushort),
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here