Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Forerunner

2025-01-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains "how to use Forerunner". Friends who are interested might as well take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to use Forerunner.

Forerunner

Forerunner is a fast, lightweight and extensible network library that can help researchers develop robust network-centric applications such as IP scanners, port scanners, clients and servers. The current version of Forerunner can support synchronous or asynchronous scanning of ports and IP addresses, and collect geographic location and terminal information about the target device, such as whether the IP address is online and the physical MAC address of the device, and so on. This library is a fully object-oriented and event-based library, which means that scan data will be contained in carefully crafted "scan" objects designed to handle everything from results to exceptions.

The tool depends on 1. NET Framework v4.6.1 function introduction method name description using a sample Scan to scan a single IP address and collect information Scan ("192.168.1.1") ScanRange scans the IP address range and collects information ScanRange ("192.168.1.1", "192.168.1.255") ScanList scans the IP address list and collects information ScanList ("192.168.1.1, 192.168.1.2, 192.168.1.3") PortKnock scans all ports of a single IP address PortKnock ("192.168.1.1") PortKnockRange scans all ports in the IP address range PortKnockRange ("192.168.1.1", "192.168.1.255"); PortKnockList scans all ports PortKnockList ("192.198.1.1, 192.168.1.2, 192.168.1.3") in the IP address list; IsHostAlive scans a host N times per millisecond ("192.168.1.1", 5, 1000). GetAveragePingResponse gets the average ping response GetAveragePingResponse of the target host ("192.168.1.1", 5, 1000); IsPortOpen uses TCP&UDP to ping single port IsPortOpen ("192.168.1.1", 45000, new TimeSpan (1000), false); tool download

The vast majority of researchers can use the following commands to clone the project source code locally:

The git clone https://github.com/jasondrawdy/Forerunner.git tool scans using sample IP

In the process of network security research, scanning a network is a very common task, so we should achieve this goal as simply as possible, so it is convenient for future security researchers to do the same thing. Forerunner is a fully object-oriented functional library, so it is very suitable for the so-called "plug and play" situation. The object used for IP scanning is called IPScanObject, which contains the following parameter properties:

Address (String)

IP (IPAddress)

Ping (Long)

Hostname (String)

MAC (String)

IsOnline (Bool)

Errors (Exception)

With the concept of an object in mind, we can try to create a new object and use it to perform a scan task. The easiest way is to first create a new Scanner object and use it to access our scanning method. Next, create an IPScanObject object and set its Scan method using the target IP address.

Synchronous 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 ();}

Another way is to create Scanner objects and subscribe to event handlers such as ScanAsyncProgressChanged or ScanAsyncComplete so that I have complete control over asynchronous methods, which affect the progress state of the application, and so on.

Asynchronous scanning: 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!")} Port scan

Like IP address scanning, port scanning can attempt a port connection through a predefined set of ports and check whether the destination port is actually open. It will attempt to probe the port by connecting to each port and sending packets. This function is also achieved through a custom object, namely "Port Knock ScanObject", or "PKScanObject" for short. The PKScanObject object actually contains a PKServiceObjects list that holds all the port data returned, and the service object contains the following parameter properties:

IP (String)

Port (Int)

Protocol (PortType)

Status (Bool)

First, we need to create a Scanner object, then create a new PKScanObject object and set the PortKnock method using the target IP, and then the tool will display the scan results to us.

Synchronous 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. 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 ();}} Asynchronous scanning: 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 () } license Agreement

The development and release of the Forerunner project follows the MIT open source license agreement.

At this point, I believe you have a deeper understanding of "how to use Forerunner". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report