No description
Find a file
Dhruv Maroo d20f68d7ab
Add *pty API (#3221)
* Initial function signatur and struct for `RzPty` API

* Change type annotation to borrow

* Implement `rz_subprocess_login_tty`

* Add fork mode enum and move pty struct; restructure ifdef guards

* Add rough implementation of forkpty

  * Add `rz_sys` versions for `forkpty` family of functions

* Add forkpty code; Make changes according to review

* Implement forkpty properly and add unit test

  * Add `test_interactive_pty`

* Add documentation

* Remove const in function argument

  * Apparently, MacOS as non-const arguments for `openpty` and `forkpty`

* Add more tests for subprocess forkin using forkpty

  * `test_interactive_pipe_pty`: Create pipes between the slave's PTY
    and master and use them
  * `test_interactive_custom_pty`: Use a custom PTY for the slave

* Add PTY functions exist checks for unit tests

* Move terminal param code inside the forkpty branch

* Add comment about why we need to check `n_bytes = 0` in `subprocess_wait`

* Remove forkpty with a specified `RzPTY`

  * Also, no piping done in forkpty

* Add checks to disallow using `forkpty` with piping

* Make changes according to review

  * No need to check proc file descriptors for -1 in `forkpty` mode, since
    they *will* be -1
  * No need to check `n_bytes == 0` in for `std{out,err}_pty`

* Extract pipe initialization code in `init_pipes` function

* Allow using custom PTY for `rz_subprocess_forkpty`

* Remove const qualifiers for termios and winsize arguments

  * This makes the build pass on MacOS, which does accepts non-const
    arguments

* Change `pid_t` to int so that it compiles on Windows

* Add empty implementation for PTY API for Windows

  * Update function signature for `rz_subprocess_start_opt` for Windows
  * Re-add `#define` for `pid_t` in `librz/socket/run.c`

* Move functions to remove duplicate definitions

* Allow specifying piping options even in `forkpty` mode

    * Only expose the master fd for the streams which have pipe create
      as their piping option

* Add comment about not using `master_fd` directly

* Fix types in definition for Windows

* Free the allocated `RzPTY` object

* Add const qualifiers for `RzPTY` argument

* Assign `fork_mode` and `pty` in all instances of subprocess opt start

    * for good measure

* Compare master fd with -1, not 0

* Remove stray file

* Add second comment about the terminal attribute

* Overhaul the whole PTY implementation

    * Now the caller can either use a pipe or PTY to send and receive
      data from any of the streams
    * Extra option `make_raw` to use the slave PTY in raw mode
    * Add documentation for all the new functions

* Fix UAF bug

* Add error handling for `tcgetattr`

* Move the term param setting code

* Add documentation for the subprocess API and sys API

* Format according to clang-format
2022-12-29 20:38:39 +08:00
.builds Add libmspack and add idpx to extracts compressed pdb (#2728) 2022-06-27 23:52:07 +02:00
.github Enable trivial-auto-var-init and unsigned-char GCC flags (#3232) 2022-12-17 15:27:15 +08:00
.reuse Remove reduntant license entries and READMEs (#2875) 2022-08-08 08:04:26 +08:00
.woodpecker Remove reduntant license entries and READMEs (#2875) 2022-08-08 08:04:26 +08:00
binrz Ensure a name is set in the json output of rz-test 2022-12-06 10:07:38 +08:00
dist Drop libuv dependency 2022-08-06 13:20:52 +02:00
doc doc: add release process documentation 2022-06-02 10:55:51 +02:00
librz Add *pty API (#3221) 2022-12-29 20:38:39 +08:00
LICENSES Move SDB into RzUtil 2022-07-19 08:45:20 +02:00
subprojects Fix endianness for win pagedump and winkd (#3204) 2022-12-09 11:41:28 +01:00
sys Removed rzbochs 2022-12-04 16:53:58 +01:00
test Add *pty API (#3221) 2022-12-29 20:38:39 +08:00
.appveyor.yml Add --print-errorlogs flag meson test for Windows jobs 2022-03-06 16:54:44 +01:00
.clang-format Fix foreach macroses 2021-01-21 22:05:44 +08:00
.dockerignore Drop libuv dependency 2022-08-06 13:20:52 +02:00
.gitattributes Move remaining things from shlr/ to meson subprojects (#2126) 2021-12-22 09:20:39 +08:00
.gitignore Support blake3 hash algo (#3030) 2022-09-17 18:38:21 +02:00
.lgtm.yml Make LGTM use Meson 2021-01-28 11:57:28 +01:00
.prettierignore Move remaining things from shlr/ to meson subprojects (#2126) 2021-12-22 09:20:39 +08:00
.pylintrc For now, let's just ignore C0209 pylint error (#1735) 2021-09-23 13:20:44 +02:00
.travis.yml Fix endianness for win pagedump and winkd (#3204) 2022-12-09 11:41:28 +01:00
BUILDING.md Add note regarding meson.build files and full rebuild (#2795) 2022-07-09 22:57:05 +08:00
CODE_OF_CONDUCT.md Create CODE_OF_CONDUCT.md (#93) 2020-11-24 06:50:10 +02:00
codecov.yml Disable Codecov PR Commenting (#2117) 2021-12-19 13:42:41 +01:00
CODEOWNERS Move remaining things from shlr/ to meson subprojects (#2126) 2021-12-22 09:20:39 +08:00
CONTRIBUTING.md Rename newshell to rzshell and parser commands to statements 2021-04-22 19:45:14 +08:00
COPYING Honor FSF filename license rules (LICENSE->COPYING) 2013-03-30 00:54:05 +01:00
COPYING.LESSER Honor FSF filename license rules (LICENSE->COPYING) 2013-03-30 00:54:05 +01:00
DEVELOPERS.md Edit note regarding Python 3.6 compatibility (#2924) 2022-08-15 22:06:59 +08:00
Dockerfile Use ninja-build from apt in docker (#3056) 2022-09-30 17:03:53 +02:00
Doxyfile Move remaining things from shlr/ to meson subprojects (#2126) 2021-12-22 09:20:39 +08:00
meson.build build: fix BINDIR_DEPTH computation on Windows (#3075) 2022-10-09 10:14:36 +08:00
meson_options.txt Disable rz-pm (script) installation (#3007) 2022-09-05 20:15:46 +02:00
README.md doc: Remove install file and link web page (#3116) 2022-10-28 12:12:23 +02:00
SECURITY.md Update Security policy to be more precise about vulns 2021-08-25 13:13:37 +02:00
snapcraft.yaml Remove rz-agent (#3087) 2022-10-12 10:34:46 +02:00
travis-extract-var.sh SPDX Copyright text for all files based on history 2021-03-05 19:39:15 +08:00
travis-script Move remaining things from shlr/ to meson subprojects (#2126) 2021-12-22 09:20:39 +08:00

Rizin logo

Rizin

Rizin is a fork of the radare2 reverse engineering framework with a focus on usability, working features and code cleanliness.

Rizin is portable and it can be used to analyze binaries, disassemble code, debug programs, as a forensics tool, as a scriptable command-line hexadecimal editor able to open disk files, and much more!

To learn more on Rizin you may want to read the official Rizin book.

How to install

Look at install instructions on our web page.

How to build

Use meson to compile and install Rizin. Please make sure to get an updated meson (e.g. get it with pip install meson if your system does not provide one that is at least version 0.55.0).

Clone this repository:

$ git clone https://github.com/rizinorg/rizin

Then compile and install with:

$ meson build
$ ninja -C build
$ sudo ninja -C build install

Now you can use rizin:

$ rizin
 -- Thank you for using rizin. Have a nice night!
[0x00000000]>

To uninstall rizin, execute sudo ninja -C build uninstall.

Please have a look at BUILDING.md for more information about building Rizin.

Contributing

We very much welcome any kind of contributions, from typos, to documentation, to refactoring, up to completely new features you may think of. Before contributing, we would like you to read the file CONTRIBUTING.md, so that we can all be on the same page.

Tests

Look at test/README.md.

Supported features

Supported Operating Systems

Windows 7 and higher, Apple macOS/iOS/iPadOS, GNU/Linux, [Dragonfly|Net|Free|Open]BSD, Android, QNX, Solaris/Illumos, Haiku, GNU/Darwin, GNU/Hurd.

Supported Architectures

i386, x86-64, ARM/ARM64, RISC-V, PowerPC, MIPS, AVR, SPARC, System Z (S390), SuperH, m68k, m680x, XAP, XCore, CR16, HPPA, ARC, Blackfin, Z80, H8/300, V810, V850, CRIS, XAP, PIC, LM32, 8051, 6502, i4004, i8080, Propeller, Tricore, CHIP-8, LH5801, T8200, GameBoy, SNES, SPC700, MSP430, Xtensa, NIOS II, TMS320 (c54x, c55x, c55+, c66), Hexagon, DCPU16, LANAI, MCORE, mcs96, RSP, C-SKY(MCore), VAX, AMD Am29000.

There is also support for the following bytecode formats:

Dalvik, EBC, Java, Lua, Python, WebAssembly, Brainfuck, Malbolge

Supported File Formats

ELF, Mach-O, Fatmach-O, PE, PE+, MZ, COFF, OMF, NE, LE, TE, XBE, BIOS/UEFI, Dyldcache, DEX, ART, CGC, ELF, Java class, Android boot image, Plan9 executable, ZIMG, MBN/SBL bootloader, ELF coredump, MDMP (Windows minidump), DMP (Windows pagedump), WASM (WebAssembly binary), Commodore VICE emulator, QNX, Game Boy (Advance), Nintendo DS ROMs and Nintendo 3DS FIRMs.

Scripting

We provide a way to interact with Rizin from Python, Haskell, OCaml, Ruby, Rust, and Go languages through rzpipe. Other languages although not currently supported could be easily added.

Community

Our website and blog: https://www.rizin.re/

Join our Mattermost community to discuss Rizin, its development, and general topics related to the project.

We also provide the following partial bridges to other messaging platforms: