From 5fec46feeb00efcad33f8ba1628d22cdb7e095af Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E8=B4=B0=E6=8B=BE=E5=A3=B9?=
<30471543+er10yi@users.noreply.github.com>
Date: Wed, 8 Sep 2021 17:33:29 +0800
Subject: [PATCH] Delete center directory
---
center/Dockerfile | 4 -
center/pom.xml | 199 ---
.../com/tiji/center/ApplicationConfig.java | 30 -
.../com/tiji/center/CenterApplication.java | 36 -
.../tiji/center/MonitorApplicationRunner.java | 266 ----
.../com/tiji/center/WebSecurityConfig.java | 28 -
.../com/tiji/center/aspect/AssessAspect.java | 36 -
.../com/tiji/center/aspect/WebLogAspect.java | 48 -
.../center/controller/AgentController.java | 122 --
.../center/controller/AssetipController.java | 475 ------
.../controller/AssetportController.java | 350 -----
.../controller/BaseExceptionHandler.java | 48 -
.../controller/CategorysecondController.java | 154 --
.../controller/CategorytopController.java | 139 --
.../center/controller/CharController.java | 245 ----
.../controller/CheckresultController.java | 317 ----
.../controller/CheckresultVulnController.java | 159 --
.../center/controller/ContactController.java | 140 --
.../ContactProjectinfoController.java | 163 ---
.../center/controller/CronjobController.java | 228 ---
.../center/controller/DemocodeController.java | 149 --
.../controller/DepartmentController.java | 240 ----
.../DictionarypasswordController.java | 196 ---
.../DictionaryusernameController.java | 197 ---
.../controller/DomainwhitelistController.java | 174 ---
.../center/controller/HostController.java | 263 ----
.../controller/ImvulnnotifyController.java | 284 ----
.../controller/IpportwhitelistController.java | 142 --
.../controller/IpwhitelistController.java | 307 ----
.../center/controller/LoginController.java | 149 --
.../controller/NmapconfigController.java | 149 --
.../controller/NotifylogController.java | 121 --
.../controller/PluginCheckerController.java | 36 -
.../PluginassetserviceController.java | 148 --
.../PluginassetversionController.java | 143 --
.../controller/PluginconfigController.java | 438 ------
.../center/controller/ProjectController.java | 130 --
.../controller/ProjectinfoController.java | 459 ------
.../ProjectportwhitelistController.java | 140 --
.../ProjectvulnnotifyController.java | 109 --
.../center/controller/RiskportController.java | 182 ---
.../controller/RiskserviceController.java | 181 ---
.../controller/RiskversionController.java | 182 ---
.../controller/SendmailconfigController.java | 109 --
.../center/controller/SolutionController.java | 148 --
.../controller/StatisticsController.java | 109 --
.../center/controller/TaskController.java | 377 -----
.../center/controller/TaskipController.java | 152 --
.../TaskpluginconfigController.java | 227 ---
.../center/controller/TaskportController.java | 165 ---
.../controller/TitlewhitelistController.java | 183 ---
.../tiji/center/controller/UrlController.java | 166 ---
.../center/controller/UserController.java | 155 --
.../controller/UseragentController.java | 202 ---
.../center/controller/VulnController.java | 362 -----
.../controller/VulnkeywordController.java | 158 --
.../VulnpluginconfigController.java | 180 ---
.../center/controller/WebinfoController.java | 231 ---
.../java/com/tiji/center/dao/AgentDao.java | 29 -
.../java/com/tiji/center/dao/AssetipDao.java | 62 -
.../com/tiji/center/dao/AssetportDao.java | 61 -
.../tiji/center/dao/CategorysecondDao.java | 24 -
.../com/tiji/center/dao/CategorytopDao.java | 22 -
.../com/tiji/center/dao/CheckresultDao.java | 29 -
.../tiji/center/dao/CheckresultVulnDao.java | 25 -
.../java/com/tiji/center/dao/ContactDao.java | 24 -
.../center/dao/ContactProjectinfoDao.java | 32 -
.../java/com/tiji/center/dao/CronjobDao.java | 14 -
.../java/com/tiji/center/dao/DemocodeDao.java | 26 -
.../com/tiji/center/dao/DepartmentDao.java | 23 -
.../center/dao/DictionarypasswordDao.java | 27 -
.../center/dao/DictionaryusernameDao.java | 27 -
.../tiji/center/dao/DomainwhitelistDao.java | 26 -
.../java/com/tiji/center/dao/HostDao.java | 34 -
.../com/tiji/center/dao/ImvulnnotifyDao.java | 14 -
.../tiji/center/dao/IpportwhitelistDao.java | 28 -
.../com/tiji/center/dao/IpwhitelistDao.java | 29 -
.../com/tiji/center/dao/NmapconfigDao.java | 25 -
.../com/tiji/center/dao/NotifylogDao.java | 21 -
.../center/dao/PluginassetserviceDao.java | 32 -
.../center/dao/PluginassetversionDao.java | 34 -
.../com/tiji/center/dao/PluginconfigDao.java | 28 -
.../java/com/tiji/center/dao/ProjectDao.java | 28 -
.../com/tiji/center/dao/ProjectinfoDao.java | 36 -
.../center/dao/ProjectportwhitelistDao.java | 28 -
.../tiji/center/dao/ProjectvulnnotifyDao.java | 14 -
.../java/com/tiji/center/dao/RiskportDao.java | 24 -
.../com/tiji/center/dao/RiskserviceDao.java | 23 -
.../com/tiji/center/dao/RiskversionDao.java | 24 -
.../tiji/center/dao/SendmailconfigDao.java | 14 -
.../java/com/tiji/center/dao/SolutionDao.java | 26 -
.../com/tiji/center/dao/StatisticsDao.java | 103 --
.../java/com/tiji/center/dao/TaskDao.java | 33 -
.../java/com/tiji/center/dao/TaskipDao.java | 171 ---
.../tiji/center/dao/TaskpluginconfigDao.java | 35 -
.../java/com/tiji/center/dao/TaskportDao.java | 34 -
.../tiji/center/dao/TitlewhitelistDao.java | 26 -
.../main/java/com/tiji/center/dao/UrlDao.java | 29 -
.../java/com/tiji/center/dao/UserDao.java | 23 -
.../com/tiji/center/dao/UseragentDao.java | 27 -
.../java/com/tiji/center/dao/VulnDao.java | 23 -
.../com/tiji/center/dao/VulnkeywordDao.java | 29 -
.../tiji/center/dao/VulnpluginconfigDao.java | 28 -
.../java/com/tiji/center/dao/WebinfoDao.java | 27 -
.../MasterDataSourceConfiguration.java | 58 -
.../center/dispatcher/TargetIpSlicer.java | 203 ---
.../exception/AssessDeniedException.java | 15 -
.../exception/ExpiredTokenException.java | 15 -
.../exception/IllegalTokenException.java | 15 -
.../tiji/center/exception/LoginException.java | 16 -
.../com/tiji/center/filter/JwtFilter.java | 95 --
.../java/com/tiji/center/mq/IMReceiver.java | 113 --
.../tiji/center/mq/ScanResultReceiver.java | 385 -----
.../main/java/com/tiji/center/pojo/Agent.java | 97 --
.../java/com/tiji/center/pojo/Assetip.java | 183 ---
.../java/com/tiji/center/pojo/Assetport.java | 202 ---
.../com/tiji/center/pojo/Categorysecond.java | 58 -
.../com/tiji/center/pojo/Categorytop.java | 48 -
.../com/tiji/center/pojo/Checkresult.java | 161 ---
.../com/tiji/center/pojo/CheckresultVuln.java | 58 -
.../java/com/tiji/center/pojo/Contact.java | 77 -
.../tiji/center/pojo/ContactProjectinfo.java | 58 -
.../java/com/tiji/center/pojo/Cronjob.java | 62 -
.../java/com/tiji/center/pojo/Democode.java | 68 -
.../java/com/tiji/center/pojo/Department.java | 48 -
.../tiji/center/pojo/Dictionarypassword.java | 49 -
.../tiji/center/pojo/Dictionaryusername.java | 49 -
.../com/tiji/center/pojo/Domainwhitelist.java | 48 -
.../main/java/com/tiji/center/pojo/Host.java | 150 --
.../com/tiji/center/pojo/Imvulnnotify.java | 166 ---
.../com/tiji/center/pojo/Ipportwhitelist.java | 78 -
.../com/tiji/center/pojo/Ipwhitelist.java | 68 -
.../java/com/tiji/center/pojo/Nmapconfig.java | 68 -
.../java/com/tiji/center/pojo/Notifylog.java | 109 --
.../tiji/center/pojo/Pluginassetservice.java | 58 -
.../tiji/center/pojo/Pluginassetversion.java | 58 -
.../com/tiji/center/pojo/Pluginconfig.java | 106 --
.../java/com/tiji/center/pojo/Project.java | 50 -
.../com/tiji/center/pojo/Projectinfo.java | 121 --
.../center/pojo/Projectportwhitelist.java | 77 -
.../tiji/center/pojo/Projectvulnnotify.java | 41 -
.../java/com/tiji/center/pojo/Riskport.java | 50 -
.../com/tiji/center/pojo/Riskservice.java | 48 -
.../com/tiji/center/pojo/Riskversion.java | 48 -
.../com/tiji/center/pojo/Sendmailconfig.java | 137 --
.../java/com/tiji/center/pojo/Solution.java | 78 -
.../java/com/tiji/center/pojo/Statistics.java | 296 ----
.../main/java/com/tiji/center/pojo/Task.java | 280 ----
.../java/com/tiji/center/pojo/Taskip.java | 78 -
.../tiji/center/pojo/Taskpluginconfig.java | 59 -
.../java/com/tiji/center/pojo/Taskport.java | 118 --
.../com/tiji/center/pojo/Titlewhitelist.java | 48 -
.../main/java/com/tiji/center/pojo/Url.java | 68 -
.../main/java/com/tiji/center/pojo/User.java | 85 --
.../java/com/tiji/center/pojo/Useragent.java | 48 -
.../main/java/com/tiji/center/pojo/Vuln.java | 98 --
.../com/tiji/center/pojo/Vulnkeyword.java | 58 -
.../tiji/center/pojo/Vulnpluginconfig.java | 58 -
.../java/com/tiji/center/pojo/Webinfo.java | 212 ---
.../AgentHeartbeatMonitorScheduler.java | 142 --
.../center/schedule/AssetNotifyScheduler.java | 356 -----
.../schedule/ExecuteCheckTaskScheduler.java | 33 -
.../ExecuteTotalCheckTaskScheduler.java | 33 -
.../schedule/ExecuteWorkTaskScheduler.java | 56 -
.../schedule/MidnightTaskScheduler.java | 66 -
.../center/schedule/StatisticsScheduler.java | 90 --
.../schedule/TaskStatusMonitorScheduler.java | 144 --
.../center/schedule/VulnNotifyScheduler.java | 389 -----
.../center/schedule/quartz/QuartzJob.java | 57 -
.../schedule/quartz/QuartzJobService.java | 110 --
.../com/tiji/center/service/AgentService.java | 197 ---
.../tiji/center/service/AssetipService.java | 361 -----
.../tiji/center/service/AssetportService.java | 406 ------
.../center/service/CategorysecondService.java | 187 ---
.../center/service/CategorytopService.java | 154 --
.../center/service/CheckresultService.java | 283 ----
.../service/CheckresultVulnService.java | 176 ---
.../service/ContactProjectinfoService.java | 195 ---
.../tiji/center/service/ContactService.java | 168 ---
.../tiji/center/service/CronjobService.java | 148 --
.../tiji/center/service/DemocodeService.java | 172 ---
.../center/service/DepartmentService.java | 154 --
.../service/DictionarypasswordService.java | 163 ---
.../service/DictionaryusernameService.java | 162 ---
.../service/DomainwhitelistService.java | 171 ---
.../com/tiji/center/service/HostService.java | 257 ----
.../center/service/ImvulnnotifyService.java | 162 ---
.../service/IpportwhitelistService.java | 213 ---
.../center/service/IpwhitelistService.java | 181 ---
.../center/service/NmapconfigService.java | 186 ---
.../tiji/center/service/NotifylogService.java | 181 ---
.../service/PluginassetserviceService.java | 197 ---
.../service/PluginassetversionService.java | 198 ---
.../center/service/PluginconfigService.java | 209 ---
.../tiji/center/service/ProjectService.java | 169 ---
.../center/service/ProjectinfoService.java | 263 ----
.../service/ProjectportwhitelistService.java | 195 ---
.../service/ProjectvulnnotifyService.java | 133 --
.../tiji/center/service/RiskportService.java | 153 --
.../center/service/RiskserviceService.java | 155 --
.../center/service/RiskversionService.java | 154 --
.../center/service/SendmailconfigService.java | 170 ---
.../tiji/center/service/SolutionService.java | 175 ---
.../center/service/StatisticsService.java | 498 -------
.../center/service/TaskDispatcherService.java | 973 -------------
.../com/tiji/center/service/TaskService.java | 387 -----
.../tiji/center/service/TaskipService.java | 342 -----
.../service/TaskpluginconfigService.java | 218 ---
.../tiji/center/service/TaskportService.java | 251 ----
.../center/service/TitlewhitelistService.java | 159 --
.../com/tiji/center/service/UrlService.java | 217 ---
.../com/tiji/center/service/UserService.java | 198 ---
.../tiji/center/service/UseragentService.java | 172 ---
.../com/tiji/center/service/VulnService.java | 205 ---
.../center/service/VulnkeywordService.java | 196 ---
.../service/VulnpluginconfigService.java | 207 ---
.../tiji/center/service/WebinfoService.java | 244 ----
.../tiji/center/thread/DNSResolveThread.java | 50 -
.../com/tiji/center/util/HostNameUtil.java | 149 --
.../java/com/tiji/center/util/JwtUtil.java | 67 -
.../java/com/tiji/center/util/NotifyUtil.java | 343 -----
.../java/com/tiji/center/util/TijiHelper.java | 1275 -----------------
.../com/tiji/center/util/WhitelistUtil.java | 142 --
center/src/main/resources/logback-spring.xml | 162 ---
224 files changed, 31708 deletions(-)
delete mode 100755 center/Dockerfile
delete mode 100755 center/pom.xml
delete mode 100755 center/src/main/java/com/tiji/center/ApplicationConfig.java
delete mode 100755 center/src/main/java/com/tiji/center/CenterApplication.java
delete mode 100755 center/src/main/java/com/tiji/center/MonitorApplicationRunner.java
delete mode 100755 center/src/main/java/com/tiji/center/WebSecurityConfig.java
delete mode 100755 center/src/main/java/com/tiji/center/aspect/AssessAspect.java
delete mode 100755 center/src/main/java/com/tiji/center/aspect/WebLogAspect.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/AgentController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/AssetipController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/AssetportController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/BaseExceptionHandler.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/CategorysecondController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/CategorytopController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/CharController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/CheckresultController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/CheckresultVulnController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/ContactController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/ContactProjectinfoController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/CronjobController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/DemocodeController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/DepartmentController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/DictionarypasswordController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/DictionaryusernameController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/DomainwhitelistController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/HostController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/ImvulnnotifyController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/IpportwhitelistController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/IpwhitelistController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/LoginController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/NmapconfigController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/NotifylogController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/PluginCheckerController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/PluginassetserviceController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/PluginassetversionController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/PluginconfigController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/ProjectController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/ProjectinfoController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/ProjectportwhitelistController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/ProjectvulnnotifyController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/RiskportController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/RiskserviceController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/RiskversionController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/SendmailconfigController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/SolutionController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/StatisticsController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/TaskController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/TaskipController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/TaskpluginconfigController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/TaskportController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/TitlewhitelistController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/UrlController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/UserController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/UseragentController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/VulnController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/VulnkeywordController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/VulnpluginconfigController.java
delete mode 100755 center/src/main/java/com/tiji/center/controller/WebinfoController.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/AgentDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/AssetipDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/AssetportDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/CategorysecondDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/CategorytopDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/CheckresultDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/CheckresultVulnDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/ContactDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/ContactProjectinfoDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/CronjobDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/DemocodeDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/DepartmentDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/DictionarypasswordDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/DictionaryusernameDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/DomainwhitelistDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/HostDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/ImvulnnotifyDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/IpportwhitelistDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/IpwhitelistDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/NmapconfigDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/NotifylogDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/PluginassetserviceDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/PluginassetversionDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/PluginconfigDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/ProjectDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/ProjectinfoDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/ProjectportwhitelistDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/ProjectvulnnotifyDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/RiskportDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/RiskserviceDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/RiskversionDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/SendmailconfigDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/SolutionDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/StatisticsDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/TaskDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/TaskipDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/TaskpluginconfigDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/TaskportDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/TitlewhitelistDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/UrlDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/UserDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/UseragentDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/VulnDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/VulnkeywordDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/VulnpluginconfigDao.java
delete mode 100755 center/src/main/java/com/tiji/center/dao/WebinfoDao.java
delete mode 100755 center/src/main/java/com/tiji/center/datasource/MasterDataSourceConfiguration.java
delete mode 100755 center/src/main/java/com/tiji/center/dispatcher/TargetIpSlicer.java
delete mode 100755 center/src/main/java/com/tiji/center/exception/AssessDeniedException.java
delete mode 100755 center/src/main/java/com/tiji/center/exception/ExpiredTokenException.java
delete mode 100755 center/src/main/java/com/tiji/center/exception/IllegalTokenException.java
delete mode 100755 center/src/main/java/com/tiji/center/exception/LoginException.java
delete mode 100755 center/src/main/java/com/tiji/center/filter/JwtFilter.java
delete mode 100755 center/src/main/java/com/tiji/center/mq/IMReceiver.java
delete mode 100755 center/src/main/java/com/tiji/center/mq/ScanResultReceiver.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Agent.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Assetip.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Assetport.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Categorysecond.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Categorytop.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Checkresult.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/CheckresultVuln.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Contact.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/ContactProjectinfo.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Cronjob.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Democode.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Department.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Dictionarypassword.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Dictionaryusername.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Domainwhitelist.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Host.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Imvulnnotify.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Ipportwhitelist.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Ipwhitelist.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Nmapconfig.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Notifylog.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Pluginassetservice.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Pluginassetversion.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Pluginconfig.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Project.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Projectinfo.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Projectportwhitelist.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Projectvulnnotify.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Riskport.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Riskservice.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Riskversion.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Sendmailconfig.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Solution.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Statistics.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Task.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Taskip.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Taskpluginconfig.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Taskport.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Titlewhitelist.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Url.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/User.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Useragent.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Vuln.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Vulnkeyword.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Vulnpluginconfig.java
delete mode 100755 center/src/main/java/com/tiji/center/pojo/Webinfo.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/AgentHeartbeatMonitorScheduler.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/AssetNotifyScheduler.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/ExecuteCheckTaskScheduler.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/ExecuteTotalCheckTaskScheduler.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/ExecuteWorkTaskScheduler.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/MidnightTaskScheduler.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/StatisticsScheduler.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/TaskStatusMonitorScheduler.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/VulnNotifyScheduler.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/quartz/QuartzJob.java
delete mode 100755 center/src/main/java/com/tiji/center/schedule/quartz/QuartzJobService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/AgentService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/AssetipService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/AssetportService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/CategorysecondService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/CategorytopService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/CheckresultService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/CheckresultVulnService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/ContactProjectinfoService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/ContactService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/CronjobService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/DemocodeService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/DepartmentService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/DictionarypasswordService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/DictionaryusernameService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/DomainwhitelistService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/HostService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/ImvulnnotifyService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/IpportwhitelistService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/IpwhitelistService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/NmapconfigService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/NotifylogService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/PluginassetserviceService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/PluginassetversionService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/PluginconfigService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/ProjectService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/ProjectinfoService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/ProjectportwhitelistService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/ProjectvulnnotifyService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/RiskportService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/RiskserviceService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/RiskversionService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/SendmailconfigService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/SolutionService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/StatisticsService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/TaskDispatcherService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/TaskService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/TaskipService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/TaskpluginconfigService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/TaskportService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/TitlewhitelistService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/UrlService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/UserService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/UseragentService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/VulnService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/VulnkeywordService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/VulnpluginconfigService.java
delete mode 100755 center/src/main/java/com/tiji/center/service/WebinfoService.java
delete mode 100755 center/src/main/java/com/tiji/center/thread/DNSResolveThread.java
delete mode 100755 center/src/main/java/com/tiji/center/util/HostNameUtil.java
delete mode 100755 center/src/main/java/com/tiji/center/util/JwtUtil.java
delete mode 100755 center/src/main/java/com/tiji/center/util/NotifyUtil.java
delete mode 100755 center/src/main/java/com/tiji/center/util/TijiHelper.java
delete mode 100755 center/src/main/java/com/tiji/center/util/WhitelistUtil.java
delete mode 100755 center/src/main/resources/logback-spring.xml
diff --git a/center/Dockerfile b/center/Dockerfile
deleted file mode 100755
index 9fe921f..0000000
--- a/center/Dockerfile
+++ /dev/null
@@ -1,4 +0,0 @@
-FROM openjdk
-ENTRYPOINT ["java", "-jar", "/centerapp.jar"]
-ARG JAR_FILE
-ADD ${JAR_FILE} /centerapp.jar
\ No newline at end of file
diff --git a/center/pom.xml b/center/pom.xml
deleted file mode 100755
index 793994a..0000000
--- a/center/pom.xml
+++ /dev/null
@@ -1,199 +0,0 @@
-
- 4.0.0
-
- com.tiji
- MagiCude
- 1.0-SNAPSHOT
-
- center
-
-
- 15
-
- 192.168.12.138:5000
- 1.4.13
- 8.0.22
- 3.11
- 0.9.1
- 4.1.2
- 4.1.2
- 1.2.4
- 1.3.8.1
- 4.5.13
- 2.8.6
- 3.2.2
- 0.9.3
-
-
-
- centerapp
-
-
-
-
-
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
- org.apache.maven.plugins
- maven-deploy-plugin
-
- true
-
-
-
-
- com.spotify
- dockerfile-maven-plugin
- ${dockerfile-maven-plugin.version}
-
-
- default
-
-
- build
- push
-
-
-
-
- ${docker.repository}/${project.artifactId}
- ${project.version}
-
-
- target/${project.build.finalName}.jar
-
-
-
-
-
-
-
-
-
-
- com.tiji
- common
- 1.0-SNAPSHOT
- compile
-
-
- org.springframework.boot
- spring-boot-starter-data-jpa
-
-
-
-
-
-
-
-
-
-
-
-
-
- mysql
- mysql-connector-java
- ${mysql-connector-java.version}
-
-
-
-
- org.springframework.boot
- spring-boot-starter-data-redis
-
-
-
- org.apache.commons
- commons-lang3
- ${commons-lang3.version}
-
-
-
- org.springframework.cloud
- spring-cloud-starter-netflix-eureka-client
-
-
- org.springframework.boot
- spring-boot-starter-amqp
-
-
-
- io.jsonwebtoken
- jjwt
- ${jjwt.version}
-
-
-
- org.springframework.boot
- spring-boot-starter-quartz
-
-
- org.springframework.boot
- spring-boot-starter-aop
-
-
-
- org.apache.poi
- poi
- ${poi.version}
-
-
-
- org.apache.poi
- poi-ooxml
- ${poi-ooxml.version}
-
-
- org.springframework.boot
- spring-boot-starter-mail
-
-
-
- com.alibaba
- druid-spring-boot-starter
- ${druid-spring-boot-starter.version}
-
-
-
- com.github.eagle6688
- devutility.internal
- ${devutility.internal.version}
- provided
-
-
- org.apache.httpcomponents
- httpclient
- ${httpclient.version}
-
-
-
- com.google.code.gson
- gson
- ${gson.version}
-
-
-
- dnsjava
- dnsjava
- ${dnsjava.version}
-
-
-
- org.roaringbitmap
- RoaringBitmap
- ${RoaringBitmap.version}
-
-
-
-
diff --git a/center/src/main/java/com/tiji/center/ApplicationConfig.java b/center/src/main/java/com/tiji/center/ApplicationConfig.java
deleted file mode 100755
index 534c401..0000000
--- a/center/src/main/java/com/tiji/center/ApplicationConfig.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.tiji.center;
-
-import com.tiji.center.filter.JwtFilter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author 贰拾壹
- * @create 2019-09-05 15:29
- */
-@Configuration
-public class ApplicationConfig extends WebMvcConfigurationSupport {
-
- @Autowired
- private JwtFilter jwtFilter;
-
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- //拦截所有请求
- String[] addPathPatterns = {"/**"};
- //不需要拦截的请求
- String[] excludePathPatterns = {"/user/login", "/pluginchecker"};
- registry.addInterceptor(jwtFilter).addPathPatterns(addPathPatterns).excludePathPatterns(excludePathPatterns);
- }
-}
diff --git a/center/src/main/java/com/tiji/center/CenterApplication.java b/center/src/main/java/com/tiji/center/CenterApplication.java
deleted file mode 100755
index 9f9d8f7..0000000
--- a/center/src/main/java/com/tiji/center/CenterApplication.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.tiji.center;
-
-import com.tiji.center.util.JwtUtil;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
-import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
-import org.springframework.context.annotation.Bean;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import util.IdWorker;
-
-@SpringBootApplication
-@EnableEurekaClient
-public class CenterApplication {
-
- public static void main(String[] args) {
- //解决邮件附件名过长被截断的问题
- System.getProperties().setProperty("mail.mime.splitlongparameters", "false");
- SpringApplication.run(CenterApplication.class, args);
- }
-
- @Bean
- public IdWorker idWorker() {
- return new IdWorker(1, 1);
- }
-
- @Bean
- public JwtUtil jwtUtil() {
- return new JwtUtil();
- }
-
- @Bean
- public BCryptPasswordEncoder bCryptPasswordEncoder() {
- return new BCryptPasswordEncoder();
- }
-}
diff --git a/center/src/main/java/com/tiji/center/MonitorApplicationRunner.java b/center/src/main/java/com/tiji/center/MonitorApplicationRunner.java
deleted file mode 100755
index ebfb17f..0000000
--- a/center/src/main/java/com/tiji/center/MonitorApplicationRunner.java
+++ /dev/null
@@ -1,266 +0,0 @@
-package com.tiji.center;
-
-import com.tiji.center.pojo.Cronjob;
-import com.tiji.center.pojo.Task;
-import com.tiji.center.schedule.*;
-import com.tiji.center.schedule.quartz.QuartzJob;
-import com.tiji.center.schedule.quartz.QuartzJobService;
-import com.tiji.center.service.*;
-import com.tiji.center.util.TijiHelper;
-import org.quartz.Job;
-import org.quartz.JobKey;
-import org.quartz.SchedulerException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.amqp.rabbit.core.RabbitMessagingTemplate;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.ApplicationArguments;
-import org.springframework.boot.ApplicationRunner;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Component;
-import org.xbill.DNS.Record;
-import org.xbill.DNS.*;
-import util.ExcpUtil;
-import util.IdWorker;
-
-import java.io.IOException;
-import java.net.*;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-
-/**
- * @author 贰拾壹
- * 启动时运行的方法
- * @create 2019-09-30 10:15
- */
-@Component
-public class MonitorApplicationRunner implements ApplicationRunner {
- private final static Logger logger = LoggerFactory.getLogger(MonitorApplicationRunner.class);
- @Autowired
- private QuartzJobService quartzJobService;
- @Autowired
- private TaskService taskService;
- @Autowired
- private CronjobService cronjobService;
- @Autowired
- private DictionaryusernameService dictionaryusernameService;
- @Autowired
- private DictionarypasswordService dictionarypasswordService;
- @Autowired
- private UseragentService useragentService;
- @Autowired
- private RedisTemplate redisTemplate;
- @Autowired
- private IdWorker idWorker;
-
- @Override
- public void run(ApplicationArguments args) {
-
- try {
- //设置Http辅助验证关键词
- setHttpValidateKey();
-
- //刷新redis中的用户名密码字典
- freshDictUsernameRedisCache();
- //刷新redis中的UserAgent
- freshUserAgentRedisCache();
-
- //每10秒,监控所有任务状态
- Cronjob taskStatusMonitor = cronjobService.findByName("任务状态监控");
- if (!Objects.isNull(taskStatusMonitor.getCronexpression()) && !taskStatusMonitor.getCronexpression().isEmpty()) {
- runScheduler(taskStatusMonitor.getCronexpression(), TaskStatusMonitorScheduler.class);
- }
-
- //每5分钟,监控agent心跳包
- Cronjob agentHeartbeatMonitor = cronjobService.findByName("agent心跳包监控");
- if (!Objects.isNull(agentHeartbeatMonitor.getCronexpression()) && !agentHeartbeatMonitor.getCronexpression().isEmpty()) {
- runScheduler(agentHeartbeatMonitor.getCronexpression(), AgentHeartbeatMonitorScheduler.class);
- }
- //凌晨3点,凌晨执行的所有任务都丢这里
- //dns解析获取hostname
- //nse结果获取hostname
- //根据ip更新白名单
- //根据项目更新白名单
- Cronjob midnightTask = cronjobService.findByName("每天执行一次的任务");
- if (!Objects.isNull(midnightTask.getCronexpression()) && !midnightTask.getCronexpression().isEmpty()) {
- runScheduler(midnightTask.getCronexpression(), MidnightTaskScheduler.class);
- }
- //早上7:33,发资产报告
- Cronjob assetNotify = cronjobService.findByName("邮件资产报告");
- if (!Objects.isNull(assetNotify.getCronexpression()) && !assetNotify.getCronexpression().isEmpty()) {
- runScheduler(assetNotify.getCronexpression(), AssetNotifyScheduler.class);
- }
- //早上7:03,发漏洞报告
- Cronjob vulnNotify = cronjobService.findByName("邮件漏洞报告");
- if (!Objects.isNull(vulnNotify.getCronexpression()) && !vulnNotify.getCronexpression().isEmpty()) {
- runScheduler(vulnNotify.getCronexpression(), VulnNotifyScheduler.class);
- }
- //早上6点,统计报表数据
- Cronjob statistics = cronjobService.findByName("统计报表数据");
- if (!Objects.isNull(statistics.getCronexpression()) && !statistics.getCronexpression().isEmpty()) {
- runScheduler(statistics.getCronexpression(), StatisticsScheduler.class);
- }
- //默认每30秒,取IM消息,并调用钉钉,企微群机器人发送
- Cronjob imNotify = cronjobService.findByName("IM通知");
- runScheduler(imNotify.getCronexpression(), IMNotifyScheduler.class);
-
- //恢复所有非子任务的cron任务
- resumeCronTask();
-
- //dns辅助验证
- try {
- startDNSServer();
- } catch (SocketException e) {
- logger.error("startDNSServer Exception here: " + ExcpUtil.buildErrorMessage(e));
- }
- } catch (Exception e) {
- logger.error("MonitorApplicationRunner Exception here: " + ExcpUtil.buildErrorMessage(e));
- }
- }
-
- private void resumeCronTask() throws SchedulerException {
- //查询所有非子任务的cron任务
- List cronTaskList = taskService.findAllByCrontaskIsTrueAndTaskparentidIsNull();
- for (Task task : cronTaskList) {
- String taskId = task.getId();
- String worktype = task.getWorktype();
- String taskTargetIp = task.getTargetip();
- String taskWorkType = task.getWorktype();
-
- if (!Objects.isNull(worktype) && !worktype.isEmpty()) {
- String cronExpression = task.getCronexpression();
- if (!Objects.isNull(cronExpression) && !cronExpression.isEmpty()) {
- String jobKeyName = "jobKeyName_" + taskId;
- String jobKeyGroup = "jobKeyGroup_" + taskId;
- JobKey jobKey = JobKey.jobKey(jobKeyName, jobKeyGroup);
- if ("mass".equals(worktype) || "mass2Nmap".equals(worktype) || "nmap".equals(worktype)) {
- Map jobDataMap = new HashMap<>();
- jobDataMap.put("taskId", taskId);
- jobDataMap.put("taskTargetIp", taskTargetIp);
- jobDataMap.put("taskWorkType", taskWorkType);
- //jobDataMap.put("taskInfo", taskInfo);
-
- QuartzJob quartzJob = new QuartzJob(jobKey, cronExpression, jobDataMap, ExecuteWorkTaskScheduler.class);
- quartzJobService.scheduleJob(quartzJob);
- }
- boolean checkTask = "nse".equals(worktype) || "selfd".equals(worktype) || "httpp".equals(worktype);
- if (checkTask) {
- Map jobDataMap = new HashMap<>();
- jobDataMap.put("taskId", taskId);
-
- if ("assetip".equals(task.getTargetip())) {
- QuartzJob quartzJob = new QuartzJob(jobKey, cronExpression, jobDataMap, ExecuteTotalCheckTaskScheduler.class);
- quartzJobService.scheduleJob(quartzJob);
- } else {
- QuartzJob quartzJob = new QuartzJob(jobKey, cronExpression, jobDataMap, ExecuteCheckTaskScheduler.class);
- quartzJobService.scheduleJob(quartzJob);
- }
-
- }
- }
- }
- }
- }
-
- private void runScheduler(String cronExpression, Class extends Job> jobClass) throws SchedulerException {
- String jobKeyName = "jobKeyName_" + jobClass.getSimpleName();
- String jobKeyGroup = "jobKeyGroup_" + jobClass.getSimpleName();
- JobKey jobKey = JobKey.jobKey(jobKeyName, jobKeyGroup);
- QuartzJob quartzJob = new QuartzJob(jobKey, cronExpression, null, jobClass);
- quartzJobService.scheduleJob(quartzJob);
-
- }
-
- /**
- * 设置用户名密码字典
- */
- private void freshDictUsernameRedisCache() {
- String redisDictUsername = "dictUsernameList_";
- String redisDictPassword = "dictPasswordList_";
- redisTemplate.delete(redisDictUsername);
- redisTemplate.delete(redisDictPassword);
- List allUsername = dictionaryusernameService.findAllUsername();
- List allPassword = dictionarypasswordService.findAllPassword();
- if (!allUsername.isEmpty()) {
- redisTemplate.opsForList().leftPushAll(redisDictUsername, allUsername);
- }
- if (!allPassword.isEmpty()) {
- redisTemplate.opsForList().leftPushAll(redisDictPassword, allPassword);
- }
- }
-
- /**
- * 设置ua
- */
- private void freshUserAgentRedisCache() {
-// String redisUserAgent = "userAgentList_";
- String redisUserAgent = "userAgentSet_";
- redisTemplate.delete(redisUserAgent);
- List allUserAgent = useragentService.findAllDistinctUserAgentList();
- allUserAgent.parallelStream().forEach(ua -> redisTemplate.opsForSet().add(redisUserAgent, ua));
-// if (!allUserAgent.isEmpty()) {
-// redisTemplate.opsForList().leftPushAll(redisUserAgent, allUserAgent);
-// }
- }
-
-
- /**
- * 设置Http辅助验证关键词
- */
- private void setHttpValidateKey() {
- redisTemplate.opsForValue().set("HttpValidateKey_", idWorker.nextId() + "");
- }
-
- /**
- * 启动DNS辅助验证服务
- */
- private void startDNSServer() throws SocketException {
- DatagramSocket socket = new DatagramSocket(53);
- new Thread(() -> {
- InetAddress sourceIpAddr;
- int sourcePort;
- while (true) {
- try {
- byte[] buffer = new byte[1024];
- DatagramPacket request = new DatagramPacket(buffer, buffer.length);
- socket.receive(request);
- sourceIpAddr = request.getAddress();
- sourcePort = request.getPort();
- Message message = new Message(request.getData());
- Record question = message.getQuestion();
- String domain = question.getName().toString();
- logger.info("============= DNS Query Start =================");
- logger.info("sourceIpAddr: " + sourceIpAddr);
- logger.info("sourcePort: " + sourcePort);
- logger.info("message: " + message);
- logger.info("question: " + question);
- logger.info("domain: " + domain);
- logger.info("============= DNS Query End =================");
- try {
- //正常域名
- sendResponse(socket, sourceIpAddr, sourcePort, message, question, Address.getByName(domain));
- } catch (UnknownHostException e) {
- //未知域名,全部指向本机ip,用于selfd插件dns辅助验证自定义域名
- sendResponse(socket, sourceIpAddr, sourcePort, message, question, InetAddress.getLocalHost());
- }
- } catch (IOException e) {
- logger.error("MonitorApplicationRunner DNSServer Exception: " + ExcpUtil.buildErrorMessage(e));
- }
- }
- }).start();
-
- }
-
- private void sendResponse(DatagramSocket socket, InetAddress targetIp, int targetPort, Message message, Record record, InetAddress inetAddress) throws IOException {
- Record answer = new ARecord(record.getName(), record.getDClass(), 64, inetAddress);
- message.getHeader().setFlag(Flags.AA);
- message.getHeader().setFlag(Flags.QR);
- message.addRecord(answer, Section.ANSWER);
- byte[] buffer = message.toWire();
- DatagramPacket response = new DatagramPacket(buffer, buffer.length, targetIp, targetPort);
- socket.send(response);
- }
-}
diff --git a/center/src/main/java/com/tiji/center/WebSecurityConfig.java b/center/src/main/java/com/tiji/center/WebSecurityConfig.java
deleted file mode 100755
index fb68447..0000000
--- a/center/src/main/java/com/tiji/center/WebSecurityConfig.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.tiji.center;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-import org.springframework.security.config.http.SessionCreationPolicy;
-
-/**
- * @author 贰拾壹
- * @create 2019-09-05 14:31
- */
-@Configuration
-@EnableWebSecurity
-public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http
- .csrf().disable()
- .httpBasic().disable()
- .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS)
- .and()
- .authorizeRequests()
- //所有资源允许匿名访问,权限校验由jwtFilter进行
- .antMatchers("/**").permitAll()
- .anyRequest().authenticated();
- }
-}
diff --git a/center/src/main/java/com/tiji/center/aspect/AssessAspect.java b/center/src/main/java/com/tiji/center/aspect/AssessAspect.java
deleted file mode 100755
index 6aa7044..0000000
--- a/center/src/main/java/com/tiji/center/aspect/AssessAspect.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package com.tiji.center.aspect;
-
-import com.tiji.center.exception.AssessDeniedException;
-import io.jsonwebtoken.Claims;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.annotation.Pointcut;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * @author 贰拾壹
- * @create 2020-05-09 11:12
- */
-@Aspect
-@Component
-public class AssessAspect {
- @Autowired
- private HttpServletRequest request;
-
- //用户管理需要管理员权限
- @Pointcut("execution(public * com.tiji.center.controller.UserController.*(..))")
- public void controllerUser() {
- }
-
- @Before("controllerUser()")
- public void beforeUserController() {
- Claims claims = (Claims) request.getAttribute("admin_claims");
- if (claims == null) {
- //没有权限
- throw new AssessDeniedException("无权访问");
- }
- }
-}
diff --git a/center/src/main/java/com/tiji/center/aspect/WebLogAspect.java b/center/src/main/java/com/tiji/center/aspect/WebLogAspect.java
deleted file mode 100755
index beaefaf..0000000
--- a/center/src/main/java/com/tiji/center/aspect/WebLogAspect.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.tiji.center.aspect;
-
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Before;
-import org.aspectj.lang.annotation.Pointcut;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import org.springframework.web.context.request.RequestAttributes;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.Arrays;
-
-/**
- * @author 贰拾壹
- * @create 2019-10-11 10:29
- */
-@Aspect
-@Component
-public class WebLogAspect {
- private final static Logger logger = LoggerFactory.getLogger(WebLogAspect.class);
-
- //controller日志记录
- @Pointcut("execution(public * com.tiji.center.controller.*.*(..))")//切入点描述 这个是controller包的切入点
- public void controllerLog() {
- }
-
- @Before("controllerLog()") //在切入点的方法run之前要干的
- public void logBeforeController(JoinPoint joinPoint) {
-
- RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();//这个RequestContextHolder是Springmvc提供来获得请求的东西
- assert requestAttributes != null;
- HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();
-
- logger.info(
- request.getRemoteAddr() + " " +
- request.getMethod() + " " +
- request.getRequestURI() + " " +
- request.getHeader("User-Agent") + " " +
- request.getHeader("Referer") + " " +
- Arrays.toString(joinPoint.getArgs()) + " " +
- joinPoint.getSignature().getDeclaringTypeName() + "." + joinPoint.getSignature().getName()
- );
- }
-}
diff --git a/center/src/main/java/com/tiji/center/controller/AgentController.java b/center/src/main/java/com/tiji/center/controller/AgentController.java
deleted file mode 100755
index 85bd8d4..0000000
--- a/center/src/main/java/com/tiji/center/controller/AgentController.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package com.tiji.center.controller;
-
-import com.tiji.center.pojo.Agent;
-import com.tiji.center.service.AgentService;
-import entity.PageResult;
-import entity.Result;
-import entity.StatusCode;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * agent控制器层
- *
- * @author 贰拾壹
- */
-@RestController
-@CrossOrigin
-@RequestMapping("/agent")
-public class AgentController {
-
- @Autowired
- private AgentService agentService;
-
-
- /**
- * 查询全部数据
- *
- * @return
- */
- @GetMapping
- public Result findAll() {
- return new Result(true, StatusCode.OK, "查询成功", agentService.findAll());
- }
-
- /**
- * 根据ID查询
- *
- * @param id ID
- * @return
- */
- @GetMapping(value = "/{id}")
- public Result findById(@PathVariable String id) {
- return new Result(true, StatusCode.OK, "查询成功", agentService.findById(id));
- }
-
-
- /**
- * 分页+多条件查询
- *
- * @param searchMap 查询条件封装
- * @param page 页码
- * @param size 页大小
- * @return 分页结果
- */
- @PostMapping(value = "/search/{page}/{size}")
- public Result findSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size) {
- Page pageList = agentService.findSearch(searchMap, page, size);
- return new Result(true, StatusCode.OK, "查询成功", new PageResult<>(pageList.getTotalElements(), pageList.getContent()));
- }
-
- /**
- * 根据条件查询
- *
- * @param searchMap
- * @return
- */
- @PostMapping(value = "/search")
- public Result findSearch(@RequestBody Map searchMap) {
- return new Result(true, StatusCode.OK, "查询成功", agentService.findSearch(searchMap));
- }
-
- /**
- * 增加
- *
- * @param agent
- */
- @PostMapping
- public Result add(@RequestBody Agent agent) {
- agentService.add(agent);
- return new Result(true, StatusCode.OK, "增加成功");
- }
-
- /**
- * 修改
- *
- * @param agent
- */
- @PutMapping(value = "/{id}")
- public Result update(@RequestBody Agent agent, @PathVariable String id) {
- agent.setId(id);
- agentService.update(agent);
- return new Result(true, StatusCode.OK, "修改成功");
- }
-
- /**
- * 删除
- *
- * @param id
- */
- @DeleteMapping(value = "/{id}")
- public Result delete(@PathVariable String id) {
- agentService.deleteById(id);
- return new Result(true, StatusCode.OK, "删除成功");
- }
-
-
- /**
- * 根据ids批量删除
- *
- * @param ids
- */
- @PostMapping(value = "/deleteids")
- public Result deleteAllByIds(@RequestBody List ids) {
- agentService.deleteAllByIds(ids);
- return new Result(true, StatusCode.OK, "删除成功");
- }
-
-}
diff --git a/center/src/main/java/com/tiji/center/controller/AssetipController.java b/center/src/main/java/com/tiji/center/controller/AssetipController.java
deleted file mode 100755
index 63e534b..0000000
--- a/center/src/main/java/com/tiji/center/controller/AssetipController.java
+++ /dev/null
@@ -1,475 +0,0 @@
-package com.tiji.center.controller;
-
-import com.tiji.center.pojo.*;
-import com.tiji.center.pojo.category.CategoryTab;
-import com.tiji.center.service.*;
-import com.tiji.center.util.TijiHelper;
-import entity.PageResult;
-import entity.Result;
-import entity.StatusCode;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import util.IdWorker;
-import util.IpRange2Ips;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.util.*;
-
-/**
- * assetip控制器层
- *
- * @author 贰拾壹
- */
-@RestController
-@CrossOrigin
-@RequestMapping("/assetip")
-public class AssetipController {
-
- @Autowired
- private AssetipService assetipService;
- @Autowired
- private AssetportService assetportService;
- @Autowired
- private IdWorker idWorker;
- @Autowired
- private HostService hostService;
-
- @Autowired
- private CheckresultService checkresultService;
- @Autowired
- private CheckresultVulnService checkresultVulnService;
- @Autowired
- private WebinfoService webinfoService;
- @Autowired
- private UrlService urlService;
- @Autowired
- private ProjectinfoService projectinfoService;
- @Autowired
- private WebrawdataService webrawdataService;
- @Autowired
- private RedisTemplate redisTemplate;
- @Autowired
- private CategoryTabService categoryTabService;
- @Autowired
- private AssetipAppsysHostdomainService assetipAppsysHostdomainService;
- @Autowired
- private AppsystemService appsystemService;
- private String categoryCacheKey = "categoryTabCache";
- private String categoryIdNameKey = "categoryTabIdNameCache";
-
- /**
- * 查询全部数据
- *
- * @return
- */
- @GetMapping
- public Result findAll() {
- return new Result(true, StatusCode.OK, "查询成功", assetipService.findAll());
- }
-
- /**
- * 根据ID查询
- *
- * @param id ID
- * @return
- */
- @GetMapping(value = "/{id}")
- public Result findById(@PathVariable String id) {
- Assetip assetip = assetipService.findById(id);
- String projectinfoid = assetip.getProjectinfoid();
- if (!StringUtils.isEmpty(projectinfoid)) {
- Projectinfo projectinfo = projectinfoService.findById(projectinfoid);
- assetip.setProjectname(projectinfo.getProjectname());
- }
-
- String tabbitmap = assetip.getTabbitmap();
- List categoryTabList = new ArrayList<>();
- if (!StringUtils.isEmpty(tabbitmap)) {
- List resultList = new ArrayList<>();
- String[] splitTabs = tabbitmap.split(",");
- if (redisTemplate.hasKey(categoryIdNameKey)) {
- for (String tabid : splitTabs) {
- resultList.add((String) redisTemplate.opsForHash().get(categoryIdNameKey, tabid));
- }
- } else {
- for (String tabid : splitTabs) {
- CategoryTab categoryTab = categoryTabService.findById(Long.parseLong(tabid));
- if (!Objects.isNull(categoryTab)) {
- String categoryTabName = categoryTab.getName();
- if (!StringUtils.isEmpty(categoryTabName)) {
- resultList.add(categoryTabName);
- }
- }
- }
- }
- for (String tabid : splitTabs) {
- CategoryTab categoryTab = categoryTabService.findById(Long.parseLong(tabid));
- categoryTabList.add(categoryTab);
- }
- assetip.setTabname(String.valueOf(resultList).replaceAll("[\\[\\]]", ""));
- }
-
- StringBuilder appsysNameBuilder = new StringBuilder();
- List hostdomainList = assetipAppsysHostdomainService.findByAssetipid(id);
- for (AssetipAppsysHostdomain hostdomain : hostdomainList) {
- String appsysid = hostdomain.getAppsysid();
- if (!StringUtils.isEmpty(appsysid)) {
- Appsystem appsystem = appsystemService.findById(appsysid);
- if (!Objects.isNull(appsystem)) {
- String appsystemName = appsystem.getName();
- appsysNameBuilder.append(appsystemName).append(",");
- }
- }
- }
- assetip.setAppsysname(appsysNameBuilder.toString());
-
- assetip.setTabList(categoryTabList);
- return new Result(true, StatusCode.OK, "查询成功", assetip);
- }
-
- /**
- * 分页+多条件查询
- *
- * @param searchMap 查询条件封装
- * @param page 页码
- * @param size 页大小
- * @return 分页结果
- */
- @PostMapping(value = "/search/{page}/{size}")
- public Result findSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size) {
- Page pageList = assetipService.findSearch(searchMap, page, size);
- Map idNameMap = new HashMap<>();
- pageList.stream().parallel().forEach(assetip -> {
- String projectinfoid = assetip.getProjectinfoid();
- if (!StringUtils.isEmpty(projectinfoid)) {
- Projectinfo projectinfo = projectinfoService.findById(projectinfoid);
- if (!Objects.isNull(projectinfo)) {
- assetip.setProjectname(projectinfo.getProjectname());
- }
- }
- String assetipId = assetip.getId();
-
- List countResultList = assetipService.findCountByIds(Collections.singletonList(assetipId));
- String ipaddressv4 = assetip.getIpaddressv4();
- if (!StringUtils.isEmpty(ipaddressv4)) {
- assetip.setIpaddressv4(ipaddressv4);
- }
- if (!"0:0:0:0".equals(countResultList.get(0))) {
- assetip.setStatistic(countResultList.get(0));
- } else {
- assetip.setIpaddressv4(ipaddressv4);
- }
- String tabbitmap = assetip.getTabbitmap();
- if (!StringUtils.isEmpty(tabbitmap)) {
- List resultList = new ArrayList<>();
- String[] splitTabs = tabbitmap.split(",");
- if (redisTemplate.hasKey(categoryIdNameKey)) {
- for (String id : splitTabs) {
- resultList.add((String) redisTemplate.opsForHash().get(categoryIdNameKey, id));
- }
- } else {
- for (String id : splitTabs) {
- CategoryTab categoryTab = categoryTabService.findById(Long.parseLong(id));
- if (!Objects.isNull(categoryTab)) {
- String categoryTabName = categoryTab.getName();
- if (!StringUtils.isEmpty(categoryTabName)) {
- resultList.add(categoryTabName);
- idNameMap.put(id, categoryTabName);
- }
- }
- }
- }
- assetip.setTabname(String.valueOf(resultList).replaceAll("[\\[\\]]", ""));
- }
- });
- if (!idNameMap.isEmpty()) {
- redisTemplate.opsForHash().putAll(categoryIdNameKey, idNameMap);
- }
- return new Result(true, StatusCode.OK, "查询成功", new PageResult<>(pageList.getTotalElements(), pageList.getContent()));
- }
-
- /**
- * 根据条件查询
- *
- * @param searchMap
- * @return
- */
- @PostMapping(value = "/search")
- public Result findSearch(@RequestBody Map searchMap) {
- return new Result(true, StatusCode.OK, "查询成功", assetipService.findSearch(searchMap));
- }
-
- /**
- * 增加
- *
- * @param assetip
- */
- @PostMapping
- public Result add(@RequestBody Assetip assetip) {
- if (Objects.isNull(assetip.getPassivetime())) {
- String ipaddressv4 = assetip.getIpaddressv4();
- Assetip assetipInDb = assetipService.findByIpaddressv4AndPassivetimeIsNull(ipaddressv4);
- if (Objects.isNull(assetipInDb)) {
- assetipService.add(assetip);
- return new Result(true, StatusCode.OK, "增加成功");
- } else {
- return new Result(false, StatusCode.ERROR, "增加失败:ip重复");
- }
- } else {
- return new Result(false, StatusCode.ERROR, "增加失败:无法直接新增已下线ip,请直接将资产ip下线");
- }
- }
-
- /**
- * 修改
- *
- * @param assetip
- */
- @PutMapping(value = "/{id}")
- public Result update(@RequestBody Assetip assetip, @PathVariable String id) {
- assetip.setId(id);
- String sourceTabbitMap = assetip.getTabbitmap();
- if (!StringUtils.isEmpty(sourceTabbitMap)) {
- String[] strings = sourceTabbitMap.split(",");
- Set set = new TreeSet<>(Arrays.asList(strings));
- assetip.setTabbitmap(set.toString().replaceAll("[\\[\\]\\s]", ""));
- }
- assetipService.update(assetip);
- return new Result(true, StatusCode.OK, "修改成功");
- }
-
- /**
- * 删除
- * 资产ip, 资产端口, 主机信息, 位置信息, 漏洞检测结果, web信息, url信息
- *
- * @param id
- */
-
- @DeleteMapping(value = "/{id}")
- public Result delete(@PathVariable String id) {
- assetipService.deleteById(id);
- //删除中间表
- assetipAppsysHostdomainService.deleteAllByAssetipid(id);
- //删除资产端口
- List assetportList = assetportService.deleteAllByAssetipid(id);
- //删除主机信息
- hostService.deleteAllByAssetipid(id);
- assetportList.forEach(assetport -> {
- String assetportId = assetport.getId();
- //删除漏洞检测结果
- List checkresultList = checkresultService.deleteAllByAssetportid(assetportId);
- //删除web信息
- List webinfoList = webinfoService.deleteAllByPortid(assetportId);
- checkresultList.forEach(checkresult -> {
- String checkresultId = checkresult.getId();
- //删除检测结果的同时,删除中间表关联
- checkresultVulnService.deleteAllByCheckresultid(checkresultId);
- });
- //删除url信息
- webinfoList.forEach(webinfo -> {
- String webinfoId = webinfo.getId();
- //删除原始响应和头信息
- webrawdataService.deleteAllByWebinfoid(webinfoId);
- urlService.deleteAllByWebinfoid(webinfoId);
- });
- });
- return new Result(true, StatusCode.OK, "删除成功");
- }
-
- /**
- * 批量导入ip端口
- */
- @PostMapping(value = "/batchAdd")
- public Result batchAdd(@RequestParam("file") MultipartFile file) {
- if (Objects.isNull(file) || file.getSize() == 0) {
- return new Result(false, StatusCode.ERROR, "文件为空");
- }
- long fileSize = file.getSize();
- if (fileSize / 1024 / 1024 > 3) {
- return new Result(false, StatusCode.ERROR, "文件大小不能超过 3M");
- }
- String fileContentType = file.getContentType();
- assert fileContentType != null;
- if (!fileContentType.equals("text/plain")) {
- return new Result(false, StatusCode.ERROR, "文件只能是 txt 格式");
- }
- String fileOriginalFilename = file.getOriginalFilename();
- assert fileOriginalFilename != null;
- String suffix = fileOriginalFilename.substring(fileOriginalFilename.lastIndexOf(".") + 1);
- if (!suffix.equals("txt")) {
- return new Result(false, StatusCode.ERROR, "文件只能是 txt 格式");
- }
-
- Map> resultMap = new LinkedHashMap<>();
- String line;
- Date date = new Date();
- Set ipSet = new HashSet<>();
- try (BufferedReader bf = new BufferedReader(new InputStreamReader(file.getInputStream(), StandardCharsets.UTF_8));) {
- while ((line = bf.readLine()) != null) {
- //有端口
- if (line.contains("[[")) {
- line = line.replaceAll("\\[\\[", "@");
- line = line.replaceAll("],\\s?\\[", "!");
- line = line.replaceAll("]]", "");
- String ipp = line.split("@")[0];
- String servers = line.split("@")[1];
- List serverList = Arrays.asList(servers.split("!"));
- Set resultSet = new HashSet<>(serverList);
- if (resultMap.containsKey(ipp)) {
- Set set = resultMap.get(ipp);
- set.addAll(resultSet);
- resultMap.put(ipp, set);
- } else {
- resultMap.put(ipp, resultSet);
- }
- } else {
- //20201012 新增 增加无端口的ip导入格式
- //没有端口,新增ip
- ipSet.addAll(IpRange2Ips.genIp(line));
- }
-
- }
- } catch (IOException ignored) {
- }
- if (!resultMap.isEmpty()) {
- TijiHelper.batchNmapScanResult2AssetDB(assetipService, assetportService, hostService, idWorker, resultMap);
- }
- if (!ipSet.isEmpty()) {
- ipSet.forEach(ip -> {
- Assetip assetip = assetipService.findByIpaddressv4AndPassivetimeIsNull(ip);
- String assetipId;
- //ip不存在,新增
- if (Objects.isNull(assetip)) {
- assetipId = idWorker.nextId() + "";
- assetipService.add(new Assetip(assetipId, null, ip, null, false, false, date, null, null));
- }
- });
- }
- return new Result(true, StatusCode.OK, "ip端口已上传处理,请稍后查看");
-
- }
-
- /**
- * 根据ids数组查询
- *
- * @param ids
- * @return
- */
- @PostMapping(value = "/ids")
- public Result findByAssetIpIds(@RequestBody String[] ids) {
- return new Result(true, StatusCode.OK, "查询成功", assetipService.findByIds(ids));
- }
-
- /**
- * 批量导入部门ip
- */
- @RequestMapping(value = "/projectinfoip/batchAdd", method = RequestMethod.POST)
- public Result batchAddProjectinfoIp(@RequestParam("file") MultipartFile file) {
- if (Objects.isNull(file) || file.getSize() == 0) {
- return new Result(false, StatusCode.ERROR, "文件为空");
- }
- long fileSize = file.getSize();
- if (fileSize / 1024 / 1024 > 3) {
- return new Result(false, StatusCode.ERROR, "文件大小不能超过 3M");
- }
- String fileContentType = file.getContentType();
- assert fileContentType != null;
- if (!fileContentType.equals("text/plain")) {
- return new Result(false, StatusCode.ERROR, "文件只能是 txt 格式");
- }
- String fileOriginalFilename = file.getOriginalFilename();
- assert fileOriginalFilename != null;
- String suffix = fileOriginalFilename.substring(fileOriginalFilename.lastIndexOf(".") + 1);
- if (!suffix.equals("txt")) {
- return new Result(false, StatusCode.ERROR, "文件只能是 txt 格式");
- }
-
- String line;
- //20201012 优化 去除bf.close,bf放到try中
- try (BufferedReader bf = new BufferedReader(new InputStreamReader(file.getInputStream(), StandardCharsets.UTF_8))) {
- Date date = new Date();
- while ((line = bf.readLine()) != null) {
- String projectinfoName = line.split("\\|")[0];
- String ipRange = line.split("\\|")[1];
- Projectinfo projectinfo = projectinfoService.findByProjectname(projectinfoName);
- String projectInfoId;
- if (Objects.isNull(projectinfo)) {
- projectInfoId = idWorker.nextId() + "";
- projectinfoService.add(new Projectinfo(projectInfoId, null, projectinfoName, false, false, date, false));
- } else {
- projectInfoId = projectinfo.getId();
- }
-
- Set ipSet = IpRange2Ips.genIp(ipRange);
- ipSet.forEach(ip -> {
- Assetip assetip = assetipService.findByIpaddressv4AndPassivetimeIsNull(ip);
- String assetipId;
- //System.out.println(projectInfoId + " = " + ip);
- //20201012 移除 移除如果ip不存在,会新增
- //ip不存在,新增
- if (Objects.isNull(assetip)) {
- //assetipId = idWorker.nextId() + "";
- //assetipService.add(new Assetip(assetipId, projectInfoId, ip, null, false, false, date, null, null));
- } else {
- //ip存在
- //projectInfoId = assetip.getProjectinfoid();
- //没有项目信息
- if (Objects.isNull(assetip.getProjectinfoid()) || assetip.getProjectinfoid().isEmpty()) {
- assetip.setProjectinfoid(projectInfoId);
- assetipService.update(assetip);
- }
- }
- });
- }
- } catch (IOException ignored) {
- }
-
- return new Result(true, StatusCode.OK, "项目信息ip已上传处理,请稍后查看");
- }
-
- /**
- * 根据ids批量删除
- *
- * @param ids
- */
- @PostMapping(value = "/deleteids")
- public Result deleteAllByIds(@RequestBody List ids) {
- assetipService.deleteAllByIds(ids);
- ids.forEach(id -> {
- //删除中间表
- assetipAppsysHostdomainService.deleteAllByAssetipid(id);
- //删除资产端口
- List assetportList = assetportService.deleteAllByAssetipid(id);
- //删除主机信息
- hostService.deleteAllByAssetipid(id);
- assetportList.forEach(assetport -> {
- String assetportId = assetport.getId();
- //删除漏洞检测结果
- List checkresultList = checkresultService.deleteAllByAssetportid(assetportId);
- //删除web信息
- List webinfoList = webinfoService.deleteAllByPortid(assetportId);
- checkresultList.forEach(checkresult -> {
- String checkresultId = checkresult.getId();
- //删除检测结果的同时,删除中间表关联
- checkresultVulnService.deleteAllByCheckresultid(checkresultId);
- });
- //删除url信息
- webinfoList.forEach(webinfo -> {
- String webinfoId = webinfo.getId();
- //删除原始响应和头信息
- webrawdataService.deleteAllByWebinfoid(webinfoId);
- urlService.deleteAllByWebinfoid(webinfoId);
- });
- });
- });
- return new Result(true, StatusCode.OK, "删除成功");
- }
-
-}
diff --git a/center/src/main/java/com/tiji/center/controller/AssetportController.java b/center/src/main/java/com/tiji/center/controller/AssetportController.java
deleted file mode 100755
index 4f1979e..0000000
--- a/center/src/main/java/com/tiji/center/controller/AssetportController.java
+++ /dev/null
@@ -1,350 +0,0 @@
-package com.tiji.center.controller;
-
-import com.tiji.center.pojo.*;
-import com.tiji.center.pojo.category.CategoryTab;
-import com.tiji.center.service.*;
-import entity.PageResult;
-import entity.Result;
-import entity.StatusCode;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.util.StringUtils;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.*;
-
-/**
- * assetport控制器层
- *
- * @author 贰拾壹
- */
-@RestController
-@CrossOrigin
-@RequestMapping("/assetport")
-public class AssetportController {
-
- @Autowired
- private AssetportService assetportService;
-
- @Autowired
- private AssetipService assetipService;
-
- @Autowired
- private CheckresultService checkresultService;
- @Autowired
- private CheckresultVulnService checkresultVulnService;
- @Autowired
- private WebinfoService webinfoService;
- @Autowired
- private UrlService urlService;
- @Autowired
- private RedisTemplate redisTemplate;
- @Autowired
- private CategoryTabService categoryTabService;
- @Autowired
- private AssetipAppsysHostdomainService assetipAppsysHostdomainService;
- @Autowired
- private AppsystemService appsystemService;
- private String categoryCacheKey = "categoryTabCache";
- private String categoryIdNameKey = "categoryTabIdNameCache";
-
- /**
- * 查询全部数据
- *
- * @return
- */
- @GetMapping
- public Result findAll() {
- return new Result(true, StatusCode.OK, "查询成功", assetportService.findAll());
- }
-
- /**
- * 根据ID查询
- *
- * @param id ID
- * @return
- */
- @GetMapping(value = "/{id}")
- public Result findById(@PathVariable String id) {
- Assetport assetport = assetportService.findById(id);
- String tabbitmap = assetport.getTabbitmap();
- List categoryTabList = new ArrayList<>();
- if (!StringUtils.isEmpty(tabbitmap)) {
- List resultList = new ArrayList<>();
- String[] splitTabs = tabbitmap.split(",");
- if (redisTemplate.hasKey(categoryIdNameKey)) {
- for (String tabid : splitTabs) {
- resultList.add((String) redisTemplate.opsForHash().get(categoryIdNameKey, tabid));
- }
- } else {
- for (String tabid : splitTabs) {
- CategoryTab categoryTab = categoryTabService.findById(Long.parseLong(tabid));
- if (!Objects.isNull(categoryTab)) {
- String categoryTabName = categoryTab.getName();
- if (!StringUtils.isEmpty(categoryTabName)) {
- resultList.add(categoryTabName);
- }
- }
- }
- }
- for (String tabid : splitTabs) {
- CategoryTab categoryTab = categoryTabService.findById(Long.parseLong(tabid));
- categoryTabList.add(categoryTab);
- }
- assetport.setTabname(String.valueOf(resultList).replaceAll("[\\[\\]]", ""));
- }
-
- StringBuilder appsysNameBuilder = new StringBuilder();
- List hostdomainList = assetipAppsysHostdomainService.findByAssetportid(id);
- for (AssetipAppsysHostdomain hostdomain : hostdomainList) {
- String appsysid = hostdomain.getAppsysid();
- if (!StringUtils.isEmpty(appsysid)) {
- Appsystem appsystem = appsystemService.findById(appsysid);
- if (!Objects.isNull(appsystem)) {
- String appsystemName = appsystem.getName();
- appsysNameBuilder.append(appsystemName).append(",");
- }
- }
- }
- assetport.setAppsysname(appsysNameBuilder.toString());
-
-
- assetport.setTabList(categoryTabList);
- return new Result(true, StatusCode.OK, "查询成功", assetport);
- }
-
-
- /**
- * 分页+多条件查询
- *
- * @param searchMap 查询条件封装
- * @param page 页码
- * @param size 页大小
- * @return 分页结果
- */
- @PostMapping(value = "/search/{page}/{size}")
- public Result findSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size) {
- //根据ip查询端口
- List assetipIdList = new ArrayList<>();
- if (searchMap.containsKey("assetip")) {
- //ip -> assetportid
- String ipaddressv4 = (String) searchMap.get("assetip");
- Map ipSearchMap = new HashMap<>();
- ipSearchMap.put("ipaddressv4", ipaddressv4);
- List assetipList = assetipService.findSearch(ipSearchMap);
- assetipList.forEach(ip -> {
- String ipId = ip.getId();
- assetipIdList.add(ipId);
- });
- searchMap.put("assetipid", assetipIdList);
- }
-
-
- Page pageList = assetportService.findSearch(searchMap, page, size);
- Map idNameMap = new HashMap<>();
- pageList.stream().parallel().forEach(assetport -> {
- String assetipid = assetport.getAssetipid();
- if (!StringUtils.isEmpty(assetipid)) {
- Assetip assetip = assetipService.findById(assetipid);
- if (!Objects.isNull(assetip)) {
- assetport.setAssetipid(assetip.getIpaddressv4());
- }
- }
- String assetportId = assetport.getId();
- List countResultList = assetportService.findCountByIds(Collections.singletonList(assetportId));
- String port = assetport.getPort();
- if (!StringUtils.isEmpty(port)) {
- assetport.setPort(port);
- }
- if (!"0:0".equals(countResultList.get(0))) {
- assetport.setStatistic(countResultList.get(0));
- }
-
- String tabbitmap = assetport.getTabbitmap();
- if (!StringUtils.isEmpty(tabbitmap)) {
- List resultList = new ArrayList<>();
- String[] splitTabs = tabbitmap.split(",");
- if (redisTemplate.hasKey(categoryIdNameKey)) {
- for (String id : splitTabs) {
- resultList.add((String) redisTemplate.opsForHash().get(categoryIdNameKey, id));
- }
- } else {
- for (String id : splitTabs) {
- CategoryTab categoryTab = categoryTabService.findById(Long.parseLong(id));
- if (!Objects.isNull(categoryTab)) {
- String categoryTabName = categoryTab.getName();
- if (!StringUtils.isEmpty(categoryTabName)) {
- resultList.add(categoryTabName);
- }
- }
- }
- }
- assetport.setTabname(String.valueOf(resultList).replaceAll("[\\[\\]]", ""));
- }
-
- });
- if (!idNameMap.isEmpty()) {
- redisTemplate.opsForHash().putAll(categoryIdNameKey, idNameMap);
- }
- return new Result(true, StatusCode.OK, "查询成功", new PageResult<>(pageList.getTotalElements(), pageList.getContent()));
- }
-
- /**
- * 根据条件查询
- *
- * @param searchMap
- * @return
- */
- @PostMapping(value = "/search")
- public Result findSearch(@RequestBody Map searchMap) {
- return new Result(true, StatusCode.OK, "查询成功", assetportService.findSearch(searchMap));
- }
-
- /**
- * 增加
- *
- * @param assetport
- */
- @PostMapping
- public Result add(@RequestBody Assetport assetport) {
- if (Objects.isNull(assetport.getDowntime())) {
- String port = assetport.getPort();
- Assetport assetportInDb = assetportService.findByAssetipidAndPortAndDowntimeIsNull(assetport.getAssetipid(), port);
- if (Objects.isNull(assetportInDb)) {
- assetportService.add(assetport);
- return new Result(true, StatusCode.OK, "增加成功");
- } else {
- return new Result(false, StatusCode.ERROR, "增加失败:端口重复");
- }
- } else {
- return new Result(false, StatusCode.ERROR, "增加失败:无法直接新增已关闭端口,请直接将资产端口关闭");
- }
- }
-
- /**
- * 修改
- *
- * @param assetport
- */
- @PutMapping(value = "/{id}")
- public Result update(@RequestBody Assetport assetport, @PathVariable String id) {
- assetport.setId(id);
- String sourceTabbitMap = assetport.getTabbitmap();
- if (!StringUtils.isEmpty(sourceTabbitMap)) {
- String[] strings = sourceTabbitMap.split(",");
- Set set = new TreeSet<>(Arrays.asList(strings));
- assetport.setTabbitmap(set.toString().replaceAll("[\\[\\]\\s]", ""));
- }
- assetportService.update(assetport);
- return new Result(true, StatusCode.OK, "修改成功");
- }
-
-
- /**
- * 删除
- *
- * @param id
- */
- @DeleteMapping(value = "/{id}")
- public Result delete(@PathVariable String id) {
- assetportService.deleteById(id);
- //中间件表置空
- assetportService.updateMiddByAssetportidSetAssetportid2Null(id);
- //删除漏洞检测结果
- List checkresultList = checkresultService.deleteAllByAssetportid(id);
- //删除web信息
- List webinfoList = webinfoService.deleteAllByPortid(id);
- checkresultList.forEach(checkresult -> {
- String checkresultId = checkresult.getId();
- //删除检测结果的同时,删除中间表关联
- checkresultVulnService.deleteAllByCheckresultid(checkresultId);
- });
- //删除url信息
- webinfoList.forEach(webinfo -> {
- String webinfoId = webinfo.getId();
- urlService.deleteAllByWebinfoid(webinfoId);
- });
- return new Result(true, StatusCode.OK, "删除成功");
- }
-
- /**
- * 根据id数组查询
- *
- * @param ids
- * @return
- */
- @PostMapping(value = "/ids")
- public Result findByAssetIpIds(@RequestBody String[] ids) {
- return new Result(true, StatusCode.OK, "查询成功", assetportService.findByIds(ids));
- }
-
- /**
- * 查询service并去重
- *
- * @return List
- */
- @RequestMapping(value = "/service", method = RequestMethod.GET)
- public Result findAllDistinctService() {
- return new Result(true, StatusCode.OK, "查询成功", assetportService.findAllDistinctService());
- }
-
- /**
- * 查询version并去重
- *
- * @return List
- */
- @RequestMapping(value = "/version", method = RequestMethod.GET)
- public Result findAllDistinctVersion() {
- return new Result(true, StatusCode.OK, "查询成功", assetportService.findAllDistinctVersion());
- }
-
- /**
- * 根据assetipid查询
- *
- * @param assetipid assetipid
- * @return
- */
- @RequestMapping(value = "/assetip/{assetipid}", method = RequestMethod.GET)
- public Result findAllByAssetipid(@PathVariable String assetipid) {
- return new Result(true, StatusCode.OK, "查询成功", assetportService.findAllByAssetipid(assetipid));
- }
-
- /**
- * 根据ids批量删除
- *
- * @param ids
- */
- @PostMapping(value = "/deleteids")
- public Result deleteAllByIds(@RequestBody List ids) {
- assetportService.deleteAllByIds(ids);
- ids.forEach(id -> {
- //删除漏洞检测结果
- List checkresultList = checkresultService.deleteAllByAssetportid(id);
- //删除web信息
- List webinfoList = webinfoService.deleteAllByPortid(id);
- checkresultList.forEach(checkresult -> {
- String checkresultId = checkresult.getId();
- //删除检测结果的同时,删除中间表关联
- checkresultVulnService.deleteAllByCheckresultid(checkresultId);
- });
- //删除url信息
- webinfoList.forEach(webinfo -> {
- String webinfoId = webinfo.getId();
- urlService.deleteAllByWebinfoid(webinfoId);
- });
- });
- return new Result(true, StatusCode.OK, "删除成功");
- }
-
- /**
- * 根据id数组查询数量
- *
- * @param countbyids
- * @return
- */
- @RequestMapping(value = "/countbyids", method = RequestMethod.POST)
- public Result findCountByIds(@RequestBody List countbyids) {
- return new Result(true, StatusCode.OK, "查询成功", assetportService.findCountByIds(countbyids));
- }
-}
diff --git a/center/src/main/java/com/tiji/center/controller/BaseExceptionHandler.java b/center/src/main/java/com/tiji/center/controller/BaseExceptionHandler.java
deleted file mode 100755
index c5e9dea..0000000
--- a/center/src/main/java/com/tiji/center/controller/BaseExceptionHandler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.tiji.center.controller;
-
-import entity.Result;
-import entity.StatusCode;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.web.bind.annotation.ControllerAdvice;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.ResponseBody;
-import util.ExcpUtil;
-
-import java.util.Objects;
-
-/**
- * 统一异常处理类
- *
- * @author 贰拾壹
- */
-@ControllerAdvice
-public class BaseExceptionHandler {
- private final static Logger logger = LoggerFactory.getLogger(BaseExceptionHandler.class);
-
- @ExceptionHandler(value = Exception.class)
- @ResponseBody
- public Result error(Exception e) {
- if (!Objects.isNull(e)) {
- logger.error(ExcpUtil.buildErrorMessage(e));
- //e.printStackTrace();
-
- if (e.toString().contains("ObjectAlreadyExistsException")) {
- return new Result(false, StatusCode.REMOTE_ERROR, "cron任务已存在");
- }
- if ("无权访问".equals(e.getMessage())) {
- return new Result(false, StatusCode.ACCESS_ERROR, "无权访问");
- }
- if ("token已过期".equals(e.getMessage())) {
- return new Result(false, StatusCode.TOKEN_EXPIRED_ERROR, "token已过期");
- }
- if ("非法token".equals(e.getMessage())) {
- return new Result(false, StatusCode.ILLEGAL_TOKEN_ERROR, "非法token");
- }
- if ("未登录".equals(e.getMessage())) {
- return new Result(false, StatusCode.ACCESS_ERROR, "未登录");
- }
- }
- return new Result(false, StatusCode.ERROR, "执行出错");
- }
-}
diff --git a/center/src/main/java/com/tiji/center/controller/CategorysecondController.java b/center/src/main/java/com/tiji/center/controller/CategorysecondController.java
deleted file mode 100755
index 4aebb4c..0000000
--- a/center/src/main/java/com/tiji/center/controller/CategorysecondController.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package com.tiji.center.controller;
-
-import com.tiji.center.pojo.Categorysecond;
-import com.tiji.center.pojo.Categorytop;
-import com.tiji.center.service.CategorysecondService;
-import com.tiji.center.service.CategorytopService;
-import entity.PageResult;
-import entity.Result;
-import entity.StatusCode;
-import org.apache.commons.lang.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * categorysecond控制器层
- *
- * @author 贰拾壹
- */
-@RestController
-@CrossOrigin
-@RequestMapping("/categorysecond")
-public class CategorysecondController {
-
- @Autowired
- private CategorysecondService categorysecondService;
- @Autowired
- private CategorytopService categorytopService;
-
- /**
- * 查询全部数据
- *
- * @return
- */
- @GetMapping
- public Result findAll() {
- return new Result(true, StatusCode.OK, "查询成功", categorysecondService.findAll());
- }
-
- /**
- * 根据ID查询
- *
- * @param id ID
- * @return
- */
- @GetMapping(value = "/{id}")
- public Result findById(@PathVariable String id) {
- return new Result(true, StatusCode.OK, "查询成功", categorysecondService.findById(id));
- }
-
-
- /**
- * 分页+多条件查询
- *
- * @param searchMap 查询条件封装
- * @param page 页码
- * @param size 页大小
- * @return 分页结果
- */
- @PostMapping(value = "/search/{page}/{size}")
- public Result findSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size) {
- Page pageList = categorysecondService.findSearch(searchMap, page, size);
- pageList.stream().parallel().forEach(categorysecond -> {
- String categorytopid = categorysecond.getCategorytopid();
- if (!StringUtils.isEmpty(categorytopid)) {
- Categorytop categorytop = categorytopService.findById(categorytopid);
- if (!Objects.isNull(categorytop)) {
- categorysecond.setCategorytopid(categorytop.getName());
- }
- }
- });
- return new Result(true, StatusCode.OK, "查询成功", new PageResult(pageList.getTotalElements(), pageList.getContent()));
- }
-
- /**
- * 根据条件查询
- *
- * @param searchMap
- * @return
- */
- @PostMapping(value = "/search")
- public Result findSearch(@RequestBody Map searchMap) {
- return new Result(true, StatusCode.OK, "查询成功", categorysecondService.findSearch(searchMap));
- }
-
- /**
- * 增加
- *
- * @param categorysecond
- */
- @PostMapping
- public Result add(@RequestBody Categorysecond categorysecond) {
- //categorysecondService.add(categorysecond);
- //return new Result(true, StatusCode.OK,"增加成功");
- String categorysecondName = categorysecond.getName();
- Categorysecond categorysecondInDb = categorysecondService.findByName(categorysecondName);
- if (Objects.isNull(categorysecondInDb)) {
- categorysecondService.add(categorysecond);
- return new Result(true, StatusCode.OK, "增加成功");
- } else {
- return new Result(false, StatusCode.ERROR, "增加失败:二级分类名称重复");
- }
- }
-
- /**
- * 修改
- *
- * @param categorysecond
- */
- @PutMapping(value = "/{id}")
- public Result update(@RequestBody Categorysecond categorysecond, @PathVariable String id) {
- categorysecond.setId(id);
- categorysecondService.update(categorysecond);
- return new Result(true, StatusCode.OK, "修改成功");
- }
-
- /**
- * 删除
- *
- * @param id
- */
- @DeleteMapping(value = "/{id}")
- public Result delete(@PathVariable String id) {
- categorysecondService.deleteById(id);
- return new Result(true, StatusCode.OK, "删除成功");
- }
-
-
- /**
- * 根据ids批量删除
- *
- * @param ids
- */
- @PostMapping(value = "/deleteids")
- public Result deleteAllByIds(@RequestBody List ids) {
- categorysecondService.deleteAllByIds(ids);
- return new Result(true, StatusCode.OK, "删除成功");
- }
-
- /**
- * 根据id数组查询
- *
- * @param ids
- * @return
- */
- @PostMapping(value = "/ids")
- public Result findByCategorysecondIds(@RequestBody String[] ids) {
- return new Result(true, StatusCode.OK, "查询成功", categorysecondService.findByIds(ids));
- }
-}
diff --git a/center/src/main/java/com/tiji/center/controller/CategorytopController.java b/center/src/main/java/com/tiji/center/controller/CategorytopController.java
deleted file mode 100755
index 96a0ef2..0000000
--- a/center/src/main/java/com/tiji/center/controller/CategorytopController.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package com.tiji.center.controller;
-
-import com.tiji.center.pojo.Categorysecond;
-import com.tiji.center.pojo.Categorytop;
-import com.tiji.center.service.CategorysecondService;
-import com.tiji.center.service.CategorytopService;
-import entity.PageResult;
-import entity.Result;
-import entity.StatusCode;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.data.domain.Page;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-
-/**
- * categorytop控制器层
- *
- * @author 贰拾壹
- */
-@RestController
-@CrossOrigin
-@RequestMapping("/categorytop")
-public class CategorytopController {
-
- @Autowired
- private CategorytopService categorytopService;
- @Autowired
- private CategorysecondService categorysecondService;
-
-
- /**
- * 查询全部数据
- *
- * @return
- */
- @GetMapping
- public Result findAll() {
- return new Result(true, StatusCode.OK, "查询成功", categorytopService.findAll());
- }
-
- /**
- * 根据ID查询
- *
- * @param id ID
- * @return
- */
- @GetMapping(value = "/{id}")
- public Result findById(@PathVariable String id) {
- return new Result(true, StatusCode.OK, "查询成功", categorytopService.findById(id));
- }
-
-
- /**
- * 分页+多条件查询
- *
- * @param searchMap 查询条件封装
- * @param page 页码
- * @param size 页大小
- * @return 分页结果
- */
- @PostMapping(value = "/search/{page}/{size}")
- public Result findSearch(@RequestBody Map searchMap, @PathVariable int page, @PathVariable int size) {
- Page pageList = categorytopService.findSearch(searchMap, page, size);
- return new Result(true, StatusCode.OK, "查询成功", new PageResult(pageList.getTotalElements(), pageList.getContent()));
- }
-
- /**
- * 根据条件查询
- *
- * @param searchMap
- * @return
- */
- @PostMapping(value = "/search")
- public Result findSearch(@RequestBody Map searchMap) {
- return new Result(true, StatusCode.OK, "查询成功", categorytopService.findSearch(searchMap));
- }
-
- /**
- * 增加
- *
- * @param categorytop
- */
- @PostMapping
- public Result add(@RequestBody Categorytop categorytop) {
- String categorytopName = categorytop.getName();
- Categorytop categorytopInDb = categorytopService.findByName(categorytopName);
- if (Objects.isNull(categorytopInDb)) {
- categorytopService.add(categorytop);
- return new Result(true, StatusCode.OK, "增加成功");
- } else {
- return new Result(false, StatusCode.ERROR, "增加失败:名称重复");
- }
-
- }
-
- /**
- * 修改
- *
- * @param categorytop
- */
- @PutMapping(value = "/{id}")
- public Result update(@RequestBody Categorytop categorytop, @PathVariable String id) {
- categorytop.setId(id);
- categorytopService.update(categorytop);
- return new Result(true, StatusCode.OK, "修改成功");
- }
-
- /**
- * 删除
- *
- * @param id
- */
- @DeleteMapping(value = "/{id}")
- public Result delete(@PathVariable String id) {
- categorytopService.deleteById(id);
- //同时把second的topid置空
- Categorysecond categorysecond = categorysecondService.findByCategorytopid(id);
- if (!Objects.isNull(categorysecond)) {
- categorysecond.setCategorytopid(null);
- categorysecondService.update(categorysecond);
- }
- return new Result(true, StatusCode.OK, "删除成功");
- }
-
-
- /**
- * 根据ids批量删除
- *
- * @param ids
- */
- @PostMapping(value = "/deleteids")
- public Result deleteAllByIds(@RequestBody List ids) {
- categorysecondService.deleteAllByIds(ids);
- return new Result(true, StatusCode.OK, "删除成功");
- }
-}
diff --git a/center/src/main/java/com/tiji/center/controller/CharController.java b/center/src/main/java/com/tiji/center/controller/CharController.java
deleted file mode 100755
index 8e585fc..0000000
--- a/center/src/main/java/com/tiji/center/controller/CharController.java
+++ /dev/null
@@ -1,245 +0,0 @@
-package com.tiji.center.controller;
-
-import com.tiji.center.service.StatisticsService;
-import entity.Result;
-import entity.StatusCode;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.CrossOrigin;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * char控制器层
- *
- * @author 贰拾壹
- */
-@RestController
-@CrossOrigin
-@RequestMapping("/char")
-public class CharController {
-
- @Autowired
- private StatisticsService statisticsService;
-
- /**
- * 查询ip端口数
- *
- * @return
- */
- @RequestMapping(value = "/ipportcount", method = RequestMethod.GET)
- public Result findIpPortCount() {
- List ipPortCountList = statisticsService.findIpPortCount();
- return getResult(ipPortCountList);
- }
-
- /**
- * 查询未下线ip端口数
- *
- * @return
- */
- @RequestMapping(value = "/ipportcountonline", method = RequestMethod.GET)
- public Result findIpPortCountOnline() {
- List ipPortCountList = statisticsService.findIpPortCountOnline();
- return getResult(ipPortCountList);
- }
-
- public Result getResult(List ipPortCountList) {
- Map singleMap;
- List