Usman Blog's: Port Scanning

Port Scanning


    1 Nmap & db_nmap
    2 Port Scanning
    3 SMB Version Scanning
    4 Idle Scanning










Scanner dan sebagian modul tambahan lainnya menggunakan opsi rhosts bukan RHOST. Rhosts dapat mengambil rentang IP (192.168.1.20-192.168.1.30), CIDR berkisar (192.168.1.0/24), beberapa kisaran dipisahkan oleh koma (192.168.1.0/24, 192.168.3.0/24), dan garis dipisahkan daftar host file (file: /tmp/hostlist.txt). Ini adalah penggunaan lain untuk grepable Nmap file output.

Perhatikan juga bahwa, secara default, semua modul scanner akan memiliki benang Nilai diatur ke '1'. Nilai Threads menetapkan jumlah benang bersamaan untuk digunakan saat memindai. Menetapkan nilai ini ke jumlah yang lebih tinggi untuk mempercepat scan atau tetap rendah untuk mengurangi lalu lintas jaringan, tetapi pastikan untuk mematuhi panduan berikut: 
  1. Keep the THREADS value under 16 on native Win32 systems
  2. Keep THREADS under 200 when running MSF under Cygwin 
  3.  On Unix-like operating systems, THREADS can be set to 256.\
 Nmap & db_nmap

Kita dapat menggunakan perintah 'db_nmap' untuk menjalankan Nmap terhadap sasaran dan hasil scan akan dari pada disimpan secara otomatis dalam database. Namun, jika Anda juga ingin mengimpor hasil scan ke aplikasi lain atau kerangka kerja nanti, Anda akan cenderung ingin mengekspor hasil scan dalam format XML. Itu selalu baik untuk memiliki semua tiga output Nmap (xml, grepable, dan normal). Jadi kita bisa menjalankan Nmap scan menggunakan bendera '-oA' diikuti oleh nama file yang diinginkan untuk menghasilkan tiga file output kemudian mengeluarkan 'db impor' perintah untuk mengisi database Metasploit.

Cukup menjalankan Nmap dengan pilihan yang Anda biasanya akan menggunakan dari baris perintah. Jika kita berharap untuk memindai kami akan disimpan ke database kami, kami akan menghilangkan bendera output dan menggunakan 'db_nmap'. Contoh di bawah ini kemudian akan "db_nmap v -sV 192.168.1.0/24".

msf > nmap -v -sV 192.168.1.0/24 -oA subnet_1
[*] exec: nmap -v -sV 192.168.1.0/24 -oA subnet_1

Starting Nmap 5.00 ( http://nmap.org ) at 2009-08-13 19:29 MDT
NSE: Loaded 3 scripts for scanning.
Initiating ARP Ping Scan at 19:29
Scanning 101 hosts [1 port/host]
...
Nmap done: 256 IP addresses (16 hosts up) scanned in 499.41 seconds
Raw packets sent: 19973 (877.822KB) | Rcvd: 15125 (609.512KB) 
 
Port Scanning 

Selain menjalankan Nmap, ada berbagai scanner pelabuhan lain yang tersedia bagi kita dalam 
framework.
 
msf > search portscan

Matching Modules
================

   Name                                      Disclosure Date  Rank    Description
   ----                                      ---------------  ----    -----------
   auxiliary/scanner/natpmp/natpmp_portscan                   normal  NAT-PMP External Port Scanner
   auxiliary/scanner/portscan/ack                             normal  TCP ACK Firewall Scanner
   auxiliary/scanner/portscan/ftpbounce                       normal  FTP Bounce Port Scanner
   auxiliary/scanner/portscan/syn                             normal  TCP SYN Port Scanner
   auxiliary/scanner/portscan/tcp                             normal  TCP Port Scanner
   auxiliary/scanner/portscan/xmas                            normal  TCP "XMas" Port Scanner 
 
 
Demi perbandingan, kita akan membandingkan Nmap hasil scan untuk port 80 dengan modul scanning Metasploit. Pertama, mari kita menentukan apa host memiliki
port 80 terbuka menurut Nmap. 
.
msf > cat subnet_1.gnmap | grep 80/open | awk '{print $2}'
[*] exec: cat subnet_1.gnmap | grep 80/open | awk '{print $2}'

192.168.1.1
192.168.1.2
192.168.1.10
192.168.1.109
192.168.1.116
192.168.1.150 
 
Nmap memindai sebelumnya adalah scan SYN jadi kita akan menjalankan scan yang sama di seluruh subnet mencari 
port 80 melalui antarmuka eth0 kami menggunakan Metasploit. 

msf > use auxiliary/scanner/portscan/syn
msf auxiliary(syn) > show options

Module options (auxiliary/scanner/portscan/syn):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   BATCHSIZE  256              yes       The number of hosts to scan per set
   INTERFACE                   no        The name of the interface
   PORTS      1-10000          yes       Ports to scan (e.g. 22-25,80,110-900)
   RHOSTS                      yes       The target address range or CIDR identifier
   SNAPLEN    65535            yes       The number of bytes to capture
   THREADS    1                yes       The number of concurrent threads
   TIMEOUT    500              yes       The reply read timeout in milliseconds

msf auxiliary(syn) > set INTERFACE eth0
INTERFACE => eth0
msf auxiliary(syn) > set PORTS 80
PORTS => 80
msf auxiliary(syn) > set RHOSTS 192.168.1.0/24
RHOSTS => 192.168.1.0/24
msf auxiliary(syn) > set THREADS 50
THREADS => 50
msf auxiliary(syn) > run

[*] TCP OPEN 192.168.1.1:80
[*] TCP OPEN 192.168.1.2:80
[*] TCP OPEN 192.168.1.10:80
[*] TCP OPEN 192.168.1.109:80
[*] TCP OPEN 192.168.1.116:80
[*] TCP OPEN 192.168.1.150:80
[*] Scanned 256 of 256 hosts (100% complete)
[*] Auxiliary module execution completed

Di sini kita akan mengisi dengan 'tcp' scanner dan kami akan menggunakannya untuk melawan target lain. Seperti dengan semua plugin yang disebutkan sebelumnya, ini menggunakan rhosts. Ingat kita dapat mengeluarkan 'host r' perintah untuk secara otomatis mengatur opsi ini 
dengan host yang ditemukan dalam database kami.
 
msf > use auxiliary/scanner/portscan/tcp
msf  auxiliary(tcp) > show options

Module options (auxiliary/scanner/portscan/tcp):

   Name         Current Setting  Required  Description
   ----         ---------------  --------  -----------
   CONCURRENCY  10               yes       The number of concurrent ports to check per host
   FILTER                        no        The filter string for capturing traffic
   INTERFACE                     no        The name of the interface
   PCAPFILE                      no        The name of the PCAP capture file to process
   PORTS        1-10000          yes       Ports to scan (e.g. 22-25,80,110-900)
   RHOSTS                        yes       The target address range or CIDR identifier
   SNAPLEN      65535            yes       The number of bytes to capture
   THREADS      1                yes       The number of concurrent threads
   TIMEOUT      1000             yes       The socket connect timeout in milliseconds

msf  auxiliary(tcp) > hosts -R

Hosts
=====

address         mac                name  os_name  os_flavor  os_sp  purpose  info  comments
-------         ---                ----  -------  ---------  -----  -------  ----  --------
172.16.194.172  00:0C:29:D1:62:80        Linux    Ubuntu            server         

RHOSTS => 172.16.194.172

msf  auxiliary(tcp) > show options

Module options (auxiliary/scanner/portscan/tcp):

   Name         Current Setting  Required  Description
   ----         ---------------  --------  -----------
   CONCURRENCY  10               yes       The number of concurrent ports to check per host
   FILTER                        no        The filter string for capturing traffic
   INTERFACE                     no        The name of the interface
   PCAPFILE                      no        The name of the PCAP capture file to process
   PORTS        1-1024           yes       Ports to scan (e.g. 22-25,80,110-900)
   RHOSTS       172.16.194.172   yes       The target address range or CIDR identifier
   SNAPLEN      65535            yes       The number of bytes to capture
   THREADS      10                yes       The number of concurrent threads
   TIMEOUT      1000             yes       The socket connect timeout in milliseconds

msf  auxiliary(tcp) > run

[*] 172.16.194.172:25 - TCP OPEN
[*] 172.16.194.172:23 - TCP OPEN
[*] 172.16.194.172:22 - TCP OPEN
[*] 172.16.194.172:21 - TCP OPEN
[*] 172.16.194.172:53 - TCP OPEN
[*] 172.16.194.172:80 - TCP OPEN
[*] 172.16.194.172:111 - TCP OPEN
[*] 172.16.194.172:139 - TCP OPEN
[*] 172.16.194.172:445 - TCP OPEN
[*] 172.16.194.172:514 - TCP OPEN
[*] 172.16.194.172:513 - TCP OPEN
[*] 172.16.194.172:512 - TCP OPEN
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf  auxiliary(tcp) > 
 
Jadi kita bisa melihat bahwa built-in modul scanner Metasploit adalah lebih dari mampu menemukan sistem dan port yang terbuka bagi kita. Hanya saja alat lain yang sangat baik untuk memiliki dalam gudang senjata Anda jika Anda kebetulan 
menjalankan Metasploit pada sistem tanpa Nmap diinstal. 

SMB Version Scanning
 
Sekarang kita telah menentukan yang host yang tersedia pada jaringan, kita dapat mencoba untuk menentukan sistem operasi mereka berjalan. Hal ini akan membantu kita mempersempit serangan kami untuk menargetkan sistem tertentu dan akan menghentikan kita dari 
membuang-buang waktu pada orang-orang yang tidak rentan terhadap eksploitasi tertentu. 

msf > use auxiliary/scanner/smb/smb_version
msf auxiliary(smb_version) > set RHOSTS 192.168.1.200-210
RHOSTS => 192.168.1.200-210
msf auxiliary(smb_version) > set THREADS 11
THREADS => 11
msf auxiliary(smb_version) > run

[*] 192.168.1.209:445 is running Windows 2003 R2 Service Pack 2 (language: Unknown) (name:XEN-2K3-FUZZ) (domain:WORKGROUP)
[*] 192.168.1.201:445 is running Windows XP Service Pack 3 (language: English) (name:V-XP-EXPLOIT) (domain:WORKGROUP)
[*] 192.168.1.202:445 is running Windows XP Service Pack 3 (language: English) (name:V-XP-DEBUG) (domain:WORKGROUP)
[*] Scanned 04 of 11 hosts (036% complete)
[*] Scanned 09 of 11 hosts (081% complete)
[*] Scanned 11 of 11 hosts (100% complete)
[*] Auxiliary module execution completed

Juga perhatikan bahwa jika kita menjalankan perintah 'host' sekarang,
informasi yang baru diperoleh disimpan dalam database Metasploit.
 
msf auxiliary(smb_version) > hosts

Hosts
=====

address        mac  name  os_name            os_flavor  os_sp  purpose  info  comments
-------        ---  ----  -------            ---------  -----  -------  ----  --------
192.168.1.201             Microsoft Windows  XP         SP3    client         
192.168.1.202             Microsoft Windows  XP         SP3    client         
192.168.1.209             Microsoft Windows  2003 R2    SP2    server
 
Idle Scanning 

Nmap IP Menganggur scanning memungkinkan kita untuk menjadi pemindaian tersembunyi sedikit target sementara spoofing alamat IP dari host lain pada jaringan. Agar jenis scan untuk bekerja, kita perlu mencari host yang menganggur pada jaringan dan menggunakan urutan IPID baik Incremental atau Patah Sedikit-Endian Incremental. Metasploit berisi modul 'scanner / ip / ipidseq' untuk memindai dan mencari host yang sesuai dengan persyaratan.
Dalam buku Nmap online gratis, 
Anda dapat mengetahui informasi lebih lanjut tentang Nmap Scanning Menganggur.
 
msf > use auxiliary/scanner/ip/ipidseq
msf auxiliary(ipidseq) > show options

Module options (auxiliary/scanner/ip/ipidseq):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   INTERFACE                   no        The name of the interface
   RHOSTS                      yes       The target address range or CIDR identifier
   RPORT      80               yes       The target port
   SNAPLEN    65535            yes       The number of bytes to capture
   THREADS    1                yes       The number of concurrent threads
   TIMEOUT    500              yes       The reply read timeout in milliseconds

msf auxiliary(ipidseq) > set RHOSTS 192.168.1.0/24
RHOSTS => 192.168.1.0/24
msf auxiliary(ipidseq) > set THREADS 50
THREADS => 50
msf auxiliary(ipidseq) > run

[*] 192.168.1.1's IPID sequence class: All zeros
[*] 192.168.1.2's IPID sequence class: Incremental!
[*] 192.168.1.10's IPID sequence class: Incremental!
[*] 192.168.1.104's IPID sequence class: Randomized
[*] 192.168.1.109's IPID sequence class: Incremental!
[*] 192.168.1.111's IPID sequence class: Incremental!
[*] 192.168.1.114's IPID sequence class: Incremental!
[*] 192.168.1.116's IPID sequence class: All zeros
[*] 192.168.1.124's IPID sequence class: Incremental!
[*] 192.168.1.123's IPID sequence class: Incremental!
[*] 192.168.1.137's IPID sequence class: All zeros
[*] 192.168.1.150's IPID sequence class: All zeros
[*] 192.168.1.151's IPID sequence class: Incremental!
[*] Auxiliary module execution completed
 
Dilihat oleh hasil scan, kami memiliki sejumlah zombie potensial dapat kita gunakan untuk melakukan scanning menganggur. Kami akan mencoba memindai host menggunakan zombie di 192.168.1.109 
dan melihat apakah kita mendapatkan hasil yang sama kami sebelumnya. 

msf auxiliary(ipidseq) > nmap -PN -sI 192.168.1.109 192.168.1.114
[*] exec: nmap -PN -sI 192.168.1.109 192.168.1.114

Starting Nmap 5.00 ( http://nmap.org ) at 2009-08-14 05:51 MDT
Idle scan using zombie 192.168.1.109 (192.168.1.109:80); Class: Incremental
Interesting ports on 192.168.1.114:
Not shown: 996 closed|filtered ports
PORT STATE SERVICE
135/tcp open msrpc
139/tcp open netbios-ssn
445/tcp open microsoft-ds
3389/tcp open ms-term-serv
MAC Address: 00:0C:29:41:F2:E8 (VMware)

Nmap done: 1 IP address (1 host up) scanned in 5.56 seconds

#Salam Security
##Referensi:http://www.offensive-security.com/metasploit-unleashed/Port_Scanning





 


Tidak ada komentar:

Posting Komentar

Copyright © Usman Blog's Urang-kurai