您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“Forerunner怎么使用”,感興趣的朋友不妨來看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來帶大家學(xué)習(xí)“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
在網(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ì)象并訂閱ScanAsyncProgressChanged
或ScanAsyncComplete
之類的事件處理程序,這樣我可以完全控制異步方法,我可以控制它們影響應(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()); } } } } }}
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í)!
免責(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)容。