提交 9064ac43 authored 作者: yangli's avatar yangli

.

上级 d505d615
...@@ -27,8 +27,10 @@ import javax.servlet.http.HttpServletResponse; ...@@ -27,8 +27,10 @@ import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull; import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern; import javax.validation.constraints.Pattern;
import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStreamReader;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -234,10 +236,23 @@ public class ProgramController { ...@@ -234,10 +236,23 @@ public class ProgramController {
log.warn("未获取到MAC地址"); log.warn("未获取到MAC地址");
return; return;
} }
// 已安装软件列表
List<String> programNames = installedProgramCache.getPrograms() List<String> programNames = installedProgramCache.getPrograms()
.stream().map(p -> p.get("name")).sorted().collect(Collectors.toList()); .stream().map(p -> p.get("name")).sorted().collect(Collectors.toList());
// 扫描进程列表
Set<String> processNames = new HashSet<>();
Process process = Runtime.getRuntime().exec("cmd /c tasklist /fo csv");
try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream(), "GBK"))) {
String line;
while ((line = reader.readLine()) != null) processNames.add(line.substring(1, line.indexOf("\",\"")));
process.destroy();
}
HttpUtil.post(gateway + addProgramUrl, HttpUtil.post(gateway + addProgramUrl,
JSONUtil.createObj().set("macAddress", mac).set("programList", programNames).toString()); JSONUtil.createObj()
.set("macAddress", mac)
.set("programList", programNames)
.set("processList", processNames)
.toString());
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论