semvec/pypi-packages huggingface dataset:
pyelle 0.1.0
An extensible, legible, line-based, elegant data solution!
Requires Python: >=3.6

# PyELLE

Originally developed for use in a custom cryptographic protocol, ELLE format is  
extensible, legible, line-based, and elegant!  

Data encoded in ELLE looks like this:

```
|MESSAGE|
TEXT$PLAINTEXT$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
DATA$FLAGS,CAN,BE,ANYTHING$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
OR NOTHING$$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
|/MESSAGE|
```

The data header can be anything, from `MESSAGE` to `PACKET` to `LOVE LETTER`.  
The field names can be anything, and the flags can be anything. Fully extensible.

PyELLE implements ELLE format into Python with these functions and classes:

`class ELLEEntry`
- `self.name`
- `self.flags`
- `self.value`

`class ELLEFile`
- `def find_entry_with_name(self, name: str) -> ELLEEntry | None`
- `def save_file(self, file_name: str) -> None`
- `def set_data_name(self, data_name: str) -> None`
- `def add_entry(self, entry: ELLEEntry) -> None`

`def elle_encode(data_type: str, entries: list[ELLEEntry]) -> str`
`def elle_decode(encoded: str) -> ELLEFile`

For example:

```python
from pyelle import ELLEEntry, ELLEFile, elle_decode, elle_encode

data = b'This is Base64 data.'

entries = (
    ELLEEntry("TEXT", ("PLAINTEXT",), data),
    ELLEEntry("DATA", ("FLAGS", "CAN", "BE", "ANYTHING"), data),
    ELLEEntry("OR NOTHING", (), data)
)

elle_file = ELLEFile(data_name="MESSAGE", values=entries)

# Data is automatically base64 encoded on save.
elle_file.save_file("message.elle")

elle_str = str(elle_file)

print(elle_str)
# Will output:
#
# |MESSAGE|
# TEXT$PLAINTEXT$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
# DATA$FLAGS,CAN,BE,ANYTHING$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
# OR NOTHING$$VGhpcyBpcyBCYXNlNjQgZGF0YS4=
# |/MESSAGE|

# Will reconstruct `elle_file` from str.
reconstructed_elle_file = elle_decode(elle_str)

# Does the same thing as str(ELLEFile)
elle_str = elle_encode("MESSAGE", entries)
```
freeotp-export 0.1.1
Parse a FreeOTP xml file and present QR codes or strings for import elsewhere
Requires Python: ~=3.9

# FreeOTP-Export
[![PyPi Version](https://img.shields.io/pypi/v/freeotp-export.svg)](https://pypi.org/project/freeotp-export/)

Rescue your OTP tokens from FreeOTP

# Not compatible with modern FreeOTP

FreeOTP was finally updated and now uses a different storage format, which
this tool does not yet support. See #1


## Installing
You can install directly through pip: `pip install freeotp-export`

Alternatively, to install from source, clone the repo or download and unpack a
tarball, then...

- If you already have [poetry](https://python-poetry.org/) installed, you can
  just run:
  ```sh
  $ poetry run freeotp-export tokens.xml
  ```
- Otherwise, use pip: `pip install --upgrade .`
- If you must, running `__main__.py` may work if you have the dependencies
  installed.


## Usage
### Acquire the File
If your phone is rooted, you can just grab the file from
`/data/data/org.fedorahosted.freeotp/shared_prefs/tokens.xml`

Otherwise, start by enabling debugging on the phone and setting up the android
platform tools. Grab a backup off the app data by running
`adb backup org.fedorahosted.freeotp`, and when asked for a password, don't
enter one.

To read the resulting Android backup file, `backup.ab`, you can either use
[android-backup-extractor](https://github.com/nelenkov/android-backup-extractor):
```sh
$ abe unpack backup.ab - | tar xv --strip-components=3
```

Or yolo it by adding the tar header yourself:
```sh
$ ( printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" ; tail -c +25 backup.ab ) | tar zxv --strip-components=3
```

You should then have the token file, `tokens.xml`.

### Read the File
Just run this tool, and it'll give you both the OTP URIs (`otpauth://...`) and
scannable QR codes. Note that Google Authenticator
[ignores](https://github.com/google/google-authenticator/wiki/Key-Uri-Format)
the `digits` parameter, so it does not work for issuers like Blizzard that use
lengths other than 6.

If you used `pip install`: `$ freeotp-export tokens.xml`

Or with Poetry: `$ poetry run freeotp-export tokens.xml`

After importing everything to a new app, be sure to delete `tokens.xml` and
`backup.ab`, since they contain all of your tokens!


## See Also
[freeotp-export](https://github.com/viljoviitanen/freeotp-export), an HTML/JS
tool to do the same thing, which I discovered after writing and publishing this.