You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Dongtai-agent-python is DongTai Iast's data acquisition tool for Python applications. In a Python 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.
20
+
21
+
DongTai-agent-python
22
+
23
+
- `dongtai_agent_python/config.json` For configuration DongTai-openapi Url、Token、Web-ProjectName。
24
+
- `dongtai_agent_python/cli` Control the hot update of the agent version。
25
+
- `dongtai_agent_python/middleware/` Used to access different python frameworks, currently supports Django and Flask, both of which are introduced in the form of middleware。
26
+
- `dongtai_agent_python/assess/` Hook the underlying method of python according to the cloud strategy。
27
+
- `dongtai_agent_python/report/` Report the collected data of the agent to the DongTai-openapi service。
28
+
29
+
## Application Scenarios
30
+
31
+
- DevOps
32
+
- Security test the application before it goes online
33
+
- Third-party Component Management
34
+
- Code audit
35
+
- 0 Day digging
24
36
25
-
### 3.1 Django
37
+
## Quick Start
26
38
27
-
1.进入app的主目录
39
+
Please refer to the [Quick Start](https://hxsecurity.github.io/DongTai-Doc/#/doc/tutorial/quickstart).
40
+
41
+
## Quick Development
42
+
43
+
1. Fork the [DongTai-agent-python](https://github.com/HXSecurity/DongTai-agent-python) , clone your fork:
3. The project is packaged and executed in the root directory of the agent project
52
+
```shell
53
+
python3 setup.py sdist
54
+
```
55
+
56
+
4. Install the agent <br>
57
+
After packaging, the dist directory will be generated, and the installation package will be found in the dist directory, Put the dongtai_agent_python.tar.gz installation package on the machine where the Web-server is located,Execute pip installation
2.Open the `app/settings.py` file and find the line of `MIDDLEWARE`
34
70
71
+
3.Insert below the line `dongtai_agent_python.middlewares.django_middleware.FireMiddleware`
35
72
73
+
4.Restart app
36
74
75
+
#### Flask
76
+
1.Modify the entry file of the project (such as app.py) and add the following content
77
+
78
+
from dongtai_agent_python.middlewares.flask_middleware import AgentMiddleware
79
+
80
+
app = Flask(__name__)
81
+
app.wsgi_app = AgentMiddleware(app.wsgi_app, app)
82
+
83
+
if __name__ == '__main__':
84
+
app.run()
85
+
86
+
2.Restart app
87
+
88
+
89
+
Note that the `project.name` in `dongtai_agent_python/config.json` needs to be consistent with the project name created in the iast-web page, The agent will be automatically linked to the project;
90
+
If `project.name` is not configured, you can configure the system environment variable `projectName`, restart the project, the same will take effect, The priority of the system environment variable `projectName` is higher than the `project.name` in the configuration file;
37
91
Platform: UNKNOWN
38
92
Classifier: Environment :: Web Environment
39
93
Classifier: Framework :: Django
@@ -44,9 +98,6 @@ Classifier: Operating System :: OS Independent
44
98
Classifier: Programming Language :: Python
45
99
Classifier: Programming Language :: Python :: 3
46
100
Classifier: Programming Language :: Python :: 3 :: Only
47
-
Classifier: Programming Language :: Python :: 3.6
48
-
Classifier: Programming Language :: Python :: 3.7
49
-
Classifier: Programming Language :: Python :: 3.8
50
101
Classifier: Topic :: Internet :: WWW/HTTP
51
102
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
0 commit comments