Skip to main content
# recat
A colorful and highly configurable alternative to the `adb logcat` command from
the Android SDK with on the fly deobfuscation! (based on Marshall Culpepper's great [logcat-color](https://github.com/marshall/logcat-color)).

recat uses [pyretrace](https://github.com/EverythingMe/pyretrace) to deobfuscate logs.

**Note**: recat (logcat-color) is targetted at OS X and Linux, and does not currently
work in Windows.

[![PyPI version](https://badge.fury.io/py/recat-color.svg)](https://badge.fury.io/py/recat-color)

# Installation

**Installation via pip**

```bash
$ pip install recat-color
```

**Installation from source** (requires setuptools, may require sudo)

You can clone the recat git repository directly:

```bash
$ git clone https://github.com/EverythingMe/recat.git
```

To install logcat-color from the source directory, run:

```bash
$ sudo pip install .
```

or

```bash
$ sudo python setup.py install
```

## Examples

#### for logcat-color usage examples, configuration and profiles, go to (logcat-color's original [README](https://github.com/marshall/logcat-color/blob/master/README.md))

##Deobfuscation
**recat** retraces obfuscated logs using [pyretrace](https://github.com/EverythingMe/pyretrace), a python reimplementation on Proguard's Retrace, with a deobfuscation API for python.

When looking at logs from an obfuscated release build, trace messages are obfuscated too, here's a crash log from EverythingMe Launcher's release build:

![original log output](original.png)

Supplying a mapping file path as a command line argument will trigger the deobfuscation mechanism, causing every log line to go through pyretrace's deobfuscator.

```bash
$ recat -m path/to/mapping/file.txt
```

Same log, now with mapping file path added:

![With Recat](deobfuscated.png)

This will make the best effort to deobfuscate the 'message' in each line.

### Deobfuscating tags
The following snippet is taken from [iosched](https://github.com/google/iosched/blob/master/android/src/main/java/com/google/samples/apps/iosched/util/LogUtils.java). It became a pretty popular strategy for log tag creation.

```java
public static String makeLogTag(String str) {
if (str.length() > MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH) {
return LOG_PREFIX + str.substring(0, MAX_LOG_TAG_LENGTH - LOG_PREFIX_LENGTH - 1);
}

return LOG_PREFIX + str;
}

/**
* Don't use this when obfuscating class names!
*/
public static String makeLogTag(Class cls) {
return makeLogTag(cls.getSimpleName());
}
```

If you use this type of deobfuscation and wish to deobfuscate the tag as well, you must supply a prefix for your tags (i.e. `LOG_PREFIX`), here's an example:

EverythingMe Launcher used `ev.` as its base log prefix, adding `-t ev` will now deobfuscate the tags as well:

```bash
$ recat -m path/to/mapping/file.txt -t ev
```
Same output, now with deobfuscated tags:

![Deobfuscated with tags](deobfuscated_with_tags.png)

## TODO - Mapping Fetcher

I also added a skeleton for a mapping file fetcher. It should auto download a mapping file from a file server by supplying a mapping file path template.

## Thanks

Thanks to [Marshall Culpepper](https://github.com/marshall) for the great [logcat-color](https://github.com/marshall/logcat-color).

Release files for recat-color 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for recat-color 0.1.1
File Size Uploaded
recat-color-0.1.1.tar.gz 11.6 kB Details

Release files / recat-color-0.1.1.tar.gz

Download URL recat-color-0.1.1.tar.gz
Size 11.6 kB
Tags Source
SHA-256 checksum
How to use checksums
d3b6650819bf3feb7ec50020f4a17530f31ed685175d2adad1a880051cc25b20
BLAKE2b-256 checksum
How to use checksums
c15b483e5e0f73bf67dc71711a862840aa1e0fc9d591fc97fb0a84988cc748ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page