Giter VIP home page Giter VIP logo

r2clemency's Introduction

r2cLEMENCy

DEF CON 25 CTF Finals, organized by Legitimate Business Syndicate, used a brand new architecture called cLEMENCy. It features many bizarre designs:

  • 9-bit bytes (referred as nytes)
  • 27-bit general-purpose registers
  • Middle-endian
    • A word of 2 nytes is represented as a[1] << 9 | a[0]
    • A word of 3 nytes is represented as a[1] << 27 | a[2] << 18 | a[0]
  • Variable length instructions (18,27,36,54 bits) which are serialized in middle-endian. Opcodes are between 5 bits and 18 bits.

Memory mappings:

[0000000,4000000) Main Program Memory
[4000000,400001e) Clock IO
[4010000,4011000) Flag IO
[5000000,5002000) Data Received
[5002000,5002003) Data Received Size
[5010000,5012000) Data Sent
[5012000,5012003) Data Sent Size
[5100000,5104000) NFO file
[7ffff00,7ffff1c) Interrupt Pointers
[7ffff80,8000000) Processor Identification and Features

This repository contains a bunch of radare2 plugins for cLEMENCy.

Building

This repository can be built either standalone or as a subdirectory of radare2-extras.

Standalone

Specify PKG_CONFIG_PATH if you install radare2 to a user directory.

# cd clemency
PKG_CONFIG_PATH=~/.config/radare2/prefix/lib/pkgconfig make

Subdirectory of radare2-extras

(cd ..  # cd radare2-extras
./configure --prefix=~/.config/radare2/prefix  # generates options.mk
)
make

make info to see used environment variables.

Installation

  • make symstall: install symlinks to R2PM_PLUGDIR and R2PM_SHAREDIR
  • make install: install files

Usage

DEF CON CTF 2017 Final Scores and Data Dumps

DEF CON 25 CTF Finals service binaries/ contains service binaries used in DEF CON CTF Finals.

r2 -e asm.parser=clcy -e asm.midflags=1 -a clcy clcy:///tmp/babyecho

Components

  • io/io_clcy.c: expands 9-bit to 16-bit and unexpands 16-bit when closing
  • core/core_clcy.c: hexdump commands tailored to 9-bit
  • bin/bin_clcy.c: creates sections for cLEMENCy memory mappings, and sets up the NFO section
  • asm/asm_clcy.c: disassembler and assembler. include/opcode-inc.h is taken from https://github.com/pwning/defcon25-public by Plaid Parliament of Pwning
  • anal/anal_clcy.c: instruction classifier and ESIL translator
  • parse/parse_clcy.c: C-like pseudo disassembler and variable substituter

Features

io_clcy

  • Expand 9-bit to 16-bit

bin_clcy

  • Loader: om

core_clcy

  • 9-bit hexdump: _px _pw _pt

asm_clcy

  • Disassembler: pd
  • Instruction descriptions: e asm.describe=1
  • Assembler: e io.cache=1; wa ldt r1, [r0+0x57, 5]

anal_clcy

  • Instruction analyzer
  • ESIL translator: e asm.emu=1

parse_clcy

  • C-like pseudo disassembler: aa; pdc

r2clemency's People

Contributors

maskray avatar xvilka avatar radare avatar

Stargazers

Zhao YuPeng avatar  avatar  avatar  avatar LeadroyaL avatar  avatar QGW avatar Floating Guy avatar xd_xd/xd avatar  avatar  avatar  avatar  avatar 煎饼果子 avatar luohy15 avatar  avatar JP3BGY avatar Noma avatar Ren Kimura avatar Hanqing Zhao avatar  avatar latyas avatar NWMonster avatar

Watchers

 avatar James Cloos avatar  avatar

Forkers

heruix

r2clemency's Issues

error in bin/bin_clcy.c:404:8: r_io_create_mem_map

I use manjaro 4.9.60-1-MANJARO,and I fail to install it,updating maybe neccesary

bin/bin_clcy.c: 在函数‘_patch_relocs’中:
bin/bin_clcy.c:404:8: 错误:提供给函数‘r_io_create_mem_map’的实参太少
(void)r_io_create_mem_map (b->iob.io, &sec, NFO_VADDR, false);
^~~~~~~~~~~~~~~~~~~
In file included from /usr/include/libr/r_bin.h:6:0,
from bin/bin_clcy.c:2:
/usr/include/libr/r_io.h:485:12: 附注:在此声明
R_API bool r_io_create_mem_map(RIO *io, RIOSection *sec, ut64 at, bool null, bool do_skyline);
^~~~~~~~~~~~~~~~~~~
make: *** [Makefile:28:bin/bin_clcy.o] 错误 1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.