您好,登錄后才能下訂單哦!
本篇內容主要講解“Forerunner怎么使用”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學習“Forerunner怎么使用”吧!
Forerunner是一個快速的、輕量級的并且可擴展的網絡庫,它可以幫助研究人員開發一個以網絡為中心的健壯的應用程序,比如說IP掃描器、端口掃描器、客戶端以及服務器等等。當前版本的Forerunner,能夠支持針對端口和IP地址進行同步或異步掃描,并收集關于目標設備的地理位置信息和終端信息,比如說IP地址是否在線以及設備的物理MAC地址等等。這個庫是一個完全面向對象和基于事件的庫,這意味著掃描數據都將包含在精心編制的“scan”對象之中,而這些對象旨在處理涵蓋從結果到異常的所有數據。
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地址范圍內的所有端口 | 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 | 獲取目標主機的平均ping響應 | 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
在網絡安全研究過程中,掃描一個網絡是一種非常常見的任務了,因此我們應該通過盡可能簡單的方法來實現這個目標,以方便未來的安全研究人員去做同樣的事情。Forerunner是一個完全面向對象的功能庫,因此非常適合所謂“即插即用”的情況。其中,用于IP掃描的對象被稱之為IPScanObject
,這個對象包含了下列幾種參數屬性:
Address (String)
IP (IPAddress)
Ping (Long)
Hostname (String)
MAC (String)
isOnline (Bool)
Errors (Exception)
有了對象的概念之后,我們可以嘗試創建一個新的對象,并使用它來執行一次掃描任務。最簡單的方法就是先創建一個新的Scanner
對象,并通過它來訪問我們的掃描方法。接下來,創建一個IPScanObject
對象,并使用目標IP地址來設置其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(); } }}
另一種方法是創建Scanner
對象并訂閱ScanAsyncProgressChanged
或ScanAsyncComplete
之類的事件處理程序,這樣我可以完全控制異步方法,我可以控制它們影響應用程序的進度狀態等等。
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地址掃描一樣,端口掃描可以通過一組預定義的端口來嘗試進行端口連接,并檢查目標端口是否真正開啟。它將嘗試通過與每個端口進行連接并發送數據包來進行端口探測。這個功能同樣是通過一個自定義對象來實現的,即"Port Knock Scan Object
",簡稱為“PKScanObject
”。 PKScanObject
對象實際上包含一個PKServiceObjects
列表,該列表將保存返回的全部端口數據,該服務對象包含下列參數屬性:
IP (String)
Port (Int)
Protocol (PortType)
Status (Bool)
首先,我們需要創建一個Scanner
對象,然后創建一個新的PKScanObject
對象并使用目標IP來設置PortKnock
方法,然后工具將顯示掃描結果給我們。
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項目的開發和發布遵循MIT開源許可證協議。
到此,相信大家對“Forerunner怎么使用”有了更深的了解,不妨來實際操作一番吧!這里是億速云網站,更多相關內容可以進入相關頻道進行查詢,關注我們,繼續學習!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。