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 IActionResult DetectVulnerability([FromQuery] string host) { string fileName = OnkeiUtil.GenerateTimeStamp(); var check = OnkeiUtil.CheckIpOrHost(host); if (check == null) { return(BadRequest( BaseResponseModel.PrepareDataFail("Model is not correct") )); } var result = _nMapService.DetectVulnerability(host); 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 IActionResult BasicScanMultiHost([FromQuery] List <string> hosts) { string fileName = OnkeiUtil.GenerateTimeStamp(); var check = OnkeiUtil.CheckIpOrHost(hosts); if (check == null) { return(BadRequest( BaseResponseModel.PrepareDataFail("Model is not correct") )); } var result = _nMapService.BasicScanMultiHost(hosts); if (result == null) { return(BadRequest( BaseResponseModel.PrepareDataFail("Model is not correct") )); } string link = "http://" + HttpContext.Request.Host.Value + "/file/download/" + OnkeiUtil.SaveFile(fileName, result); return(Ok(BaseResponseModel.PrepareDataSuccess(result, "Success", link))); }