MCPcopy Index your code
hub / github.com/HXSecurity/DongTai-agent-java

github.com/HXSecurity/DongTai-agent-java @v1.14.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.14.2 ↗ · + Follow
2,765 symbols 8,315 edges 415 files 519 documented · 19%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

DongTai-agent-java


中文版本(Chinese version)

license Apache-2.0 GitHub stars GitHub forks GitHub Contributors

CI Github Version Release downloads

Project Introduction

Dongtai-agent-java is DongTai Iast's data acquisition tool for Java applications. In a Java application with the iast agent added, the required data is collected by rewriting class bytecode, and then the data is sent to dongtai-OpenAPI service, and then the cloud engine processes the data to determine whether there are security holes.

Dongtai-agent-java consists of agent.jar, dongtai-core-jar, dongtai-spy. Jar and dongtai-servlet.jar:

  • agent.jar It is used to manage agent life cycle and configuration. The life cycle of the Agent includes downloading, installing, starting, stopping, restarting, and uninstalling the agent. Agent configuration includes application startup mode, vulnerability verification mode, whether to enable agent, etc.
  • dongtai-core.jar The main functions of dongtai-core.jar are: bytecode piling, data collection, data preprocessing, data reporting, third-party component management, etc.
  • dongtai-inject.jar It is used to inject into the BootStrap ClassLoader. The data collection method in 'iast-core.jar' is then invoked in the target application.
  • dongtai-servlet.jar It is used to obtain the requests sent by the application and the responses received. It is used for data display and request replay.

Application Scenarios

  • DevOps
  • Security test the application before it goes online
  • Third-party Component Management
  • Code audit
  • 0 Day digging

Quick Start

Please refer to the Quick Start.

Quick Development

  1. Fork the DongTai-agent-java , clone your fork:

git clone https://github.com/<your-username>/DongTai-agent-java

  1. Write code to your needs.

  2. Compile Dongtai-agent-Java using Maven:

mvn clean package -Dmaven.test.skip=true

- notice: JDK version is 1.8.
  1. folder ./release is generated in the project root directory after compilation:

release ├── dongtai-agent.jar └── lib ├── dongtai-servlet.jar ├── dongtai-core.jar └── dongtai-spy.jar

  1. Copy dongtai-core.jardongtai-spy.jardongtai-servlet.jar to the system temporary directory. Get the system temporary directory to run the following Java code:

System.getProperty("java.io.tmpdir.dongtai");

  1. Run the application and test the code (for example, SpringBoot) : java -javaagent:/path/to/dongtai-agent.jar -Ddongtai.debug=true -jar app.jar

  2. Contribute code. If you want to contribute code to the DongTai IAST team, please read the full contribution guide.

Supported Java versions and middleware

  • Java 1.8+
  • Tomcat, Jetty, WebLogic, WebSphere, SpringBoot and Mainstream software and middleware.

Extension points exported contracts — how you extend this code

ClassOpenApiSchemaConvertor (Interface)
用于表示一个类型转换器,用来根据Java中的Class转换为Open API的Schema @author CC11001100 @since v1.12.0 [9 implementers]
dongtai-api-gather/dongtai-api-gather-openapi/src/main/java/io/dongtai/iast/api/openapi/convertor/ClassOpenApiSchemaConvertor.java
DispatchPlugin (Interface)
@author dongzhiyong@huoxian.cn [18 implementers]
dongtai-core/src/main/java/io/dongtai/iast/core/bytecode/enhance/plugin/DispatchPlugin.java
IMonitor (Interface)
@author dongzhiyong@huoxian.cn [10 implementers]
dongtai-agent/src/main/java/io/dongtai/iast/agent/monitor/IMonitor.java
SpyDispatcher (Interface)
(no doc) [4 implementers]
dongtai-spy/src/main/java/java/lang/dongtai/SpyDispatcher.java
FieldOpenApiSchemaConvertor (Interface)
可以根据Java中的Field转换为Open API的Schema @author CC11001100 @since v1.12.0 [9 implementers]
dongtai-api-gather/dongtai-api-gather-openapi/src/main/java/io/dongtai/iast/api/openapi/convertor/FieldOpenApiSchemaConvertor.java
AsmMethods (Interface)
常用的ASM method 集合 省得我到处声明 @author luanjia@taobao.com @date 16/5/21 Modified by dongzhiyong@huoxian.cn [7 implementers]
dongtai-core/src/main/java/io/dongtai/iast/core/bytecode/enhance/asm/AsmMethods.java
Supplier (Interface)
@author dongzhiyong@huoxian.cn [6 implementers]
dongtai-agent/src/main/java/io/dongtai/iast/agent/middlewarerecognition/Supplier.java
TraceIdHandler (Interface)
(no doc) [2 implementers]
dongtai-spy/src/main/java/java/lang/dongtai/TraceIdHandler.java

Core symbols most depended-on inside this repo

put
called by 633
dongtai-common/src/main/java/io/dongtai/iast/common/utils/limit/InterfaceRateLimiterSoftReferenceHashMap.java
get
called by 289
dongtai-agent/src/main/java/io/dongtai/iast/agent/middlewarerecognition/Supplier.java
getKey
called by 148
dongtai-core/src/main/java/io/dongtai/iast/core/handler/hookpoint/models/taint/tag/TaintTag.java
debug
called by 134
dongtai-log/src/main/java/io/dongtai/log/DongTaiLog.java
getMessage
called by 131
dongtai-log/src/main/java/io/dongtai/log/ErrorCode.java
equals
called by 120
dongtai-core/src/main/java/io/dongtai/iast/core/handler/hookpoint/vulscan/VulnType.java
append
called by 108
dongtai-core/src/main/java/io/dongtai/iast/core/handler/hookpoint/models/taint/range/TaintRangesBuilder.java
contains
called by 105
dongtai-core/src/main/java/io/dongtai/iast/core/utils/commonUtils.java

Shape

Method 2,318
Class 391
Enum 30
Interface 26

Languages

Java100%

Modules by API surface

dongtai-core/src/main/java/io/dongtai/iast/core/utils/matcher/structure/ClassStructureImplByAsm.java60 symbols
dongtai-api-gather/dongtai-api-gather-openapi/src/test/java/io/dongtai/iast/api/openapi/convertor/Foo.java57 symbols
dongtai-core/src/main/java/io/dongtai/iast/core/handler/hookpoint/SpyDispatcherImpl.java43 symbols
dongtai-core/src/main/java/io/dongtai/iast/core/handler/hookpoint/models/MethodEvent.java42 symbols
dongtai-spy/src/main/java/java/lang/dongtai/SpyDispatcher.java41 symbols
dongtai-spy/src/main/java/java/lang/dongtai/NopSpy.java41 symbols
dongtai-core/src/main/java/io/dongtai/iast/core/utils/PropertyUtils.java39 symbols
dongtai-core/src/main/java/io/dongtai/iast/core/utils/matcher/structure/ClassStructureImplByJDK.java33 symbols
dongtai-agent/src/main/java/io/dongtai/iast/agent/IastProperties.java31 symbols
dongtai-log/src/main/java/io/dongtai/log/DongTaiLog.java30 symbols
dongtai-api-gather/dongtai-api-gather-openapi/src/main/java/io/dongtai/iast/api/openapi/domain/DataType.java30 symbols
dongtai-api-gather/dongtai-api-gather-openapi/src/main/java/io/dongtai/iast/api/openapi/domain/Path.java22 symbols

For agents

$ claude mcp add DongTai-agent-java \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact