modmin
parent
8b0f909a10
commit
4bf0c12507
30
Program.cs
30
Program.cs
|
|
@ -13,6 +13,10 @@ using System.Threading.Tasks;
|
||||||
|
|
||||||
|
|
||||||
namespace SharpScan
|
namespace SharpScan
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
class Program
|
||||||
{
|
{
|
||||||
public class Options
|
public class Options
|
||||||
{
|
{
|
||||||
|
|
@ -38,9 +42,6 @@ namespace SharpScan
|
||||||
public int TopPorts { get; set; }
|
public int TopPorts { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Program
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public static List<string> GetIpsFromCidr(string cidr)
|
public static List<string> GetIpsFromCidr(string cidr)
|
||||||
{
|
{
|
||||||
|
|
@ -134,9 +135,7 @@ namespace SharpScan
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void RunOptions(Options o)
|
||||||
|
|
||||||
static void Main(string[] args)
|
|
||||||
{
|
{
|
||||||
List<(string address, int port)> cibles = new List<(string address, int port)>();
|
List<(string address, int port)> cibles = new List<(string address, int port)>();
|
||||||
List<string> addresses = new List<string>();
|
List<string> addresses = new List<string>();
|
||||||
|
|
@ -149,9 +148,6 @@ namespace SharpScan
|
||||||
int jittler = 0;
|
int jittler = 0;
|
||||||
int top_port = 0;
|
int top_port = 0;
|
||||||
|
|
||||||
|
|
||||||
Parser.Default.ParseArguments<Options>(args).WithParsed<Options>(o => {
|
|
||||||
|
|
||||||
// Gestion des hosts
|
// Gestion des hosts
|
||||||
foreach (string host in o.Hosts)
|
foreach (string host in o.Hosts)
|
||||||
{
|
{
|
||||||
|
|
@ -209,9 +205,6 @@ namespace SharpScan
|
||||||
delay = o.Delay;
|
delay = o.Delay;
|
||||||
jittler = o.Jittler;
|
jittler = o.Jittler;
|
||||||
top_port = o.TopPorts;
|
top_port = o.TopPorts;
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Construction des cibles
|
// Construction des cibles
|
||||||
foreach (string address in addresses)
|
foreach (string address in addresses)
|
||||||
|
|
@ -293,6 +286,19 @@ namespace SharpScan
|
||||||
}
|
}
|
||||||
Console.WriteLine($" {port} opened ({Utils.GetDesc(port)})");
|
Console.WriteLine($" {port} opened ({Utils.GetDesc(port)})");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
static void HandleParseError(IEnumerable<Error> errs)
|
||||||
|
{
|
||||||
|
//handle errors
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void Main(string[] args)
|
||||||
|
{
|
||||||
|
CommandLine.Parser.Default.ParseArguments<Options>(args)
|
||||||
|
.WithParsed(RunOptions)
|
||||||
|
.WithNotParsed(HandleParseError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue