API Documentation
API Endpoints
Enrichment
Handle enrichment requests for a specific observable (domain or IP address).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The incoming request object containing query parameters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
A JSON response indicating whether the observable was found, |
|
|
and if so, the corresponding IOC. |
Source code in docs/Submodules/GreedyBear/api/views/enrichment.py
Feeds
Handle requests for IOC feeds with specific parameters and format the response accordingly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The incoming request object. |
required | |
feed_type
|
str
|
Type of feed (e.g., log4j, cowrie, etc.). |
required |
attack_type
|
str
|
Type of attack (e.g., all, specific attack types). |
required |
prioritize
|
str
|
Prioritization mechanism to use (e.g., recent, persistent). |
required |
format_
|
str
|
Desired format of the response (e.g., json, csv, txt). |
required |
include_mass_scanners
|
bool
|
query parameter flag to include IOCs that are known mass scanners. |
required |
include_tor_exit_nodes
|
bool
|
query parameter flag to include IOCs that are known tor exit nodes. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
The HTTP response with formatted IOC data. |
Source code in docs/Submodules/GreedyBear/api/views/feeds.py
Advanced Feeds
Handle requests for IOC feeds based on query parameters and format the response accordingly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The incoming request object. |
required | |
feed_type
|
str
|
Type of feed to retrieve. (supported: |
required |
attack_type
|
str
|
Type of attack to filter. (supported: |
required |
max_age
|
int
|
Maximum number of days since last occurrence. E.g. an IOC that was last seen 4 days ago is excluded by default. (default: 3) |
required |
min_days_seen
|
int
|
Minimum number of days on which an IOC must have been seen. (default: 1) |
required |
include_reputation
|
str
|
|
required |
exclude_reputation
|
str
|
|
required |
feed_size
|
int
|
Number of IOC items to return. (default: 5000) |
required |
ordering
|
str
|
Field to order results by, with optional |
required |
verbose
|
bool
|
|
required |
paginate
|
bool
|
|
required |
format
|
str
|
Response format type. Besides |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
The HTTP response with formatted IOC data. |
Source code in docs/Submodules/GreedyBear/api/views/feeds.py
Feeds Pagination
Handle requests for paginated IOC feeds based on query parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The incoming request object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
The paginated HTTP response with IOC data. |
Source code in docs/Submodules/GreedyBear/api/views/feeds.py
Cowrie Session
Retrieve Cowrie honeypot session data including command sequences, credentials, and session details. Queries can be performed using either an IP address to find all sessions from that source, or a SHA-256 hash to find sessions containing a specific command sequence.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The HTTP request object containing query parameters |
required | |
query
|
(str, required)
|
The search term, can be either an IP address or the SHA-256 hash of a command sequence. SHA-256 hashes should match command sequences generated using Python's "\n".join(sequence) format. |
required |
include_similar
|
bool
|
When "true", expands the result to include all sessions that executed command sequences belonging to the same cluster(s) as command sequences found in the initial query result. Requires CLUSTER_COWRIE_COMMAND_SEQUENCES enabled in configuration. Default: false |
required |
include_credentials
|
bool
|
When "true", includes all credentials used across matching Cowrie sessions. Default: false |
required |
include_session_data
|
bool
|
When "true", includes detailed information about matching Cowrie sessions. Default: false |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
200
|
JSON object containing: - query (str): The original query parameter - commands (list[str]): Unique command sequences (newline-delimited strings) - sources (list[str]): Unique source IP addresses - credentials (list[str], optional): Unique credentials if include_credentials=true - sessions (list[dict], optional): Session details if include_session_data=true - time (datetime): Session start time - duration (float): Session duration in seconds - source (str): Source IP address - interactions (int): Number of interactions in session - credentials (list[str]): Credentials used in this session - commands (str): Command sequence executed (newline-delimited) |
Response |
400
|
Bad Request - Missing or invalid query parameter |
Response |
404
|
Not Found - No matching sessions found |
Response |
500
|
Internal Server Error - Unexpected error occurred |
Example Queries
/api/cowrie_session?query=1.2.3.4 /api/cowrie_session?query=5120e94e366ec83a79ee80454e4d1c76c06499ab19032bcdc7f0b4523bdb37a6 /api/cowrie_session?query=1.2.3.4&include_credentials=true&include_session_data=true&include_similar=true
Source code in docs/Submodules/GreedyBear/api/views/cowrie_session.py
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 | |
Command Sequence
View function that handles command sequence queries based on IP addresses or SHA-256 hashes.
Retrieves and returns command sequences and related IOCs based on the query parameter. If IP address is given, returns all command sequences executed from this IP. If SHA-256 hash is given, returns details about the specific command sequence. Can include similar command sequences if requested.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The HTTP request object containing query parameters |
required | |
query
|
str
|
The search term, can be either an IP address or a SHA-256 hash. |
required |
include_similar
|
bool
|
When parameter is present, returns related command sequences based on clustering. |
required |
Returns:
| Type | Description |
|---|---|
|
Response object with command sequence data or an error response |
Raises:
| Type | Description |
|---|---|
Http404
|
If the requested resource is not found |
Source code in docs/Submodules/GreedyBear/api/views/command_sequence.py
General Honeypot List
Retrieve a list of all general honeypots, optionally filtering by active status.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The incoming request object containing query parameters. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
A JSON response containing the list of general honeypots. |
Source code in docs/Submodules/GreedyBear/api/views/general_honeypot.py
Statistics
Bases: ViewSet
A viewset for viewing and editing statistics related to feeds and enrichment data.
Provides actions to retrieve statistics about the sources and downloads of feeds, as well as statistics on enrichment data.
Source code in docs/Submodules/GreedyBear/api/views/statistics.py
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 | |
__aggregation_response_static_ioc(annotations)
Helper method to generate IOC response based on annotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
annotations
|
dict
|
Dictionary containing the annotations for the query. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
Response
|
A JSON response containing the aggregated IOC data. |
Source code in docs/Submodules/GreedyBear/api/views/statistics.py
__aggregation_response_static_statistics(annotations)
Helper method to generate statistics response based on annotations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
annotations
|
dict
|
Dictionary containing the annotations for the query. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
Response
|
A JSON response containing the aggregated statistics. |
Source code in docs/Submodules/GreedyBear/api/views/statistics.py
__parse_range(request)
staticmethod
Parse the range parameter from the request query string to determine the time range for the query.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The incoming request object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
A tuple containing the delta time and basis for the query range. |
Source code in docs/Submodules/GreedyBear/api/views/statistics.py
enrichment(request, pk=None)
Retrieve enrichment statistics, including the number of sources and requests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The incoming request object. |
required | |
pk
|
str
|
The type of statistics to retrieve (e.g., "sources", "requests"). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Response |
A JSON response containing the requested statistics. |
Source code in docs/Submodules/GreedyBear/api/views/statistics.py
feeds(request, pk=None)
Retrieve feed statistics, including the number of sources and downloads.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The incoming request object. |
required | |
pk
|
str
|
The type of statistics to retrieve (e.g., "sources", "downloads"). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Response |
A JSON response containing the requested statistics. |
Source code in docs/Submodules/GreedyBear/api/views/statistics.py
feeds_types(request)
Retrieve statistics for different types of feeds, including Log4j, Cowrie, and general honeypots.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
The incoming request object. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Response |
A JSON response containing the feed type statistics. |
Source code in docs/Submodules/GreedyBear/api/views/statistics.py
Serializers
EnrichmentSerializer
Bases: Serializer
Source code in docs/Submodules/GreedyBear/api/serializers.py
validate(data)
Check a given observable against regex expression
Source code in docs/Submodules/GreedyBear/api/serializers.py
FeedsRequestSerializer
Bases: Serializer
Source code in docs/Submodules/GreedyBear/api/serializers.py
Note: Enhanced with additional filter fields (ioc_type, etc.) in version > 2.4.0
FeedsResponseSerializer
Bases: Serializer
Source code in docs/Submodules/GreedyBear/api/serializers.py
IOCSerializer
Note: Includes FireHol categories field in version > 2.4.0
GeneralHoneypotSerializer
Validation Functions
feed_type_validation
Validates that a given feed type exists in the set of valid feed types.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feed_type
|
str
|
The feed type to validate |
required |
valid_feed_types
|
frozenset
|
Set of allowed feed type values |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The validated feed type string, unchanged |
Raises:
| Type | Description |
|---|---|
ValidationError
|
If feed_type is not found in valid_feed_types |
Source code in docs/Submodules/GreedyBear/api/serializers.py
ordering_validation
Validates that given ordering corresponds to a field in the IOC model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ordering
|
str
|
The ordering to validate |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The validated ordering string, unchanged |
Raises:
| Type | Description |
|---|---|
ValidationError
|
If ordering does not correspond to a field in the IOC model |