Skip to content

Commit 6020007

Browse files
authored
Merge pull request #351 from red-kite-solutions/feature/ip_ranges_refactor
Feature/ip ranges refactor
2 parents 5ee964e + 85b1946 commit 6020007

File tree

96 files changed

+4224
-750
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+4224
-750
lines changed

docs/docs/concepts/findings.md

+129-42
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,23 @@ log_finding(
6363
)
6464
```
6565

66+
### Attaching information to a domain
67+
68+
Adding fields and using a custom finding type will add a finding to the domain resource.
69+
70+
```python
71+
from stalker_job_sdk import DomainFinding, log_finding, TextField
72+
73+
hostname = "example.com"
74+
log_finding(
75+
DomainFinding(
76+
"MyCustomHostnameFinding", hostname, None, "Domain info", [
77+
TextField("myfield", "Field Title", "Finding data")
78+
]
79+
)
80+
)
81+
```
82+
6683
## IpFinding
6784

6885
An ip finding creates a new host. IP addresses are in the IPv4 format.
@@ -93,9 +110,26 @@ log_finding(
93110
)
94111
```
95112

113+
### Attaching information to a host
114+
115+
Adding fields and using a custom finding type will add a finding to the host resource.
116+
117+
```python
118+
from stalker_job_sdk import IpFinding, log_finding, TextField
119+
ip = "0.0.0.0"
120+
mask = 16
121+
log_finding(
122+
IpFinding(
123+
"MyCustomIpFinding", ip, "New Info", [
124+
TextField("myfield", "Field Title", "Finding data")
125+
]
126+
)
127+
)
128+
```
129+
96130
## IpRangeFinding
97131

98-
An ip range finding creates a new ip range for a project. IP addresses are in the IPv4 format.
132+
An ip range finding creates a new ip range for a project. IP addresses are in the IPv4 format. `IpRangeFindings` can also be used to attach information to an IP Range resource.
99133

100134
| Field | Type | Description |
101135
| ------ | ------ | -------------------------------------------------------------------------------------------------------- |
@@ -116,19 +150,32 @@ Example:
116150
Using the python SDK, you can emit this finding with the following code:
117151

118152
```python
119-
from stalker_job_sdk import IpFinding, log_finding
153+
from stalker_job_sdk import IpRangeFinding, log_finding
120154
ip = "0.0.0.0"
121155
mask = 16
122156
log_finding(
123157
IpRangeFinding(
124-
ip, mask
158+
'IpRangeFinding', ip, mask, None, [], "IpRangeFinding"
125159
)
126160
)
127161
```
128162

129-
> You can't attach fields to an IP range as they are different than other ressources.
163+
### Attaching information to an IP range
130164

131-
Which is equivalent to the following python code, but with more metadata:
165+
Adding fields and using a custom finding type will add a finding to the IP range resource.
166+
167+
```python
168+
from stalker_job_sdk import IpRangeFinding, log_finding, TextField
169+
ip = "0.0.0.0"
170+
mask = 16
171+
log_finding(
172+
IpRangeFinding(
173+
'IpRangeFinding', ip, mask, "Finding title", [
174+
TextField("myfield", "Field Title", "Finding data")
175+
]
176+
)
177+
)
178+
```
132179

133180
## HostnameIpFinding
134181

@@ -192,7 +239,7 @@ Example:
192239
Using the python SDK, you can emit this finding with the following code:
193240

194241
```python
195-
from stalker_job_sdk import PortFinding, log_finding
242+
from stalker_job_sdk import PortFinding, log_finding, TextField
196243
port = 80
197244
ip = "1.2.3.4"
198245
log_finding(
@@ -208,6 +255,29 @@ log_finding(
208255
)
209256
```
210257

258+
### Attaching information to a port
259+
260+
Adding fields and using a custom finding type will add a finding to the port resource.
261+
262+
```python
263+
from stalker_job_sdk import PortFinding, log_finding, TextField
264+
port = 80
265+
ip = "1.2.3.4"
266+
log_finding(
267+
PortFinding(
268+
"MyCustomPortFinding",
269+
ip,
270+
port,
271+
"tcp",
272+
"New port data",
273+
[
274+
TextField("protocol", "This is a TCP port", "tcp"),
275+
TextField("myfield", "Field Title", "Finding data")
276+
],
277+
)
278+
)
279+
```
280+
211281
## WebsiteFinding
212282

213283
The `WebsiteFinding` will create a website resource. Websites are made from 4 characteristics: an IP address, a domain name, a port number
@@ -269,57 +339,74 @@ log_finding(
269339
)
270340
```
271341

342+
### Attaching information to a website
343+
344+
Adding fields and using a custom finding type will add a finding to the website resource.
345+
346+
```python
347+
from stalker_job_sdk import WebsiteFinding, log_finding, TextField
348+
port = 80
349+
ip = "1.2.3.4"
350+
domain = "example.com"
351+
path = "/"
352+
ssl = False
353+
354+
log_finding(
355+
WebsiteFinding(
356+
"MyCustomWebsiteFinding",
357+
ip,
358+
port,
359+
domain,
360+
path,
361+
ssl,
362+
"New website data",
363+
[
364+
TextField("myfield", "Field Title", "Finding data")
365+
],
366+
)
367+
)
368+
```
369+
272370
## CustomFinding
273371

274-
Dynamic findings allow jobs to attach custom data to resources.
372+
Custom findings attach finding field information to a resource. There are custom findings for every type of resources. When you do not specify the _type of finding_ that you are logging, you are creating a custom finding for the associated resource type.
275373

276-
| Field | Description |
277-
| ------------ | --------------------------------------------------------------- |
278-
| `domainName` | The domain to which to attach the custom finding |
279-
| `host` | The host to which to attach the custom finding |
280-
| `port` | The port to which to attach the custom finding |
281-
| `fields` | A list of [fields](#dynamic-fields) containing the finding data |
374+
| SDK finding class | Resources |
375+
| ----------------- | --------- |
376+
| HostnameFinding | Domains |
377+
| IpFinding | Hosts |
378+
| IpRangeFinding | IP ranges |
379+
| PortFinding | Ports |
380+
| WebsiteFinding | Websites |
282381

283-
Examples:
284382

285-
```json
286-
{
287-
"type": "CustomFinding",
288-
"host": "1.2.3.4",
289-
"port": 80,
290-
"fields": [
291-
{
292-
"type": "image",
293-
"data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAIAQMAAAD+wSzIAAAABlBMVEX///+/v7+jQ3Y5AAAADklEQVQI12P4AIX8EAgALgAD/aNpbtEAAAAASUVORK5CYII"
294-
}
295-
]
296-
}
297-
```
383+
Here is an example of a **custom finding** for a port with the python SDK. In this example, the port will show the custom information _This port
384+
runs an HTTP server_, with a text field attached to it:
298385

299-
```json
300-
{
301-
"type": "CustomFinding",
302-
"domainName": "red-kite.io",
303-
"fields": [
304-
{
305-
"type": "text",
306-
"label": "Domain greatness level",
307-
"data": "This domain is great, would recommend"
308-
}
309-
]
310-
}
386+
```python
387+
from stalker_job_sdk import PortFinding, log_finding, TextField
388+
port = 80
389+
ip = "0.0.0.0"
390+
log_finding(
391+
PortFinding(
392+
"PortFunFact", ip, port, "tcp", "This is a fun fact about a port", [
393+
TextField('myfieldkey', 'My field title', 'My field data')
394+
]
395+
)
396+
)
311397
```
312398

313-
Here is an example of a custom finding for a port with the python SDK. In this example, the port will show the custom information _This port
314-
runs an HTTP server_:
399+
Notice how the key `PortFunFact` can be anything, how information is provided through `TextField`s and how the finding type is not provided to use the default value.
400+
401+
To compare, here is an example of how to create a port with the `PortFinding` class, which here is **not** used as a custom finding. You will see that the key is `PortFinding`, no fields are provided, and the type is `PortFinding` as well:
315402

316403
```python
317404
from stalker_job_sdk import PortFinding, log_finding
318405
port = 80
319406
ip = "0.0.0.0"
320407
log_finding(
321408
PortFinding(
322-
"PortFunFact", ip, port, "tcp", "This is a fun fact about a port"
409+
"PortFinding", ip, port, "tcp", None, None, "PortFinding"
323410
)
324411
)
325412
```

docs/docs/concepts/project.md

+2-6
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,9 @@ description: Organizing your data through projects
66

77
# Projects
88

9-
Projects are the way to organize and centralize resources. Resources are unique per project, and deleting the project will delete all its
9+
Projects are the way to organize and centralize [resources](./resources.md). Resources are unique per project, and deleting the project will delete all its
1010
resources and related information.
1111

1212
The project's name must be unique, but it can always be changed. You can also add a logo for display purposes, but it is not mandatory.
1313

14-
## Subnets
15-
16-
In the case where a target owns a public subnet, you can add the different subnets in the projects page.
17-
18-
For a subnet of `127.0.0.1/24`, you would simply add `127.0.0.1` in the _IP Address_ field, and the `/24` in the _Short Mask_ field.
14+
> Red Kite allows to work on multiple projects at once, but using the global project filter in the navigation bar, you can also focus your work on a single project at a time. It will pre-filter data in displays such as tables and metrics.

docs/docs/concepts/resources.md renamed to docs/docs/concepts/resources.mdx

+20-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ title: Resources
44
description: What are resources
55
---
66

7+
import EnterpriseNotice from "../../src/components/EnterpriseNotice";
8+
79
# Resources
810

911
Resources represent the core entities of an exposed network. They are used to store and show the data found by
@@ -22,29 +24,40 @@ up-to-date. Want to dive deeper? Check out the section on [learn more about find
2224
## Types of Resources
2325

2426
Resources come in various types, each created by specific findings. Some findings are generated through the user interface, while others
25-
originate from the API. Regardless of their origin, every resource is tied to a specific project.
27+
originate from the API. Regardless of their origin, every resource is [tied to a specific project](./project.md).
2628

2729
### Domains
2830

2931
The domains represent domain names or a subdomains, such as `example.com` or `subdomain.example.com`. They store and display DNS-related
3032
information and can be managed via the `Domains` page in the user interface.
3133

3234
Domains can be created using the `HostnameFinding`, via the API. They can also be created through the user interface's `Add domains`
33-
functionality.
35+
functionality. Adding a new domain will seed the automation process and start a scan.
3436

3537
Typically, a domain resolves to one or more IP addresses, which are represented as host resources. A domain can be linked to one or more
3638
hosts through the `HostnameIpFinding`. If a `HostnameIpFinding` identifies a new domain or host, it will create these resources
3739
automatically.
3840

39-
Importantly, each domain's name, combined with its project identifier, must is unique within the database.
41+
The combination of a domain's name and its project identifier is unique in the database.
42+
43+
44+
### IP Ranges
45+
46+
IP ranges consist in a network IP address and a network mask, and allow to designate full subnetworks as part of a project. These ranges would be owned, for instance, by your target, and they are a likely place to find relevant [hosts](#hosts). They can be found in the user interface under the `IP ranges` page.
47+
48+
You can create an IP range by either adding it in the interface through the `Add IP ranges` capabilities, or by emitting an `IpRangeFinding` in a job. When an IP range is added, a **scan** for the range is **immediatly started**. A scan is also launched every two weeks to find new hosts and refresh data.
49+
50+
The combination of an IP range's IP, mask and project identifier is unique in the database.
51+
52+
> At the moment, only IPv4 addresses are supported.
4053
4154
### Hosts
4255

4356
The hosts represent an exposed IP address: or a computer's network interface listening on the network. Hosts are leveraged to represent the
4457
links between _domains_, hosts and _ports_. They can be seen in the user interface under the `Hosts` page.
4558

4659
A host can be created through the `IpFinding` for a standalone host, or through a `HostnameIpFinding` for a host that is linked to a
47-
_domain_. `IpFinding`s can be emitted by the API through the user interface's `Add hosts` capabilities.
60+
_domain_. `IpFinding`s can be emitted by the API through the user interface's `Add hosts` capabilities. Adding a new host will seed the automation process and start a scan.
4861

4962
An existing host can be linked to a _domain_ through the `HostnameIpFinding`. A host can be linked to one or many domains.
5063

@@ -136,8 +149,9 @@ by remembering its existence.
136149

137150
### Exporting Resources
138151

139-
In Red Kite Enterprise, resources can be exported from the list views in the `JSON` or `CSV` format. The `JSON` format is recommended as it
140-
is more flexible than CSV, and therefore better suited to the task.
152+
<EnterpriseNotice />
153+
154+
Resources can be exported from the list views in the `JSON` or `CSV` format. The `JSON` format is intended to be used by programs, while the `CSV` format is designed for humans.
141155

142156
### Merging Websites
143157

docs/docs/development/api.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# API
2+
3+
Every frontend-available data and more is accessible through the API. Simply create your API key in your profile, and then add it as a header when querying the API.
4+
5+
The API is available at `/api/`. You can do an unauthenticated request at `/api/ping` that replies a simple string, and an authenticated request at `/api/` that gets the version.
6+
7+
Unauthenticated `GET` request to `/api/ping`:
8+
9+
```bash
10+
curl https://your-red-kite-url/api/ping
11+
```
12+
13+
# API Key
14+
15+
Generate your API key in your profile page, giving it a meaningful name and an expiration date. Then, use it as a header in your following requests.
16+
17+
Authenticated `GET` request to `/api/`:
18+
19+
```bash
20+
export MY_KEY="my key value"
21+
curl -H "x-api-key: $MY_KEY" https://your-red-kite-url/api/
22+
```

docs/docs/intro.md

+9-1
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,18 @@ description: An overview of Red Kite
66

77
# Overview
88

9-
Red Kite is an Attack Surface Management (ASM) tool with a big focus on extendability. It streamlines and automates reconnaissance operations
9+
Red Kite is an Attack Surface Management (ASM) tool with a big focus on extensibility. It streamlines and automates reconnaissance operations
1010
while giving you the flexibility to expand its functionalities. Its web interface enables easy data access and sharing with all
1111
stakeholders.
1212

13+
Through flexibility, Red Kite supports multiple use cases:
14+
15+
* Real-time attack surface management
16+
* Real-time attack surface discovery
17+
* Regression testing of your attack surface
18+
* Source of truth for security operations
19+
* Custom testing at scale
20+
1321
Red Kite is powered by Kubernetes, enabling virtually infinite horizontal scaling. Combined with its flexibility, it makes it the ideal tool
1422
for hands-on security professionals committed to staying in full control while getting a clear picture of their attack surface.
1523

docs/src/components/EnterpriseNotice/index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ export default function EnterpriseNotice() {
66
<div className={styles.enterpriseNotice}>
77
<strong>✨ Unlock the Full Potential!</strong>
88
<br />
9-
This feature is part of our <strong>Enterprise version</strong>, offering advanced tools and premium support to elevate your workflow.
9+
This feature is part of our <strong>Enterprise version</strong>, offering advanced tools and premium support to elevate your workflow.{" "}
1010
<a href="https://red-kite.io/contact.html" className={styles.link}>
11-
{" "}
12-
Get in touch today
11+
Get in touch today
1312
</a>{" "}
1413
and discover how we can help you achieve more!
1514
</div>

0 commit comments

Comments
 (0)