本篇內(nèi)容主要講解“Forerunner怎么使用”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學(xué)習(xí)“Forerunner怎么使用”吧!
下花園ssl適用于網(wǎng)站、小程序/APP、API接口等需要進行數(shù)據(jù)傳輸應(yīng)用場景,ssl證書未來市場廣闊!成為成都創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:18982081108(備注:SSL證書合作)期待與您的合作!
Forerunner是一個快速的、輕量級的并且可擴展的網(wǎng)絡(luò)庫,它可以幫助研究人員開發(fā)一個以網(wǎng)絡(luò)為中心的健壯的應(yīng)用程序,比如說IP掃描器、端口掃描器、客戶端以及服務(wù)器等等。當(dāng)前版本的Forerunner,能夠支持針對端口和IP地址進行同步或異步掃描,并收集關(guān)于目標(biāo)設(shè)備的地理位置信息和終端信息,比如說IP地址是否在線以及設(shè)備的物理MAC地址等等。這個庫是一個完全面向?qū)ο蠛突谑录膸欤@意味著掃描數(shù)據(jù)都將包含在精心編制的“scan”對象之中,而這些對象旨在處理涵蓋從結(jié)果到異常的所有數(shù)據(jù)。
1、.NET Framework v4.6.1
方法名 | 描述 | 使用樣例 |
---|---|---|
Scan | 掃描單個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 | 掃描單個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 | 每多少毫秒掃描一臺主機N次 | IsHostAlive("192.168.1.1", 5, 1000); |
GetAveragePingResponse | 獲取目標(biāo)主機的平均ping響應(yīng) | GetAveragePingResponse("192.168.1.1", 5, 1000); |
IsPortOpen | 通過TCP&UDP來ping單個端口 | IsPortOpen("192.168.1.1", 45000, new TimeSpan(1000), false); |
廣大研究人員可以使用下列命令將項目源碼克隆至本地:
git clone https://github.com/jasondrawdy/Forerunner.git
在網(wǎng)絡(luò)安全研究過程中,掃描一個網(wǎng)絡(luò)是一種非常常見的任務(wù)了,因此我們應(yīng)該通過盡可能簡單的方法來實現(xiàn)這個目標(biāo),以方便未來的安全研究人員去做同樣的事情。Forerunner是一個完全面向?qū)ο蟮墓δ軒?,因此非常適合所謂“即插即用”的情況。其中,用于IP掃描的對象被稱之為IPScanObject
,這個對象包含了下列幾種參數(shù)屬性:
Address (String)
IP (IPAddress)
Ping (Long)
Hostname (String)
MAC (String)
isOnline (Bool)
Errors (Exception)
有了對象的概念之后,我們可以嘗試創(chuàng)建一個新的對象,并使用它來執(zhí)行一次掃描任務(wù)。最簡單的方法就是先創(chuàng)建一個新的Scanner
對象,并通過它來訪問我們的掃描方法。接下來,創(chuàng)建一個IPScanObject
對象,并使用目標(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
對象并訂閱ScanAsyncProgressChanged
或ScanAsyncComplete
之類的事件處理程序,這樣我可以完全控制異步方法,我可以控制它們影響應(yīng)用程序的進度狀態(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ù)定義的端口來嘗試進行端口連接,并檢查目標(biāo)端口是否真正開啟。它將嘗試通過與每個端口進行連接并發(fā)送數(shù)據(jù)包來進行端口探測。這個功能同樣是通過一個自定義對象來實現(xiàn)的,即"Port Knock Scan Object
",簡稱為“PKScanObject
”。 PKScanObject
對象實際上包含一個PKServiceObjects
列表,該列表將保存返回的全部端口數(shù)據(jù),該服務(wù)對象包含下列參數(shù)屬性:
IP (String)
Port (Int)
Protocol (PortType)
Status (Bool)
首先,我們需要創(chuàng)建一個Scanner
對象,然后創(chuàng)建一個新的PKScanObject
對象并使用目標(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項目的開發(fā)和發(fā)布遵循MIT開源許可證協(xié)議。
到此,相信大家對“Forerunner怎么使用”有了更深的了解,不妨來實際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進入相關(guān)頻道進行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!