Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.3 plugins #105

Merged
merged 8 commits into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .goreleaser-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,27 @@ builds:
binary: "plugins/blackstork/terraform@{{ .Version }}"
ldflags: "-X main.version={{.Version}}"
no_unique_dist_dir: true

- id: hackerone
main: ./internal/hackerone/cmd
binary: "plugins/blackstork/hackerone@{{ .Version }}"
ldflags: "-X main.version={{.Version}}"
no_unique_dist_dir: true

- id: virustotal
main: ./internal/virustotal/cmd
binary: "plugins/blackstork/virustotal@{{ .Version }}"
ldflags: "-X main.version={{.Version}}"
no_unique_dist_dir: true

- id: splunk
main: ./internal/splunk/cmd
binary: "plugins/blackstork/splunk@{{ .Version }}"
ldflags: "-X main.version={{.Version}}"
no_unique_dist_dir: true

- id: stixview
main: ./internal/stixview/cmd
binary: "plugins/blackstork/stixview@{{ .Version }}"
ldflags: "-X main.version={{.Version}}"
no_unique_dist_dir: true
40 changes: 40 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,42 @@ builds:
- windows
- darwin

- id: hackerone
main: ./internal/hackerone/cmd
binary: "plugins/blackstork/hackerone@{{ .Version }}"
flags: "-trimpath"
goos:
- linux
- windows
- darwin

- id: virustotal
main: ./internal/virustotal/cmd
binary: "plugins/blackstork/virustotal@{{ .Version }}"
flags: "-trimpath"
goos:
- linux
- windows
- darwin

- id: splunk
main: ./internal/splunk/cmd
binary: "plugins/blackstork/splunk@{{ .Version }}"
flags: "-trimpath"
goos:
- linux
- windows
- darwin

- id: stixview
main: ./internal/stixview/cmd
binary: "plugins/blackstork/stixview@{{ .Version }}"
flags: "-trimpath"
goos:
- linux
- windows
- darwin

archives:
- id: fabric
format: tar.gz
Expand Down Expand Up @@ -122,6 +158,10 @@ archives:
- postgresql
- sqlite
- terraform
- hackerone
- virustotal
- splunk
- stixview
name_template: >-
plugins_
{{- .Os }}_
Expand Down
12 changes: 12 additions & 0 deletions .mockery.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ packages:
interfaces:
Client:
github.com/blackstork-io/fabric/internal/openai/client:
config:
interfaces:
Client:
github.com/blackstork-io/fabric/internal/hackerone/client:
config:
interfaces:
Client:
github.com/blackstork-io/fabric/internal/virustotal/client:
config:
interfaces:
Client:
github.com/blackstork-io/fabric/internal/splunk/client:
config:
interfaces:
Client:
2 changes: 1 addition & 1 deletion cmd/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (

var dataTgtRe = regexp.MustCompile(`(?:document\.([^.]+)\.data\.([^.]+)\.([^.\n]+))|(?:data\.([^.]+)\.([^.]+))`)

func Data(ctx context.Context, blocks *parser.DefinedBlocks, caller *parser.Caller, target string) (result plugin.MapData, diags diagnostics.Diag) {
func Data(ctx context.Context, blocks *parser.DefinedBlocks, caller *parser.Caller, target string) (result plugin.Data, diags diagnostics.Diag) {
// docName, pluginName, blockName
// target: document.<doc-name>.data.<plugin-name>.<data-name>
tgt := dataTgtRe.FindStringSubmatch(target)
Expand Down
19 changes: 19 additions & 0 deletions docs/plugins/builtin.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,22 @@ content text {
text = <string> # required
}
```

### `toc`

#### Configuration

The content provider doesn't support configuration.

#### Usage

The content source supports the following parameters in the content blocks:

```hcl
content toc {
end_level = <number> # optional
ordered = <bool> # optional
scope = <string> # optional
start_level = <number> # optional
}
```
91 changes: 91 additions & 0 deletions docs/plugins/hackerone.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
title: blackstork/hackerone
weight: 20
type: docs
---

# `blackstork/hackerone` plugin

## Installation

To install the plugin, add it to `plugin_versions` map in the Fabric global configuration block (see [Global configuration]({{< ref "configs.md#global-configuration" >}}) for more details), with a version constraint restricting which available versions of the plugin the codebase is compatible with:

```hcl
fabric {
plugin_versions = {
"blackstork/hackerone" = "=> v0.0.0-dev"
}
}
```

## Data sources

The plugin has the following data sources available:

### `hackerone_reports`

#### Configuration

The data source supports the following configuration parameters:

```hcl
config data hackerone_reports {
api_token = <string> # required
api_username = <string> # required
}
```

#### Usage

The data source supports the following parameters in the data blocks:

```hcl
data hackerone_reports {
assignee = <list of string> # optional
bounty_awarded_at__gt = <string> # optional
bounty_awarded_at__lt = <string> # optional
bounty_awarded_at__null = <bool> # optional
closed_at__gt = <string> # optional
closed_at__lt = <string> # optional
closed_at__null = <bool> # optional
created_at__gt = <string> # optional
created_at__lt = <string> # optional
custom_fields = <map of string> # optional
disclosed_at__gt = <string> # optional
disclosed_at__lt = <string> # optional
disclosed_at__null = <bool> # optional
first_program_activity_at__gt = <string> # optional
first_program_activity_at__lt = <string> # optional
first_program_activity_at__null = <bool> # optional
hacker_published = <bool> # optional
id = <list of number> # optional
inbox_ids = <list of number> # optional
keyword = <string> # optional
last_activity_at__gt = <string> # optional
last_activity_at__lt = <string> # optional
last_program_activity_at__gt = <string> # optional
last_program_activity_at__lt = <string> # optional
last_program_activity_at__null = <bool> # optional
last_public_activity_at__gt = <string> # optional
last_public_activity_at__lt = <string> # optional
last_report_activity_at__gt = <string> # optional
last_report_activity_at__lt = <string> # optional
page_number = <number> # optional
program = <list of string> # optional
reporter = <list of string> # optional
reporter_agreed_on_going_public = <bool> # optional
severity = <list of string> # optional
size = <number> # optional
sort = <string> # optional
state = <list of string> # optional
submitted_at__gt = <string> # optional
submitted_at__lt = <string> # optional
swag_awarded_at__gt = <string> # optional
swag_awarded_at__lt = <string> # optional
swag_awarded_at__null = <bool> # optional
triaged_at__gt = <string> # optional
triaged_at__lt = <string> # optional
triaged_at__null = <bool> # optional
weakness_id = <list of number> # optional
}
```
52 changes: 52 additions & 0 deletions docs/plugins/splunk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
---
title: blackstork/splunk
weight: 20
type: docs
---

# `blackstork/splunk` plugin

## Installation

To install the plugin, add it to `plugin_versions` map in the Fabric global configuration block (see [Global configuration]({{< ref "configs.md#global-configuration" >}}) for more details), with a version constraint restricting which available versions of the plugin the codebase is compatible with:

```hcl
fabric {
plugin_versions = {
"blackstork/splunk" = "=> v0.0.0-dev"
}
}
```

## Data sources

The plugin has the following data sources available:

### `splunk_search`

#### Configuration

The data source supports the following configuration parameters:

```hcl
config data splunk_search {
auth_token = <string> # required
deployment_name = <string> # optional
host = <string> # optional
}
```

#### Usage

The data source supports the following parameters in the data blocks:

```hcl
data splunk_search {
earliest_time = <string> # optional
latest_time = <string> # optional
max_count = <number> # optional
rf = <list of string> # optional
search_query = <string> # required
status_buckets = <number> # optional
}
```
50 changes: 50 additions & 0 deletions docs/plugins/stixview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
title: blackstork/stixview
weight: 20
type: docs
---

# `blackstork/stixview` plugin

## Installation

To install the plugin, add it to `plugin_versions` map in the Fabric global configuration block (see [Global configuration]({{< ref "configs.md#global-configuration" >}}) for more details), with a version constraint restricting which available versions of the plugin the codebase is compatible with:

```hcl
fabric {
plugin_versions = {
"blackstork/stixview" = "=> v0.0.0-dev"
}
}
```



## Content providers
The plugin has the following content providers available:

### `stixview`

#### Configuration

The content provider doesn't support configuration.

#### Usage

The content source supports the following parameters in the content blocks:

```hcl
content stixview {
caption = <string> # optional
gist_id = <string> # optional
height = <number> # optional
show_footer = <bool> # optional
show_idrefs = <bool> # optional
show_labels = <bool> # optional
show_marking_nodes = <bool> # optional
show_sidebar = <bool> # optional
show_tlp_as_tags = <bool> # optional
stix_url = <string> # optional
width = <number> # optional
}
```
48 changes: 48 additions & 0 deletions docs/plugins/virustotal.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
title: blackstork/virustotal
weight: 20
type: docs
---

# `blackstork/virustotal` plugin

## Installation

To install the plugin, add it to `plugin_versions` map in the Fabric global configuration block (see [Global configuration]({{< ref "configs.md#global-configuration" >}}) for more details), with a version constraint restricting which available versions of the plugin the codebase is compatible with:

```hcl
fabric {
plugin_versions = {
"blackstork/virustotal" = "=> v0.0.0-dev"
}
}
```

## Data sources

The plugin has the following data sources available:

### `virustotal_api_usage`

#### Configuration

The data source supports the following configuration parameters:

```hcl
config data virustotal_api_usage {
api_key = <string> # required
}
```

#### Usage

The data source supports the following parameters in the data blocks:

```hcl
data virustotal_api_usage {
end_date = <string> # optional
group_id = <string> # optional
start_date = <string> # optional
user_id = <string> # optional
}
```
2 changes: 1 addition & 1 deletion examples/plugins/basic/content_greeting.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func makeGreetingContentProvider() *plugin.ContentProvider {
return &plugin.ContentProvider{
// Config is optional, in this case we don't need it
// We only define the schema for the arguments
Args: &hcldec.ObjectSpec{
Args: hcldec.ObjectSpec{
"name": &hcldec.AttrSpec{
Name: "name",
Required: true,
Expand Down
Loading
Loading