> For the complete documentation index, see [llms.txt](https://cajac.gitbook.io/ctf-notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cajac.gitbook.io/ctf-notes/encoding-and-decoding/binary-refinery.md).

# Binary Refinery

## Decoding

### Decode HTML Entities

We can decode [HTML entities](https://ali5723.github.io/fullHTMLEntities/) with [htmlesc](https://binref.github.io/#refinery.htmlesc)

```bash
┌──(kali㉿kali)-[/mnt/…/TryHackMe/Challenges/Medium/GoldenEye]
└─$ source ~/Python_venvs/Binary_Refinery/bin/activate

┌──(Binary_Refinery)─(kali㉿kali)-[/mnt/…/TryHackMe/Challenges/Medium/GoldenEye]
└─$ emit '&#73;&#110;&#118;&#105;&#110;&#99;&#105;&#98;&#108;&#101;&#72;&#97;&#99;&#107;&#51;&#114;' | htmlesc       
InvincibleHack3r
```

### Decode URL-encoding

We can decode URL/percent-encoding with [url](https://binref.github.io/#refinery.url)

```bash
┌──(kali㉿kali)-[~/OffSec_Courses/WEB-200]
└─$ source ~/Python_venvs/Binary_Refinery/bin/activate

┌──(Binary_Refinery)─(kali㉿kali)-[~/OffSec_Courses/WEB-200]
└─$ emit '/callback?%7B%22flag%22%3A%22OS%7BanyDomainWillDo%7D%22%2C%22status%22%3A%22ok%22%7D' | url
/callback?{"flag":"OS{anyDomainWillDo}","status":"ok"}
```

## Resources

Binary Refinery - Documentation: <https://binref.github.io/>

Binary Refinery - GitHub: <https://github.com/binref/refinery/>
