溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Forerunner怎么使用

發(fā)布時(shí)間:2021-12-16 09:24:04 來源:億速云 閱讀:128 作者:iii 欄目:網(wǎng)絡(luò)安全

本篇內(nèi)容主要講解“Forerunner怎么使用”,感興趣的朋友不妨來看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“Forerunner怎么使用”吧!

Forerunner

Forerunner是一個(gè)快速的、輕量級(jí)的并且可擴(kuò)展的網(wǎng)絡(luò)庫(kù),它可以幫助研究人員開發(fā)一個(gè)以網(wǎng)絡(luò)為中心的健壯的應(yīng)用程序,比如說IP掃描器、端口掃描器、客戶端以及服務(wù)器等等。當(dāng)前版本的Forerunner,能夠支持針對(duì)端口和IP地址進(jìn)行同步或異步掃描,并收集關(guān)于目標(biāo)設(shè)備的地理位置信息和終端信息,比如說IP地址是否在線以及設(shè)備的物理MAC地址等等。這個(gè)庫(kù)是一個(gè)完全面向?qū)ο蠛突谑录膸?kù),這意味著掃描數(shù)據(jù)都將包含在精心編制的“scan”對(duì)象之中,而這些對(duì)象旨在處理涵蓋從結(jié)果到異常的所有數(shù)據(jù)。

工具依賴

1、.NET Framework v4.6.1

功能介紹

方法名描述使用樣例
Scan掃描單個(gè)IP地址并收集信息Scan("192.168.1.1");
ScanRange掃描IP地址范圍并收集信息ScanRange("192.168.1.1", "192.168.1.255")
ScanList掃描IP地址列表并收集信息ScanList("192.168.1.1, 192.168.1.2, 192.168.1.3")
PortKnock掃描單個(gè)IP地址的所有端口PortKnock("192.168.1.1");
PortKnockRange掃描IP地址范圍內(nèi)的所有端口PortKnockRange("192.168.1.1", "192.168.1.255");
PortKnockList掃描IP地址列表中的所有端口PortKnockList("192.198.1.1, 192.168.1.2, 192.168.1.3");
IsHostAlive每多少毫秒掃描一臺(tái)主機(jī)N次IsHostAlive("192.168.1.1", 5, 1000);
GetAveragePingResponse獲取目標(biāo)主機(jī)的平均ping響應(yīng)GetAveragePingResponse("192.168.1.1", 5, 1000);
IsPortOpen通過TCP&UDP來ping單個(gè)端口IsPortOpen("192.168.1.1", 45000, new TimeSpan(1000), false);

工具下載

廣大研究人員可以使用下列命令將項(xiàng)目源碼克隆至本地:

git clone https://github.com/jasondrawdy/Forerunner.git

工具使用樣例

IP掃描

在網(wǎng)絡(luò)安全研究過程中,掃描一個(gè)網(wǎng)絡(luò)是一種非常常見的任務(wù)了,因此我們應(yīng)該通過盡可能簡(jiǎn)單的方法來實(shí)現(xiàn)這個(gè)目標(biāo),以方便未來的安全研究人員去做同樣的事情。Forerunner是一個(gè)完全面向?qū)ο蟮墓δ軒?kù),因此非常適合所謂“即插即用”的情況。其中,用于IP掃描的對(duì)象被稱之為IPScanObject,這個(gè)對(duì)象包含了下列幾種參數(shù)屬性:

Address (String)

IP (IPAddress)

Ping (Long)

Hostname (String)

MAC (String)

isOnline (Bool)

Errors (Exception)

有了對(duì)象的概念之后,我們可以嘗試創(chuàng)建一個(gè)新的對(duì)象,并使用它來執(zhí)行一次掃描任務(wù)。最簡(jiǎn)單的方法就是先創(chuàng)建一個(gè)新的Scanner對(duì)象,并通過它來訪問我們的掃描方法。接下來,創(chuàng)建一個(gè)IPScanObject對(duì)象,并使用目標(biāo)IP地址來設(shè)置其Scan方法。

同步掃描:

using System;using Forerunner; // Remember to import our library.namespace Example{    class Program    {        static void Main(string[] args)        {            // Our IP we would like to scan.            string ip = "192.168.1.1";            // Create a new scanner object.            Scanner s = new Scanner();            // Create a new scan object and perform a scan.            IPScanObject result = s.Scan(ip);            // Output that we have finished the scan.            if (result.Errors != null)                Console.WriteLine("[x] An error occurred during the scan.");            else                Console.WriteLine("[+] " + ip + " has been successfully scanned!")            // Allow the user to exit at any time.            Console.Read();        }    }}

另一種方法是創(chuàng)建Scanner對(duì)象并訂閱ScanAsyncProgressChangedScanAsyncComplete之類的事件處理程序,這樣我可以完全控制異步方法,我可以控制它們影響應(yīng)用程序的進(jìn)度狀態(tài)等等。

異步掃描:

using System;using System.Threading.Tasks;using Forerunner; // Remember to import our library.namespace Example{    class Program    {        static void Main(string[] args)        {            // Our IP we would like to scan.            string ip = "192.168.1.1";            // Setup our scanner object.            Scanner s = new Scanner();            s.ScanAsyncProgressChanged += new ScanAsyncProgressChangedHandler(ScanAsyncProgressChanged);            s.ScanAsyncComplete += new ScanAsyncCompleteHandler(ScanAsyncComplete);            // Start a new scan task with our ip.            TaskFactory task = new TaskFactory();            task.StartNew(() => s.ScanAsync(ip));            // Allow the user to exit at any time.            Console.Read();        }        static void ScanAsyncProgressChanged(object sender, ScanAsyncProgressChangedEventArgs e)        {            // Do something here with e.Progress, or you could leave this event            // unsubscribed so you wouldn't have to do anything.        }        static void ScanAsyncComplete(object sender, ScanAsyncCompleteEventArgs e)        {           // Do something with the IPScanObject aka e.Result.            if (e.Result.Errors != null)                Console.WriteLine("[x] An error occurred during the scan.");            else                Console.WriteLine("[+] " + e.Result.IP + " has been successfully scanned!")        }    }}

端口掃描

跟IP地址掃描一樣,端口掃描可以通過一組預(yù)定義的端口來嘗試進(jìn)行端口連接,并檢查目標(biāo)端口是否真正開啟。它將嘗試通過與每個(gè)端口進(jìn)行連接并發(fā)送數(shù)據(jù)包來進(jìn)行端口探測(cè)。這個(gè)功能同樣是通過一個(gè)自定義對(duì)象來實(shí)現(xiàn)的,即"Port Knock Scan Object",簡(jiǎn)稱為“PKScanObject”。 PKScanObject對(duì)象實(shí)際上包含一個(gè)PKServiceObjects列表,該列表將保存返回的全部端口數(shù)據(jù),該服務(wù)對(duì)象包含下列參數(shù)屬性:

IP (String)

Port (Int)

Protocol (PortType)

Status (Bool)

首先,我們需要?jiǎng)?chuàng)建一個(gè)Scanner對(duì)象,然后創(chuàng)建一個(gè)新的PKScanObject對(duì)象并使用目標(biāo)IP來設(shè)置PortKnock方法,然后工具將顯示掃描結(jié)果給我們。

同步掃描:

using System;using Forerunner; // Remember to import our library.namespace Example{    class Program    {        static void Main(string[] args)        {            // Our IP we would like to scan.            string ip = "192.168.1.1";            // Create a new scanner object.            Scanner s = new Scanner();            // Create a new scan object and perform a scan.            PKScanObject result = s.PortKnock(ip);            // Output that we have finished the scan.            if (result.Errors != null)                Console.WriteLine("[x] An error occurred during the scan.");            else                Console.WriteLine("[+] " + ip + " has been successfully scanned!")           // Display our results.           foreach (PKServiceObject port in result.Services)           {                Console.WriteLine("[+] IP: " + port.IP + " | " +                                  "Port: " + port.Port.ToString() + " | " +                                  "Protocol: " + port.Protocol.ToString() + " | " +                                  "Status: " + port.Status.ToString());           }           // Allow the user to exit at any time.           Console.Read();        }    }}

異步掃描:

using System;using System.Threading.Tasks;using Forerunner; // Remember to import our library.namespace Example{    class Program    {        static void Main(string[] args)        {            // Our IP we would like to scan.            string ip = "192.168.1.1";            // Setup our scanner object.            Scanner s = new Scanner();            s.PortKnockAsyncProgressChanged += new PortKnockAsyncProgressChangedHandler(PortKnockAsyncProgressChanged);            s.PortKnockAsyncComplete += new PortKnockAsyncCompleteHandler(PortKnockAsyncComplete);            // Start a new scan task with our ip.            TaskFactory task = new TaskFactory();            task.StartNew(() => s.PortKnockAsync(ip));            // Allow the user to exit at any time.            Console.Read();        }        static void PortKnockAsyncProgressChanged(object sender, PortKnockAsyncProgressChangedEventArgs e)        {            // Display our progress so we know the ETA.            if (e.Progress == 99)            {                Console.Write(e.Progress.ToString() + "%...");                Console.WriteLine("100%!");            }            else                Console.Write(e.Progress.ToString() + "%...");        }        static void PortKnockAsyncComplete(object sender, PortKnockAsyncCompleteEventArgs e)        {            // Tell the user that the port knock was complete.            Console.WriteLine("[+] Port Knock Complete!");            // Check if we resolved an error.            if (e.Result == null)                Console.WriteLine("[X] The port knock did not return any data!");            else            {                // Check if we have any ports recorded.                if (e.Result.Services.Count == 0)                    Console.WriteLine("[!] No ports were open during the knock.");                else                {                    // Display our ports and their details.                    foreach (PKServiceObject port in e.Result.Services)                    {                         Console.WriteLine("[+] IP: " + port.IP + " | " +                                          "Port: " + port.Port.ToString() + " | " +                                          "Protocol: " + port.Protocol.ToString() + " | " +                                          "Status: " + port.Status.ToString());                    }                }            }        }    }}

許可證協(xié)議

Forerunner項(xiàng)目的開發(fā)和發(fā)布遵循MIT開源許可證協(xié)議。

到此,相信大家對(duì)“Forerunner怎么使用”有了更深的了解,不妨來實(shí)際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI