-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
371 lines (361 loc) · 18.9 KB
/
index.html
File metadata and controls
371 lines (361 loc) · 18.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="src/main.css" rel="stylesheet" type="text/css" />
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/styles/default.min.css">
<title>
PTaaS: Docs
</title>
</head>
<body>
<div class="bg-light border-bottom p-15 d-flex justify-content-between align-items-center">
<div class="h2">
PTaaS <span class="text-orange">documents</span>
</div>
<div>
<a class="x-a" href="https://github.com/ptaas-tool" target="_blank">
<svg xmlns="http://www.w3.org/2000/svg" width="36" height="36" fill="currentColor" class="bi bi-github" viewBox="0 0 16 16">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8"/>
</svg>
</a>
</div>
</div>
<div class="x-container x-floating-container border-bottom">
<div class="p-15 border-end" style="overflow: scroll;">
<ul>
<li>
<a href="#sec-installation">Installation</a>
<ul>
<li><a href="#sec-docker">Docker</a></li>
<li>
<a href="#sec-charts">Charts</a>
<ul>
<li>Configs</li>
</ul>
</li>
</ul>
</li>
<li><a href="#sec-usage">Usage</a></li>
<li>
<a href="#sec-components">Components</a>
<ul>
<li>
<a href="#sec-base-api">Base-API</a>
<ul>
<li>Database</li>
<li>Scanner</li>
<li>ML</li>
</ul>
</li>
<li><a href="#sec-gateway">Gateway</a></li>
<li>
<a href="#sec-ftp">FTP-Server</a>
<ul>
<li>Object Storage</li>
<li>Libatks</li>
</ul>
</li>
<li><a href="#dashboard">Dashboard</a></li>
</ul>
</li>
</ul>
</div>
<div class="p-30" style="text-align: justify;">
<p>
Welcome to <b>PTaaS</b> (short form of Penetration Testing as a Service) official document page. PTaaS is a service for performing automated penetration testings over cloud.
It is a network security application that reduces costs of a penetration testing. Also, it provides more observability over the testing process.
Our goal is to reduce penetration testing costs in a cloud environment. Also, we are looking forward to increase the process velocity and reduce the human errors.
</p>
<div id="sec-installation" class="h3">
Installation
</div>
<div class="mb-3">
In order to install this application, you can use docker or helm charts. Docker is useful when you want to install
the application on a bare-metal or on your local system. However, charts are being used to install the application
on a Kubernetes cluster.
</div>
<div id="sec-docker" class="h4">
Docker
</div>
<div class="mb-3">
For installing the application using Docker, first make sure that you have <b>docker & docker-compose</b> command lines
installed on your machine. You may check <a href="https://docs.docker.com/engine/install/" target="_blank">this</a> link to install these dependencies.
Then use the following script in order to download the project deployment files and start the application:
<pre class="bg-light px-3 my-3"><code class="language-bash bg-light">
#!/bin/bash
git clone https://github.com/ptaas-tool/deployments
cd deployments
# deploy the application
./deploy.sh up ptaas
</code></pre>
</div>
<div id="sec-charts" class="h4">
Charts
</div>
<div class="mb-3">
In order to use <b>Helm Charts</b>, first install the following dependencies on your machine:<br /><br />
<ul>
<li><a href="https://kubernetes.io/docs/tasks/tools/" target="_blank">Kubectl</a></li>
<li><a href="https://helm.sh/docs/helm/helm_install/" target="_blank">Helm CLI</a></li>
</ul>
<br />
After that use the following script in order to start the application on a Kubernetes cluster.
<pre class="bg-light px-3 my-3"><code class="language-bash bg-light">
#!/bin/bash
git clone https://github.com/ptaas-tool/deployments
# deploy the application
helm install ptaa ptaas
</code></pre>
</div>
<div class="h5">
Configs
</div>
<div class="mb-3">
Application configs are written into <b>YAML</b> format. There are two base config files for this application. The
base config and gatway configs which are as follow:
<pre class="bg-light px-3 my-3"><code class="language-yml bg-light">
core:
port: 9090
enable: true
workers: 1
secret: "#wercV89Qwerc09"
mysql:
host: "mysql-container"
port: 3306
user: root
pass: "mauFJcuf5dhRMQrjj"
database: "ptaas"
migrate: true
ai:
enable: false
method: "random"
limit: 10
factor: 7
scanner:
enable: false
defaults:
- "2fa"
command: "python3 scanner.py"
flags:
- "host"
- "endpoints"
- "type"
- "protocol"
migrate:
root: "admin"
pass: "12345"
enable: false
ftp:
host: "http://ftp-server:9091"
secret: "8bVc13329vn23"
access: "nnvXiu%2234nvoo3n1i98n3v"
</code></pre>
</div>
<div id="sec-usage" class="h3">
Usage
</div>
<div class="mb-3">
Penetration testing as a service (PTaaS) is a form of cybersecurity service where organizations hire third-party security experts to conduct simulated attacks on their IT infrastructure, networks, applications, and other digital assets. The primary goal of penetration testing is to identify vulnerabilities and weaknesses in the organization's security defenses before malicious actors exploit them.
The main objective of PTaaS is to assess the security posture of an organization's digital assets by simulating real-world cyberattacks. This helps identify vulnerabilities and weaknesses that could be exploited by attackers. PTaaS can include various types of penetration testing, including network penetration testing, web application penetration testing, mobile application penetration testing, wireless network penetration testing, and social engineering testing. <br /><br />
Penetration testing typically follows a structured methodology that involves several phases, including reconnaissance, enumeration, vulnerability assessment, exploitation, and reporting. Security experts use a combination of automated tools and manual techniques to identify and exploit vulnerabilities. This approach ensures a thorough examination of the organization's security defenses.
PTaaS offers several benefits to organizations. It helps identify vulnerabilities proactively, allowing organizations to address them before they are exploited by malicious actors, thus reducing the risk of data breaches and cyberattacks. Additionally, many regulatory standards and industry best practices require organizations to conduct regular penetration testing to ensure compliance with security requirements. Furthermore, penetration testing provides valuable insights into the effectiveness of an organization's security defenses, allowing them to improve their security posture. <br /><br />
PTaaS can be offered through various engagement models, including one-time engagements, ongoing subscriptions, and customized engagements tailored to the organization's specific needs and requirements. Penetration testing results are typically documented in a detailed report that outlines the vulnerabilities discovered, the potential impact of these vulnerabilities, and recommendations for remediation. <br /><br />
Despite its benefits, PTaaS may face challenges such as cost considerations, resource constraints, and the need for skilled cybersecurity professionals to perform the testing effectively. However, penetration testing as a service remains a valuable cybersecurity offering that helps organizations identify and mitigate security risks to protect their digital assets from cyber threats.
</div>
<div id="sec-components" class="h3">
Components
</div>
<div class="mb-3">
In the next sections we are going to check the four main parts of the system.
</div>
<div id="sec-base-api" class="h4">
Base-API
</div>
<div class="mb-3">
This is PTaaS base api system. In this service we use scanner, ftp server, and ml components to
perform our penetration testing stages. In pkg/models directory we defined our base database modules
and system modules to be used in all other system components.<br /><br />
Base API docker image address:
<pre class="bg-light px-3 my-3"><code class="language-bash bg-light">
docker pull amirhossein21/ptaas-tool:base-v0.X.X
</code></pre>
Setup base API in docker container with following command:
<pre class="bg-light px-3 my-3"><code class="language-bash bg-light">
docker run -d \
-v type=bind,source=$(pwd)/config.yml,dest=/app/config.yml
-p 80:80 \
amirhossein21/ptaas-tool:base-v0.X.X
</code></pre>
</div>
<div class="h5">
Database
</div>
<div class="mb-3">
Application uses the latest version of <b>MySQL</b>. If you want to migrate the modules, just set the following
configs in base-api config file:
<pre class="bg-light px-3 my-3"><code class="language-yml bg-light">
mysql:
host: "mysql-container"
port: 3306
user: root
pass: "mauFJcuf5dhRMQrjj"
database: "ptaas"
migrate: true
migrate:
root: "admin"
pass: "12345"
enable: false
</code></pre>
</div>
<div class="h5">
Scanner
</div>
<div class="mb-3">
Open source tool to perform API security scan in PTaaS.
This scanner uses nmap in order to get some details about our target. In this app, we get system information, critical issues, system vulnerabilities, and system dependencies. After that we return a list of possible vulnerabilities that might be used in a penetrating testing for that target.
<pre class="bg-light px-3 my-3"><code class="language-bash bg-light">
pip install -r requirements.txt
python scanner.py --host webmail.aut.ac.ir
</code></pre>
Output:
<pre class="bg-light px-3 my-3"><code class="language-json bg-light">
[
{
"vuln": "injection",
"attacks": [ "sql injection", "graphql injection" ]
"path": [
"/docs/{doc-name}",
"/docs?sort_by={sorting-field}",
],
"host" : {
"ip": "127.0.0.2",
"port": 8080
}
}
]
</code></pre>
</div>
<div class="h5">
ML
</div>
<div class="mb-3">
Implementing a machine learning model in order to find the attacks that can be performed during a penetration testing by using analysis result data which consists of system vulnerabilities, bugs, and bad smells.
In order to execute the model to see its results use the following command:
<pre class="bg-light px-3 my-3"><code class="language-bash bg-light">
jupyter nbconvert --execute ./notebook/analysis_data.ipynb
</code></pre>
</div>
<div id="sec-gateway" class="h4">
Gateway
</div>
<div class="mb-3">
Gateway is the PTaaS restful API for handling client http requests. This module handles the user interface logic in order to communicate with base-api and ftp-server. It is the system main gateway app.
Setup gateway service in docker container with following command:
<pre class="bg-light px-3 my-3"><code class="language-bash bg-light">
docker run -d \
-v type=bind,source=$(pwd)/config.yaml,dest=/app/config.yaml \
-p 80:80 \
amirhossein21/ptaas-tool:gateway-v0.X.X
</code></pre>
Make sure to create config.yaml file with the following variable init:
<pre class="bg-light px-3 my-3"><code class="language-yaml bg-light">
http:
port: 8080
core: 'http://localhost:9090/api'
core_secret: 'secret'
dev_mode: true
jwt:
private_key: 'super'
expire_time: 180 # minute
mysql:
host: 'localhost'
port: 3306
user: root
pass: ''
database: 'apt'
migrate: false
ftp:
host: 'http://localhost:9091'
secret: 'secret'
access: 'access'
</code></pre>
</div>
<div id="sec-ftp" class="h4">
FTP-Server
</div>
<div class="mb-3">
This is file manager component of our system. In this app we upload our attack scripts, we execute attack scripts, and we download the results. This system provides an interface in order to manage scripts and logs files from core app.
Setup ftp server in docker container with following command:
<pre class="bg-light px-3 my-3"><code class="language-bash bg-light">
docker run -d \
-e HTTP_PORT=80 \
-p 80:80 \
amirhossein21/ptaas-tool:ftp-v0.X.X
</code></pre>
Env variables:<br /><br />
<ul>
<li>HTTP_PORT which is the system port</li>
<li>ACCESS_KEY which is used to block download access for files</li>
<li>PRIVATE_KEY which is used to give execute script system call enable only for core</li>
<li>MINIO_CLUSTER is the minio configs. access:secret@endpoint&bucket&true</li>
</ul>
</div>
<div class="h5">
Object Storage
</div>
<div class="mb-3">
Application uses MinIO object storage for storing objects using S3 APIs.
</div>
<div class="h5">
Libatks
</div>
<div class="mb-3">
Put your new attacks in libatks directory. If you add draf at the end, it will be ignored. Make sure to have only one main.go file for your attack with the following code in the beginning of the main function.
<pre class="bg-light px-3 my-3"><code class="language-go bg-light">
log.SetOutput(os.Stdout)
var (
hostFlag = flag.String("host", "localhost", "target host address")
endpointsFlag = flag.String("endpoints", "/", "target specific endpoints")
paramsFlag = flag.String("params", "", "system parameters for testing")
)
flag.Parse()
endpoints := strings.Split(*endpointsFlag, ",")
paramSet := strings.Split(*paramsFlag, "&")
params := make(map[string]string)
for _, item := range paramSet {
parts := strings.Split(item, "=")
params[parts[0]] = parts[1]
}
log.Println(*hostFlag)
log.Println(endpoints)
log.Println(params)
</code></pre>
</div>
<div id="sec-dashboard" class="h4">
Dashboard
</div>
<div class="mb-3">
Automated penetration testing UI implemented by Vue.js framework. A user interface to use PTaaS application. In order to setup the user interface, first make sure to have gateway api, base api, and ftp server up and running. After that read the manuals to setup the ui app in your kubernetes cluster.
Setup ui application in docker container with following command:
<pre class="bg-light px-3 my-3"><code class="language-bash bg-light">
docker run -d \
-v type=bind,source=$(pwd)/.env,dest=/app/.env \
-p 80:80 \
amirhossein21/ptaas-tool:dashboard-v0.X.X
</code></pre>
</div>
</div>
</div>
<div class="bg-orange text-dark p-15" style="text-align: center; font-size: 0.7em;">
all rights are reserved for the Amirkabir University of Technology <br />
created by amirhnajafiz <br />
2023-2024
</div>
<script src="src/script.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.3.1/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
</body>
</html>