Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrd0ll4r/bad-bits-cid-converter

Converts CIDs into the format expected by the bad bits denylist
https://github.com/mrd0ll4r/bad-bits-cid-converter

Last synced: 21 days ago
JSON representation

Converts CIDs into the format expected by the bad bits denylist

Awesome Lists containing this project

README

        

# bad-bits-cid-converter

Converts CIDs and IPFS URIs to the format expected by the [bad bits denylist](https://badbits.dwebops.pub/).

## Building

On recent versions of go, build via
```
go build ./cmd/bad-bits-cid-converter/
```

Alternatively, build within docker via
```
./build-in-docker.sh
```
The output will be placed in `out/`

## Running

The tool reads lines from STDIN and writes converted results to STDOUT, together with the original.
Errors are written to STDERR and can be safely redirected.

Input:
```

/path
...
```

Output:
```


...
```

You can easily pipe data into it, like so:
```
cat | bad-bits-cid-converter 2>/dev/null | ...
```

Input lines can be either
- blank CIDs, e.g. `Qm.....`
- IPFS URIs, e.g. `ipfs://Qm.../`
- CIDs with subdirectory paths, e.g. `Qm...//`
- Absolute IPFS paths, e.g. `/ipfs/Qm...//`

They will be converted to `/`, SHA256 hashed, and hex-encoded.

The results can then be searched for in the [deny list](https://badbits.dwebops.pub/)

### Comparing to the deny list

You can download and prepare the deny list like so:
```
curl https://badbits.dwebops.pub/denylist.json | jq '.[].anchor' -r > deny-list.txt
```

And then compare output from this tool like so:
```
cat | bad-bits-cid-converter 2>/dev/null | grep -F -f deny-list.txt
```

## License

MIT, see [LICENSE](LICENSE).