Code Monkey home page Code Monkey logo

Comments (9)

radare avatar radare commented on June 12, 2024

from radare2-bindings.

SiriK404 avatar SiriK404 commented on June 12, 2024

i have installed all the necessary libraries and valabind and swig. Post that when i install lang-python i get:

r2pm -i lang-python

Module version mismatch /root/.local/share/radare2/plugins/lang_python.so (3.1.2) vs (3.9)
Already up to date.
Install Done For lang-python
==> Using valabind ?-1.7.0
==> Using swig 3.0.12
Checking valabind languages support...
WARNING: cannot find valabind

  • gir: no
  • cxx: yes (g++)
  • valac: yes
    Supported langs:
  • cxx
  • duktape
  • valac
    checking build system type... x86_64-unknown-linux-gnu
    checking host system type... x86_64-unknown-linux-gnu
    checking target system type... x86_64-unknown-linux-gnu
    checking for working directories... current
    using prefix '/root/.local/share/radare2/prefix'
    checking for c compiler... gcc
    checking for c++ compiler... g++
    checking for valabind... /usr/bin/valabind
    checking for swig... /usr/bin/swig
    checking for g-ir-compiler... no
    Using PKGCONFIG: pkg-config
    checking pkg-config flags for r_core... yes
    creating ./config.mk
    cleaning temporally files... done

Final report:

  • PREFIX = /root/.local/share/radare2/prefix
  • HAVE_SWIG = 1
  • HAVE_VALABIND = 1
  • HAVE_GIRCOMPILER = 0
    make: Entering directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p'
    rm -f python.o lang_python.so
    make: Leaving directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p'
    make: Entering directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p'
    rm -f lang_python.so
    make lang_python.so
    make[1]: Entering directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p'
    cc python.c python/.c -I/root/.local/share/radare2/prefix/include -I/usr/include/libr -I/usr/include/capstone -I/usr/include/libr -DPREFIX="/root/.local/share/radare2/prefix" -I/usr/include/libr -I/usr/include/capstone -I/usr/include/libr -DPREFIX="/root/.local/share/radare2/prefix" -I/usr/include/python3.6m -I/usr/include/python3.6m -Wno-unused-result -Wsign-compare -g -fdebug-prefix-map=/build/python3.6-TJnsCc/python3.6-3.6.8=. -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall -DPYVER=3 -lpython3.6m -lpthread -ldl -lutil -lm -L/usr/lib -lr_core -lr_io -lr_util -shared -lr_asm
    -I/usr/include/libr -I/usr/include/capstone -I/usr/include/libr -lr_core -lcapstone -lr_config -lr_debug -lr_bin -lr_anal -lr_bp -lr_egg -lr_asm -lr_lang -lr_parse -lr_flag -lr_reg -lr_search -lr_syscall -lr_fs -lr_io -lr_socket -lr_magic -lmagic -lr_crypto -lr_hash -lxxhash -lr_cons -lr_util -lz -lzip -ldl
    -L/root/.local/share/radare2/prefix/lib -lr_core -lr_io -lr_util -shared -lr_asm -fPIC -o lang_python.so
    python/anal.c: In function ‘Radare_plugin_anal’:
    python/anal.c:253:10: warning: assignment to ‘RAnalOpCallback’ {aka ‘int (
    )(struct r_anal_t *, struct r_anal_op_t *, long long unsigned int, const unsigned char , int)’} from incompatible pointer type ‘int ()(RAnal *, RAnalOp *, long long unsigned int, const unsigned char , int, RAnalOpMask)’ {aka ‘int ()(struct r_anal_t *, struct r_anal_op_t *, long long unsigned int, const unsigned char *, int, enum )’} [-Wincompatible-pointer-types]
    ap->op = py_anal;
    ^
    python/bin.c: In function ‘create_PyBinFile’:
    python/bin.c:165:23: warning: implicit declaration of function ‘r_buf_data’; did you mean ‘r_buf_dump’? [-Wimplicit-function-declaration]
    const ut8 *buf_ptr = r_buf_data (binfile->buf, &buf_size);
    ^~~~~~~~~~
    r_buf_dump
    python/bin.c:165:23: warning: initialization of ‘const unsigned char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    python/bin.c: In function ‘py_load_buffer’:
    python/bin.c:318:24: warning: initialization of ‘const unsigned char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
    const ut8 buf_data = r_buf_data (buf, &size);
    ^~~~~~~~~~
    python/bin.c: In function ‘Radare_plugin_bin’:
    python/bin.c:725:19: warning: assignment to ‘void * (
    )(RBinFile *, RBuffer *, long long unsigned int, Sdb )’ {aka ‘void * ()(struct r_bin_file_t *, struct r_buf_t *, long long unsigned int, struct sdb_t )’} from incompatible pointer type ‘_Bool ()(RBinFile *, void **, RBuffer *, long long unsigned int, Sdb )’ {aka ‘_Bool ()(struct r_bin_file_t *, void **, struct r_buf_t *, long long unsigned int, struct sdb_t )’} [-Wincompatible-pointer-types]
    bp->load_buffer = py_load_buffer;
    ^
    python/bin.c:731:15: warning: assignment to ‘int (
    )(RBinFile )’ {aka ‘int ()(struct r_bin_file_t )’} from incompatible pointer type ‘void ()(RBinFile )’ {aka ‘void ()(struct r_bin_file_t *)’} [-Wincompatible-pointer-types]
    bp->destroy = py_destroy;
    ^
    At top level:
    python/bin.c:295:13: warning: ‘py_load’ defined but not used [-Wunused-function]
    static bool py_load(RBinFile *arch) {
    ^~~~~~~
    python/io.c: In function ‘py_io_open’:
    python/io.c:16:7: warning: variable ‘fd’ set but not used [-Wunused-but-set-variable]
    int fd = -1;
    ^~
    make[1]: Leaving directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p'
    make: Leaving directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p'
    make: Entering directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p'
    mkdir -p /root/.local/share/radare2/plugins
    cp -f lang_python.so /root/.local/share/radare2/plugins
    make: Leaving directory '/root/.local/share/radare2/r2pm/git/radare2-bindings/libr/lang/p'

It creates a lang-python.so but when i try to import it within a plugin it says module not found.Please help with this.I think its a path issue i dont know how to fix it.

from radare2-bindings.

SiriK404 avatar SiriK404 commented on June 12, 2024

Also when i go to r2 console:
[0x00000000]> #!
c: (LGPL) C language extension
cpipe: (LGPL) r2pipe scripting in C
vala: (LGPL) Vala language extension
rust: (MIT) Rust language extension
zig: (MIT) Zig language extension
pipe: (LGPL) Use #!pipe node script.js
lib: (LGPL) Load libs directly into r2
[0x00000000]>

from radare2-bindings.

XVilka avatar XVilka commented on June 12, 2024

In my opinion, lang-python should be decoupled from the radare2-bindings repo, since it's the most commonly installed plugin anyway, will reduce the installation time and remove the need for all these deps. It will be possible to simplify the building as well. Probably duktape too, but that's it. There is a less interest for everything else.
@radare @thestr4ng3r @ITAYC0HEN @xarkes what do you think?

from radare2-bindings.

SiriK404 avatar SiriK404 commented on June 12, 2024

i am using a fresh kali image this time 2019.1 and post installation on lang-python when i try to import it using r2 i get:
r2: symbol lookup error: /root/.local/share/radare2/plugins/lang_python.so: undefined symbol: r_buf_data

To resolve this error i installed r2 again using apt but then i get module version mismatch error and r2lang is not found...

from radare2-bindings.

XVilka avatar XVilka commented on June 12, 2024

@JIRAya-Sama show the output of r2 -version. I think you have too old radare2.

from radare2-bindings.

SiriK404 avatar SiriK404 commented on June 12, 2024

r2 -version

radare2 3.1.2 0 @ linux-x86-64 git.3.1.2
commit: HEAD build: 2018-12-11__11:34:51

i updated r2 using apt install....but then i get module version mismatch with lang-python

from radare2-bindings.

XVilka avatar XVilka commented on June 12, 2024

Way too old. Remove the distribution one and install from the sources.

from radare2-bindings.

XVilka avatar XVilka commented on June 12, 2024

Once you installed, you can just clone https://github.com/radareorg/radare2-rlang and run "make".

from radare2-bindings.

Related Issues (20)

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.