semvec/pypi-packages huggingface dataset:
llm-recorder 0.1.0
Record and replay LLM interactions
License: MIT
Requires Python: >=3.9

# llm_recorder

`llm_recorder` is a basic observability and debugging tool for language model apps.
It stores interactions with LLMs in a local directory and provides a way to replay them.
It is particularly useful for debugging chained LLM calls.

With `llm_recorder`, you can:

- Save every request/response pair to a directory.
- Replay part of previously recorded interactions instead of making live LLM calls.

You can use it to:
- Inspect LLM responses and requests that lead to them
- Record an execution path that leads to a specific response and then replay it and see how the application behaves downstream
- Modify the recorded responses before replaying them

## Installation

```bash
pip install llm_recorder
```

## Getting Started

For a quick start use `enable_replay_mode`; it monkey patches `litellm` to record and replay responses.

`llm_recorder` records any calls to `litellm.completion` and their responses and stores them in the directory specified by `store_path`.

Specify `replay_count` to replay previously recorded interactions (by default no interactions are replayed).
Once the replayed interactions are exhausted, `llm_recorder` falls back to live LLM calls.

The `store_path` is cleaned up at the start of each run, but interactions from the previous run are read before that cleanup.


### Basic Example

```python
from llm_recorder import enable_replay_mode

import litellm


enable_replay_mode(store_path="saves")

print("After:", litellm.completion.__name__)

# Now just use litellm as usual:

response = litellm.completion(
    model="openai/gpt-4o",
    messages=[{ "content": "Hello, how are you?","role": "user"}]
)
```
Then have a look at the 'saves' directory to see the recorded interactions.

### Chained Calls Example
See [examples/chained_calls.py](examples/chained_calls.py) for an example of how to use `llm_recorder` to record and replay chained LLM calls.
I saved the first interaction in [examples/saves/chained_calls/](examples/saves/chained_calls/) and the example
replays it before making live calls.

## Advanced Usage

For more fine-grained control instantiate and use the LiteLLMRecorder class directly.
See [examples/direct_recorder.py](examples/direct_recorder.py).

## Limitations

- Direct support for SDKs (not through litellm) and the recording HTTP client is experimental.
- Only supports synchronous calls.

## Contributing

Contributions are welcome! Please open issues or pull requests on GitHub.

## License

This project is licensed under the MIT License.
iam-principal-enumerator 0.1.1
CLI application that performs unauthenticated IAM principal enumeration against a target AWS account.
License: MIT
Requires Python: <4.0,>=3.11

# IAM Principal Enumerator

CLI application that performs unauthenticated IAM principal enumeration against a target AWS account.

The application accepts a custom wordlist containing principal names, and uses these to check for the existence of IAM principals in a target AWS account by attempting to update the trust policy of an attacker-controlled IAM role with the ARN of an IAM principal (user or role) in the target AWS account.

The error message received when updating the trust policy will determine if the IAM princiapl exists in the target account or not.

## Table of Contents

- [Installation](#installation)
- [Usage](#usage)
- [Arguments](#arguments)
- [Examples](#examples)
- [License](#license)

## Installation

1. Install the package using `pip`:

```sh
pip install iam-principal-enumerator
```

## Usage

To run the IAM Principal Enumerator, **ensure your terminal session is authenticated to your own attacker-controlled AWS account**, then use the following command:

```sh
iam-principal-enumerator <account_id> [options]
```

### Options

```plain
usage: iam-principal-enumerator [-h] [-r ENUM_ROLE_NAME] [-w WORDLIST] account_id

Enumerate valid IAM principals in an AWS account.

positional arguments:
  account_id            The target AWS account ID

options:
  -h, --help            show this help message and exit
  -r ENUM_ROLE_NAME, --enum-role-name ENUM_ROLE_NAME
                        The name of the IAM role used for enumeration. The role name will
                        be suffixed with an 8-character random string.
  -w WORDLIST, --wordlist WORDLIST
                        Path to a wordlist to use when enumerating IAM principal names.
```

### Examples

Enumerate IAM principals using the default role name and wordlist:

```sh
iam-principal-enumerator 123456789012
```

Enumerate IAM principals using a custom role name and wordlist:

```sh
iam-principal-enumerator 123456789012 -r CustomRole -w /path/to/wordlist.txt
```

## License

This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for details.