-
Notifications
You must be signed in to change notification settings - Fork 54
Docs: Fix Discrepancies #1380
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
Merged
Merged
Docs: Fix Discrepancies #1380
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
8942645
Docs: Fix discrepancies in Tavern config and Eldritch DSL
google-labs-jules[bot] 0a4517c
Docs: Address PR feedback (V2 tags, remove unimplemented methods)
google-labs-jules[bot] efeae63
Docs: Address feedback (restore warnings, refine V2 tags)
google-labs-jules[bot] 24c40db
Merge branch 'main' into docs-fix-discrepancies-9413631596083015394
KCarretto 46da4bd
Merge branch 'main' into docs-fix-discrepancies-9413631596083015394
KCarretto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,6 @@ permalink: user-guide/eldritch | |
|
|
||
| 🚨 **DEPRECATION WARNING:** Eldritch v1 will soon be deprecated and replaced with v2 🚨 | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Leave this deprecation warning
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Restored the deprecation warning. |
||
|
|
||
|
|
||
| Eldritch is a Pythonic red team Domain Specific Language (DSL) based on [starlark](https://github.com/facebookexperimental/starlark-rust). It uses and supports most python syntax and basic functionality such as list comprehension, string operations (`lower()`, `join()`, `replace()`, etc.), and built-in methods (`any()`, `dir()`, `sorted()`, etc.). For more details on the supported functionality not listed here, please consult the [Starlark Spec Reference](https://github.com/bazelbuild/starlark/blob/master/spec.md), but for the most part you can treat this like basic Python with extra red team functionality. | ||
|
|
||
| Eldritch is a small interpreter that can be embedded into a c2 agent as it is with Golem and Imix. | ||
|
|
@@ -234,6 +233,18 @@ The <b>assets.read</b> method returns a UTF-8 string representation of the asset | |
|
|
||
| ## Crypto | ||
|
|
||
| ### crypto.aes_decrypt (V2-Only) | ||
|
|
||
| `crypto.aes_decrypt(key: Bytes, iv: Bytes, data: Bytes) -> Bytes` | ||
|
|
||
| The <b>crypto.aes_decrypt</b> method decrypts the given data using AES (CBC mode). The key must be 16, 24, or 32 bytes, and the IV must be 16 bytes. | ||
|
|
||
| ### crypto.aes_encrypt (V2-Only) | ||
|
|
||
| `crypto.aes_encrypt(key: Bytes, iv: Bytes, data: Bytes) -> Bytes` | ||
|
|
||
| The <b>crypto.aes_encrypt</b> method encrypts the given data using AES (CBC mode). The key must be 16, 24, or 32 bytes, and the IV must be 16 bytes. | ||
|
|
||
| ### crypto.aes_decrypt_file | ||
|
|
||
| `crypto.aes_decrypt_file(src: str, dst: str, key: str) -> None` | ||
|
|
@@ -443,11 +454,11 @@ Here is an example of the Dict layout: | |
|
|
||
| The <b>file.mkdir</b> method will make a new directory at `path`. If the parent directory does not exist or the directory cannot be created, it will error; unless the `parent` parameter is passed as `True`. | ||
|
|
||
| ### file.moveto | ||
| ### file.move | ||
|
|
||
| `file.moveto(src: str, dst: str) -> None` | ||
| `file.move(src: str, dst: str) -> None` | ||
|
|
||
| The <b>file.moveto</b> method moves a file or directory from `src` to `dst`. If the `dst` directory or file exists it will be deleted before being replaced to ensure consistency across systems. | ||
| The <b>file.move</b> method moves or renames a file or directory from `src` to `dst`. If the `dst` directory or file exists it will be deleted before being replaced to ensure consistency across systems. | ||
|
|
||
| ### file.parent_dir | ||
|
|
||
|
|
@@ -514,11 +525,11 @@ If the destination file doesn't exist it will be created (if the parent director | |
| The `args` dictionary currently supports values of: `int`, `str`, and `List`. | ||
| `autoescape` when `True` will perform HTML character escapes according to the [OWASP XSS guidelines](https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html) | ||
|
|
||
| ### file.timestomp | ||
| ### file.timestomp (V2-Only) | ||
|
|
||
| `file.timestomp(src: str, dst: str) -> None` | ||
| `file.timestomp(path: str, mtime: Option<Value>, atime: Option<Value>, ctime: Option<Value>, ref_file: Option<str>) -> None` | ||
|
|
||
| Unimplemented. | ||
| The <b>file.timestomp</b> method modifies the timestamps of a file. It can update the modification time (`mtime`), access time (`atime`), and creation time (`ctime`) to specific values (epoch integer or string). Alternatively, if `ref_file` is provided, the timestamps from that file will be copied to `path`. | ||
|
|
||
| ### file.write | ||
|
|
||
|
|
@@ -554,15 +565,15 @@ The <b>http.download</b> method downloads a file at the URI specified in `uri` t | |
|
|
||
| ### http.get | ||
|
|
||
| `http.get(uri: str, query_params: Option<Dict<str, str>>, headers: Option<Dict<str, str>>, allow_insecure: Option<bool>) -> str` | ||
| `http.get(uri: str, query_params: Option<Dict<str, str>>, headers: Option<Dict<str, str>>, allow_insecure: Option<bool>) -> Dict` | ||
|
|
||
| The <b>http.get</b> method sends an HTTP GET request to the URI specified in `uri` with the optional query paramters specified in `query_params` and headers specified in `headers`, then return the response body as a string. Note: in order to conform with HTTP2+ all header names are transmuted to lowercase. | ||
| The <b>http.get</b> method sends an HTTP GET request to the URI specified in `uri` with the optional query paramters specified in `query_params` and headers specified in `headers`. It returns a dictionary containing the `status_code` (int), `body` (Bytes), and `headers` (Dict). Note: in order to conform with HTTP2+ all header names are transmuted to lowercase. | ||
|
|
||
| ### http.post | ||
|
|
||
| `http.post(uri: str, body: Option<str>, form: Option<Dict<str, str>>, headers: Option<Dict<str, str>>, allow_insecure: Option<bool>) -> str` | ||
| `http.post(uri: str, body: Option<str>, form: Option<Dict<str, str>>, headers: Option<Dict<str, str>>, allow_insecure: Option<bool>) -> Dict` | ||
|
|
||
| The <b>http.post</b> method sends an HTTP POST request to the URI specified in `uri` with the optional request body specified by `body`, form paramters specified in `form`, and headers specified in `headers`, then return the response body as a string. Note: in order to conform with HTTP2+ all header names are transmuted to lowercase. Other Note: if a `body` and a `form` are supplied the value of `body` will be used. | ||
| The <b>http.post</b> method sends an HTTP POST request to the URI specified in `uri` with the optional request body specified by `body`, form paramters specified in `form`, and headers specified in `headers`. It returns a dictionary containing the `status_code` (int), `body` (Bytes), and `headers` (Dict). Note: in order to conform with HTTP2+ all header names are transmuted to lowercase. Other Note: if a `body` and a `form` are supplied the value of `body` will be used. | ||
|
|
||
| --- | ||
|
|
||
|
|
@@ -598,12 +609,6 @@ $> pivot.arp_scan(["192.168.1.1/32"]) | |
| [] | ||
| ``` | ||
|
|
||
| ### pivot.bind_proxy | ||
|
|
||
| `pivot.bind_proxy(listen_address: str, listen_port: int, username: str, password: str ) -> None` | ||
|
|
||
| The <b>pivot.bind_proxy</b> method is being proposed to provide users another option when trying to connect and pivot within an environment. This function will start a SOCKS5 proxy on the specified port and interface, with the specified username and password (if provided). | ||
|
|
||
| ### pivot.ncat | ||
|
|
||
| `pivot.ncat(address: str, port: int, data: str, protocol: str ) -> str` | ||
|
|
@@ -612,15 +617,9 @@ The <b>pivot.ncat</b> method allows a user to send arbitrary data over TCP/UDP t | |
|
|
||
| `protocol` must be `tcp`, or `udp` anything else will return an error `Protocol not supported please use: udp or tcp.`. | ||
|
|
||
| ### pivot.port_forward | ||
|
|
||
| `pivot.port_forward(listen_address: str, listen_port: int, forward_address: str, forward_port: int, str: protocol ) -> None` | ||
|
|
||
| The <b>pivot.port_forward</b> method is being proposed to provide socat like functionality by forwarding traffic from a port on a local machine to a port on a different machine allowing traffic to be relayed. | ||
|
|
||
| ### pivot.port_scan | ||
|
|
||
| `pivot.port_scan(target_cidrs: List<str>, ports: List<int>, protocol: str, timeout: int) -> List<str>` | ||
| `pivot.port_scan(target_cidrs: List<str>, ports: List<int>, protocol: str, timeout: int, fd_limit: Option<int>) -> List<str>` | ||
|
|
||
| The <b>pivot.port_scan</b> method allows users to scan TCP/UDP ports within the eldritch language. | ||
| Inputs: | ||
|
|
@@ -629,6 +628,7 @@ Inputs: | |
| - `ports` can be a list of any number of integers between 1 and 65535. | ||
| - `protocol` must be: `tcp` or `udp`. These are the only supported options. | ||
| - `timeout` is the number of seconds a scan will wait without a response before it's marked as `timeout` | ||
| - `fd_limit` is the optional limit on concurrent file descriptors (defaults to 64). | ||
|
|
||
| Results will be in the format: | ||
|
|
||
|
|
@@ -661,11 +661,11 @@ NOTE: Windows scans against `localhost`/`127.0.0.1` can behave unexpectedly or e | |
|
|
||
| The **pivot.reverse_shell_pty** method spawns the provided command in a cross-platform PTY and opens a reverse shell over the agent's current transport (e.g. gRPC). If no command is provided, Windows will use `cmd.exe`. On other platforms, `/bin/bash` is used as a default, but if it does not exist then `/bin/sh` is used. | ||
|
|
||
| ### pivot.smb_exec | ||
| ### pivot.reverse_shell_repl (V2-Only) | ||
|
|
||
| `pivot.smb_exec(target: str, port: int, username: str, password: str, hash: str, command: str) -> str` | ||
| `pivot.reverse_shell_repl() -> None` | ||
|
|
||
| The <b>pivot.smb_exec</b> method is being proposed to allow users a way to move between hosts running smb. | ||
| The **pivot.reverse_shell_repl** method spawns a generic Eldritch REPL reverse shell over the agent's current transport. This is useful when a PTY cannot be spawned. | ||
|
|
||
| ### pivot.ssh_copy | ||
|
|
||
|
|
@@ -808,6 +808,12 @@ The random library is designed to enable generation of cryptogrphically secure r | |
|
|
||
| The <b>random.bool</b> method returns a randomly sourced boolean value. | ||
|
|
||
| ### random.bytes (V2-Only) | ||
|
|
||
| `random.bytes(len: int) -> List<int>` | ||
|
|
||
| The <b>random.bytes</b> method returns a list of random bytes of the specified length. | ||
|
|
||
| ### random.int | ||
|
|
||
| `random.int(min: i32, max: i32) -> i32` | ||
|
|
@@ -819,6 +825,12 @@ The <b>random.int</b> method returns randomly generated integer value between a | |
| `random.string(length: uint, charset: Optional<str>) -> str` | ||
| The <b>random.string</b> method returns a randomly generated string of the specified length. If `charset` is not provided defaults to [Alphanumeric](https://docs.rs/rand_distr/latest/rand_distr/struct.Alphanumeric.html). Warning, the string is stored entirely in memory so exceptionally large files (multiple megabytes) can lead to performance issues. | ||
|
|
||
| ### random.uuid (V2-Only) | ||
|
|
||
| `random.uuid() -> str` | ||
|
|
||
| The <b>random.uuid</b> method returns a randomly generated UUID (v4). | ||
|
|
||
| --- | ||
|
|
||
| ## Regex | ||
|
|
@@ -902,12 +914,13 @@ If your dll_bytes array contains a value greater than u8::MAX it will cause the | |
|
|
||
| ### sys.exec | ||
|
|
||
| `sys.exec(path: str, args: List<str>, disown: Optional<bool>, env_vars: Option<Dict<str, str>>) -> Dict` | ||
| `sys.exec(path: str, args: List<str>, disown: Optional<bool>, env_vars: Option<Dict<str, str>>, input: Option<str>) -> Dict` | ||
|
|
||
| The <b>sys.exec</b> method executes a program specified with `path` and passes the `args` list. | ||
| On *nix systems disown will run the process in the background disowned from the agent. This is done through double forking. | ||
| On Windows systems disown will run the process with detached stdin and stdout such that it won't block the tomes execution. | ||
| The `env_vars` will be a map of environment variables to be added to the process of the execution. | ||
| The `input` parameter (V2-Only) allows you to pass a string to the process's stdin. | ||
|
|
||
| ```python | ||
| sys.exec("/bin/bash",["-c", "whoami"]) | ||
|
|
@@ -1233,6 +1246,6 @@ The <b>time.now</b> method returns the time since UNIX EPOCH (Jan 01 1970). This | |
|
|
||
| ### time.sleep | ||
|
|
||
| `time.sleep(secs: float)` | ||
| `time.sleep(secs: int)` | ||
|
|
||
| The <b>time.sleep</b> method sleeps the task for the given number of seconds. | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch eventually this should be a diff port.
Tavern is 8000
Redirector is 8080