Ishlab chiqarish amaliyoti
Download 121.1 Kb.
|
@Doston Ishlab chiqarish
- Bu sahifa navigatsiya:
- Skript chiqishi
- Skriptning bajarilishi
Skanerlash turlari: Foydalanuvchilar Nmap skanerlash turlaridan birini tanlashi mumkin, jumladan, xostni aniqlash, portni skanerlash, OTni aniqlash va xizmat versiyasini aniqlash.
Natijalarni vizualizatsiya qilish: Zenmap skanerlash natijalarini grafik formatda ko'rsatadi, ochiq portlar, xizmatlar va skanerlangan maqsadlar haqida qo'shimcha ma'lumotlarni ko'rsatadi. Skript chiqishi: Agar skanerlash paytida Nmap skriptlari ishlatilsa, Zenmap ushbu skriptlarning chiqishini tartibli ravishda ko'rsatadi. Saqlangan natijalar: Skanerlash natijalari saqlanishi va keyinchalik tahlil qilish yoki taqqoslash uchun olinishi mumkin. Skriptning bajarilishi: Zenmap foydalanuvchilarga Nmap skriptlarini bevosita GUI-dan tanlash va bajarish imkonini beradi. Zenmap, ayniqsa, tarmoq ma'murlari, xavfsizlik bo'yicha mutaxassislar va Nmap-ning buyruq qatori interfeysining nozik jihatlari bilan shug'ullanmasdan tarmoqni skanerlashni xohlaydigan foydalanuvchilar uchun foydalidir. Zenmap buyruq satriga nisbatan soddalashtirilgan tajribani taqdim etsa-da, u Nmap-ning buyruq qatori versiyasi taklif qiladigan barcha ilg'or xususiyatlar va variantlarni ochib bermasligi mumkin. Code: #!/usr/bin/env python3 #Use these commands in Kali to install required software: # sudo apt install python3-pip # pip install python-nmap # Import nmap so we can use it for the scan import nmap # We need to create regular expressions to ensure that the input is correctly formatted. import re # Regular Expression Pattern to recognise IPv4 addresses. ip_add_pattern = re.compile("^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$") # Regular Expression Pattern to extract the number of ports you want to scan. # You have to specify port_range_pattern = re.compile("([0-9]+)-([0-9]+)") # Initialising the port numbers, will be using the variables later on. port_min = 0 port_max = 65535 # This port scanner uses the Python nmap module. # You'll need to install the following to get it work on Linux: # Step 1: sudo apt install python3-pip # Step 2: pip install python-nmap # Basic user interface header print(r"""|""") print("\n***********************************************************") print("\n* Copyright of David Bombal, 2021 *") print("\n* https://www.davidbombal.com *") print("\n* https://www.youtube.com/davidbombal *") print("\n**********************************************************") open_ports = [] # Ask user to input the ip address they want to scan. while True: ip_add_entered = input("\nPlease enter the ip address that you want to scan: ") if ip_add_pattern.search(ip_add_entered): print(f"{ip_add_entered} is a valid ip address") break while True: # You can scan 0-65535 ports. This scanner is basic and doesn't use multithreading so scanning # all the ports is not advised. print("Please enter the range of ports you want to scan in format: port_range = input("Enter port range: ") port_range_valid = port_range_pattern.search(port_range.replace(" ","")) if port_range_valid: port_min = int(port_range_valid.group(1)) port_max = int(port_range_valid.group(2)) break nm = nmap.PortScanner() # We're looping over all of the ports in the specified range. for port in range(port_min, port_max + 1): try: # The result is quite interesting to look at. You may want to inspect the dictionary it returns. # It contains what was sent to the command line in addition to the port status we're after. # For in nmap for port 80 and ip 10.0.0.2 you'd run: nmap -oX - -p 89 -sV 10.0.0.2 result = nm.scan(ip_add_entered, str(port)) # Uncomment following line and look at dictionary # print(result) # We extract the port status from the returned object port_status = (result['scan'][ip_add_entered]['tcp'][port]['state']) print(f"Port {port} is {port_status}") except: # We cannot scan some ports and this ensures the program doesn't crash when we try to scan them. print(f"Cannot scan port {port}.") Download 121.1 Kb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling