-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathr2pipe.el
63 lines (44 loc) · 1.65 KB
/
r2pipe.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
3;;; r2pipe.el --- r2pipe for emacs -*- lexical-binding: t -*-
;; Author: Tassos Manganaris
;; Maintainer: Tassos Manganaris
;; Version: 0.1
;; Package-Requires: ()
;; Homepage: https://github.com/Tass0sm/r2pipe.el
;; Keywords: radare, radare2, reverse engineering
;; This file is not part of GNU Emacs
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; For a full copy of the GNU General Public License
;; see <http://www.gnu.org/licenses/>.
;;; Commentary:
;; r2pipe for emacs
;;; Code:
(defgroup r2pipe nil
"Run and interact with radare2 under Emacs."
:prefix "r2pipe-"
:group 'tools)
(defcustom r2-bin-path "/usr/bin/r2"
"The path to the radare2 program.")
(setq latest-output nil)
(defun r2--copy-output-filter (process output)
(setq latest-output output))
(defun r2open (file)
(make-process :name "r2pipe" :buffer "r2pipe"
:command (list r2-bin-path "-q0" file)
:connection-type 'pipe
:filter 'my-process-filter
:stderr (get-buffer-create " r2-stderr")))
(defun r2write (process cmd)
(process-send-string process (concat cmd "\n")))
(defun r2cmd (process cmd)
(r2write process cmd)
(sit-for 0.5)
latest-output)
(provide 'r2pipe)
;;; r2pipe.el ends here