public IActionResult ScanPort([FromQuery] NMapWithPortOptionModel model)
        {
            string fileName = OnkeiUtil.GenerateTimeStamp();
            var    check    = OnkeiUtil.CheckIpOrHost(model.Host);

            if (check == null)
            {
                return(BadRequest(
                           BaseResponseModel.PrepareDataFail("Model is not correct")
                           ));
            }
            if (model.PortTo != null && model.PortTo <= model.PortFrom)
            {
                return(BadRequest(
                           BaseResponseModel.PrepareDataFail("Port is not correct")
                           ));
            }
            var result = _nMapService.ScanPort(model);

            if (result == null)
            {
                return(BadRequest(
                           BaseResponseModel.PrepareDataFail("Model is not correct")
                           ));
            }
            string link = "";

            if (result.Trim() != "")
            {
                link = "http://" + HttpContext.Request.Host.Value + "/file/download/" + OnkeiUtil.SaveFile(fileName, result);
            }
            return(Ok(BaseResponseModel.PrepareDataSuccess(result, "Success", link)));
        }
        public string ScanPort(NMapWithPortOptionModel model)
        {
            var argument = $"-p " + model.PortFrom;

            if (model.PortTo != null)
            {
                if (model.PortTo <= model.PortFrom)
                {
                    return(null);
                }
                argument += "-" + model.PortTo;
            }
            argument += " " + model.Host;
            processStartInfo.Arguments = argument;
            using (Process process = Process.Start(processStartInfo))
            {
                using (StreamReader reader = process.StandardOutput)
                {
                    string result = reader.ReadToEnd();
                    return(result);
                }
            }
        }