Ejemplo n.º 1
0
 public Command GetCommand()
 {
     TABLE.Add(new CommandArgumentEntry("-rhost", false, "-rhost(resolve hostnames)"));
     CMD_NMAP = new Command("NMAP", TABLE, false, "Attempts to discover all connacted devices on all connected networks.", ExecutionLevel.User, CLIMode.Default);
     CMD_NMAP.SetAsyncFunction(async() =>
     {
         ((TextEditor)EnvironmentVariables.GetCurrentValue("IOFIELD")).Dispatcher.Invoke(() =>
         {
             ((TextEditor)EnvironmentVariables.GetCurrentValue("IOFIELD")).IsReadOnly = true;
             ((TextEditor)EnvironmentVariables.GetCurrentValue("IOFIELD")).KeyDown   += Main_KeyDown;
             IOInteractLayer.StandardOutput(CMD_NMAP, "\n");
         });
         NetworkInterfaceDiscovery nics = new NetworkInterfaceDiscovery();
         ToolShed.ThisPC.NetworkInterface[] interfaces = await nics.GetInterfaces();
         NetworkInfo inf = new NetworkInfo();
         string[] ip_arr = inf.GetAddresses(interfaces);
         await GetDevices(ip_arr, interfaces, CMD_NMAP.InputArgumentEntry.Arguments.Exists(x => x.Call == "-rhost"));
         ((TextEditor)EnvironmentVariables.GetCurrentValue("IOFIELD")).Dispatcher.Invoke(() =>
         {
             ((TextEditor)EnvironmentVariables.GetCurrentValue("IOFIELD")).KeyDown   -= Main_KeyDown;
             ((TextEditor)EnvironmentVariables.GetCurrentValue("IOFIELD")).IsReadOnly = false;
         });
         return("");
     });
     return(CMD_NMAP);
 }