流量日志菜单下新增 文件扫描菜单
This commit is contained in:
160
src/main/java/com/nis/domain/log/NtcHttpObjScanResultLog.java
Normal file
160
src/main/java/com/nis/domain/log/NtcHttpObjScanResultLog.java
Normal file
@@ -0,0 +1,160 @@
|
||||
package com.nis.domain.log;
|
||||
|
||||
import com.nis.util.excel.ExcelField;
|
||||
/**
|
||||
*
|
||||
*文件离线扫描结果 实体类
|
||||
*
|
||||
*/
|
||||
public class NtcHttpObjScanResultLog extends BaseLogEntity<NtcHttpObjScanResultLog> {
|
||||
|
||||
private static final long serialVersionUID = -7697668215327123848L;
|
||||
|
||||
@ExcelField(title = "URL", sort = 8)
|
||||
private String url;
|
||||
|
||||
@ExcelField(title = "req_hdr_key", sort = 9)
|
||||
private String reqHdrKey;// 请求头转储文件key
|
||||
|
||||
@ExcelField(title = "req_hdr_file", sort = 10)
|
||||
private String reqHdrFile;
|
||||
|
||||
@ExcelField(title = "req_body_key", sort = 11)
|
||||
private String reqBodyKey;// 请求体转储文件key
|
||||
|
||||
@ExcelField(title = "req_body_file", sort = 12)
|
||||
private String reqBodyFile;
|
||||
|
||||
@ExcelField(title = "res_hdr_key", sort = 13)
|
||||
private String resHdrKey;// 应答头转储文件key
|
||||
|
||||
@ExcelField(title = "res_hdr_file", sort = 14)
|
||||
private String resHdrFile;
|
||||
|
||||
@ExcelField(title = "res_body_key", sort = 15)
|
||||
private String resBodyKey;// 应答体转储文件key
|
||||
|
||||
@ExcelField(title = "res_body_file", sort = 16)
|
||||
private String resBodyFile;
|
||||
|
||||
@ExcelField(title = "topic_name", sort = 16)
|
||||
private String topicName;//原始消息所属的topic
|
||||
|
||||
@ExcelField(title = "malware_id", sort = 16)
|
||||
private Integer malwareId;//恶意文件命中病毒ID
|
||||
|
||||
@ExcelField(title = "malware_type", sort = 16)
|
||||
private String malwareType;//恶意病毒类型
|
||||
|
||||
@ExcelField(title = "malware_name", sort = 16)
|
||||
private String malwareName;//恶意病毒名称
|
||||
|
||||
|
||||
|
||||
|
||||
public String getReqHdrFile() {
|
||||
return reqHdrFile;
|
||||
}
|
||||
|
||||
public void setReqHdrFile(String reqHdrFile) {
|
||||
this.reqHdrFile = reqHdrFile;
|
||||
}
|
||||
|
||||
public String getReqBodyFile() {
|
||||
return reqBodyFile;
|
||||
}
|
||||
|
||||
public void setReqBodyFile(String reqBodyFile) {
|
||||
this.reqBodyFile = reqBodyFile;
|
||||
}
|
||||
|
||||
public String getResHdrFile() {
|
||||
return resHdrFile;
|
||||
}
|
||||
|
||||
public void setResHdrFile(String resHdrFile) {
|
||||
this.resHdrFile = resHdrFile;
|
||||
}
|
||||
|
||||
public String getResBodyFile() {
|
||||
return resBodyFile;
|
||||
}
|
||||
|
||||
public void setResBodyFile(String resBodyFile) {
|
||||
this.resBodyFile = resBodyFile;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getReqHdrKey() {
|
||||
return reqHdrKey;
|
||||
}
|
||||
|
||||
public void setReqHdrKey(String reqHdrKey) {
|
||||
this.reqHdrKey = reqHdrKey;
|
||||
}
|
||||
|
||||
public String getReqBodyKey() {
|
||||
return reqBodyKey;
|
||||
}
|
||||
|
||||
public void setReqBodyKey(String reqBodyKey) {
|
||||
this.reqBodyKey = reqBodyKey;
|
||||
}
|
||||
|
||||
public String getResHdrKey() {
|
||||
return resHdrKey;
|
||||
}
|
||||
|
||||
public void setResHdrKey(String resHdrKey) {
|
||||
this.resHdrKey = resHdrKey;
|
||||
}
|
||||
|
||||
public String getResBodyKey() {
|
||||
return resBodyKey;
|
||||
}
|
||||
|
||||
public void setResBodyKey(String resBodyKey) {
|
||||
this.resBodyKey = resBodyKey;
|
||||
}
|
||||
|
||||
public String getTopicName() {
|
||||
return topicName;
|
||||
}
|
||||
|
||||
public void setTopicName(String topicName) {
|
||||
this.topicName = topicName;
|
||||
}
|
||||
|
||||
public Integer getMalwareId() {
|
||||
return malwareId;
|
||||
}
|
||||
|
||||
public void setMalwareId(Integer malwareId) {
|
||||
this.malwareId = malwareId;
|
||||
}
|
||||
|
||||
public String getMalwareType() {
|
||||
return malwareType;
|
||||
}
|
||||
|
||||
public void setMalwareType(String malwareType) {
|
||||
this.malwareType = malwareType;
|
||||
}
|
||||
|
||||
public String getMalwareName() {
|
||||
return malwareName;
|
||||
}
|
||||
|
||||
public void setMalwareName(String malwareName) {
|
||||
this.malwareName = malwareName;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -795,4 +795,9 @@ public final class Constants {
|
||||
* 管理员用户预警查询服务配置总量接口
|
||||
*/
|
||||
public static final String CONFIG_BY_SERVICE = Configurations.getStringProperty("getConfigByService","");
|
||||
/**
|
||||
* 文件扫描结果接口
|
||||
*/
|
||||
public static final String NTC_HTTP_OBJSCAN_RESULT_LOGS = Configurations.getStringProperty("ntcHttpObjscanResultLogs","");
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,175 @@
|
||||
package com.nis.web.controller.log.ntc;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import com.nis.domain.FunctionServiceDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.PageLog;
|
||||
import com.nis.domain.SysUser;
|
||||
import com.nis.domain.log.NtcHttpObjScanResultLog;
|
||||
import com.nis.domain.maat.LogRecvData;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.LogUtils;
|
||||
import com.nis.util.httpclient.HttpClientUtil;
|
||||
import com.nis.web.controller.BaseController;
|
||||
import com.nis.web.security.UserUtils;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("${adminPath}/log/ntc/httpObjScanResult")
|
||||
public class HttpObjScanResultLogController extends BaseController {
|
||||
|
||||
@RequestMapping(value = { "list", "" })
|
||||
public String list(@ModelAttribute("log") NtcHttpObjScanResultLog log, Model model, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
try {
|
||||
PageLog<NtcHttpObjScanResultLog> page = new PageLog<NtcHttpObjScanResultLog>(request, response);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
if (StringUtils.isNotBlank(log.getUrl())) {
|
||||
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
|
||||
params.put("searchUrl", httpurl);
|
||||
}
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getdPort())) {
|
||||
params.put("searchDPort", log.getdPort());
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getsPort())) {
|
||||
params.put("searchSPort", log.getsPort());
|
||||
}
|
||||
if (null != log.getDeviceId()) {
|
||||
params.put("searchDeviceId", log.getDeviceId());
|
||||
}
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_HTTP_OBJSCAN_RESULT_LOGS;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
|
||||
Gson gson = new GsonBuilder().create();
|
||||
|
||||
LogRecvData<NtcHttpObjScanResultLog> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcHttpObjScanResultLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcHttpObjScanResultLog> data = fromJson.getData();
|
||||
page.setCount(data.getCount());
|
||||
page.setLast(data.getLast());
|
||||
page.setList(data.getList());
|
||||
List<NtcHttpObjScanResultLog> list = page.getList();
|
||||
for (NtcHttpObjScanResultLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
model.addAttribute("page", page);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("查询失败", e);
|
||||
addMessageLog(model, e.getMessage());
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
|
||||
return "/log/ntc/httpObjScanResultList";
|
||||
}
|
||||
|
||||
// 文件离线扫描结果 导出
|
||||
@RequestMapping(value = "exportHttpObjScanResult")
|
||||
public void exportHttpObjScanResult(@ModelAttribute("log") NtcHttpObjScanResultLog log, Model model, String hColumns, String type,
|
||||
HttpServletRequest request, HttpServletResponse response, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
// export data info
|
||||
List<String> titleList = new ArrayList<String>();
|
||||
Map<String, Class<?>> classMap = new HashMap<String, Class<?>>();
|
||||
Map<String, List> dataMap = new HashMap<String, List>();
|
||||
Map<String, String> noExportMap = new HashMap<String, String>();
|
||||
// ---------------------------
|
||||
PageLog<NtcHttpObjScanResultLog> page = new PageLog<NtcHttpObjScanResultLog>(request, response);
|
||||
page.setPageNo(1);
|
||||
page.setPageSize(Constants.MAX_LOG_EXPORT_SIZE);
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("pageSize", page.getPageSize());
|
||||
params.put("pageNo", page.getPageNo());
|
||||
if (StringUtils.isNotBlank(log.getUrl())) {
|
||||
String httpurl = StringEscapeUtils.unescapeHtml(log.getUrl());
|
||||
params.put("searchUrl", httpurl);
|
||||
}
|
||||
initLogSearchValue(log, params);
|
||||
|
||||
if (StringUtils.isNotBlank(log.getdPort())) {
|
||||
params.put("searchDport", log.getdPort());
|
||||
}
|
||||
if (StringUtils.isNotBlank(log.getsPort())) {
|
||||
params.put("searchSport", log.getsPort());
|
||||
}
|
||||
if (null != log.getDeviceId()) {
|
||||
params.put("searchDeviceId", log.getDeviceId());
|
||||
}
|
||||
|
||||
List<FunctionServiceDict> serviceList = DictUtils.getFunctionServiceDictList(log.getFunctionId());
|
||||
model.addAttribute("serviceList", serviceList);
|
||||
|
||||
String url = Constants.LOG_BASE_URL + Constants.NTC_HTTP_OBJSCAN_RESULT_LOGS;
|
||||
String recv = HttpClientUtil.getMsg(url, params, request);
|
||||
List<NtcHttpObjScanResultLog> list = new ArrayList<NtcHttpObjScanResultLog>();
|
||||
if (StringUtils.isNotBlank(recv)) {
|
||||
Gson gson = new GsonBuilder().create();
|
||||
LogRecvData<NtcHttpObjScanResultLog> fromJson = gson.fromJson(recv,
|
||||
new TypeToken<LogRecvData<NtcHttpObjScanResultLog>>() {
|
||||
}.getType());
|
||||
if (fromJson.getStatus().intValue() == 200) {
|
||||
Page<NtcHttpObjScanResultLog> data = fromJson.getData();
|
||||
list = data.getList();
|
||||
}
|
||||
}
|
||||
for (NtcHttpObjScanResultLog l : list) {
|
||||
l.setFunctionId(log.getFunctionId());
|
||||
setLogAction(l, serviceList);
|
||||
}
|
||||
titleList.add("http_obj_scan_result");
|
||||
classMap.put("http_obj_scan_result", NtcHttpObjScanResultLog.class);
|
||||
SysUser user = UserUtils.getUser();
|
||||
if (!user.isAdmin()) {
|
||||
hColumns += ",scene_file,";
|
||||
} else {
|
||||
hColumns += ",";
|
||||
}
|
||||
String cfgIndexInfoNoExport = ",action,cfg_id,"
|
||||
+ hColumns;
|
||||
noExportMap.put("http_obj_scan_result", cfgIndexInfoNoExport);
|
||||
dataMap.put("http_obj_scan_result", list);
|
||||
String timeRange = initLogMap(log, "http_obj_scan_result");
|
||||
noExportMap.put("timeRange", timeRange);
|
||||
if ("csv".equals(type)) {
|
||||
this._exportCsv(model, request, response, redirectAttributes, "http_obj_scan_result", titleList, classMap,
|
||||
dataMap, noExportMap);
|
||||
} else {
|
||||
this._export(model, request, response, redirectAttributes, "http_obj_scan_result", titleList, classMap, dataMap,
|
||||
noExportMap);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.error("http_obj_scan_result export failed", e);
|
||||
addMessage(redirectAttributes, "error", "export_failed");
|
||||
LogUtils.saveLog(request, null, e, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user