GithubHelp home page GithubHelp logo

Comments (7)

ivg avatar ivg commented on July 1, 2024

Python bindings are definitely working with the latest bap, just used it recently :) You probably are doing something wrong but I can't say what, unless you tell me what you're doing. So can you please provide more details on your workflow?

from bap-tutorial.

clslgrnc avatar clslgrnc commented on July 1, 2024

I am just trying to call bap.run as in the tutorial from the docker image at binaryanalysisplatform/bap

user@local:~$ docker run --rm -it binaryanalysisplatform/bap /bin/bash
opam@30b47f6833d0:~$ sudo apt install python3-pip
...
opam@30b47f6833d0:~$ pip3 install bap
...
opam@30b47f6833d0:~$ python3

Then in python3:

>>> import bap
>>> proj = bap.run("/bin/ls")
Traceback (most recent call last):
  File "/home/opam/.local/lib/python3.5/site-packages/bap/noeval_parser.py", line 181, in _parse_end
    top = toint(in_s, k, i, base)
  File "/home/opam/.local/lib/python3.5/site-packages/bap/noeval_parser.py", line 43, in toint
    return of_str(istr, base)
ValueError: invalid literal for int() with base 10: '282_180'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/opam/.local/lib/python3.5/site-packages/bap/bap.py", line 124, in run
    return parser['load'](out)
  File "/home/opam/.local/lib/python3.5/site-packages/bap/bir.py", line 367, in loads
    return noeval_parser.parser(s)
  File "/home/opam/.local/lib/python3.5/site-packages/bap/noeval_parser.py", line 328, in parser
    result = _parser(input_str, logger=logger)
  File "/home/opam/.local/lib/python3.5/site-packages/bap/noeval_parser.py", line 282, in _parser
    i = parse_func(in_c, in_s, i, objs, stk)
  File "/home/opam/.local/lib/python3.5/site-packages/bap/noeval_parser.py", line 183, in _parse_end
    raise ParserInputError("Integer expected between [%d..%d)" % (k, i))
bap.noeval_parser.ParserInputError: Integer expected between [525952..525959)

from bap-tutorial.

clslgrnc avatar clslgrnc commented on July 1, 2024

Using the provided vagrant file, the installation of bap fails:

...
    default: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
    default: [ERROR] The compilation of conf-m4 failed at "/home/vagrant/.opam/opam-init/hooks/sandbox.sh build sh -exc echo | m4".
    default: ∗ installed conf-emacs.1
    default: ∗ installed ocaml-secondary-compiler.4.08.1-1
    default: ∗ installed ocamlbuild.0
    default: 
    default: #=== ERROR while compiling conf-m4.1 ==========================================#
    default: # context              2.0.4 | linux/x86_64 | ocaml-base-compiler.4.02.3 | https://opam.ocaml.org#191daf37
    default: # path                 ~/.opam/4.02.3/.opam-switch/build/conf-m4.1
    default: # command              ~/.opam/opam-init/hooks/sandbox.sh build sh -exc echo | m4
    default: # exit-code            127
    default: # env-file             ~/.opam/log/conf-m4-11231-0ac68e.env
    default: # output-file          ~/.opam/log/conf-m4-11231-0ac68e.out
    default: ### output ###
    default: # + m4
    default: # sh: 1: m4: not found
    default: # + echo
    default: 
    default: <><> Error report <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>
    default: ┌─ The following actions failed
    default: │ λ build conf-m4 1
    default: └─ 
    default: ┌─ The following changes have been performed (the rest was aborted)
    default: │ ∗ install conf-emacs               1
    default: │ ∗ install ocaml-secondary-compiler 4.08.1-1
    default: │ ∗ install ocamlbuild               0
    default: └─ 
...

This is in the middle of vagrant logs, the logs end with:

    default: Successfully installed bap
    default: Cleaning up...

which is a bit misleading as it only concerns the python binding.

from bap-tutorial.

ivg avatar ivg commented on July 1, 2024

The provided vagrant image as well as the docker images already have bap installed, so you don't need to install it at all. Just follow the tutorial.

Concerning the error, it is fine. The python bindings are not for real binaries but for teaching only and work on simple binaries. The ls binary in the docker image is a huge busybox binary (which implements the whole posix shell interface) so there is no surprises it fails.

from bap-tutorial.

ivg avatar ivg commented on July 1, 2024

OK, my mistake, you're not using the vagrant image, but the vagrant file, which is indeed outdated. I will look into it. But the docker image is up-to-date and updated every day. So you can safely use it. Just pick some simpler binary. I would also suggest just installing opam and bap on your machine unless you really prefer to use the docker environment for development.

from bap-tutorial.

clslgrnc avatar clslgrnc commented on July 1, 2024

Ok thanks, I'll try harder then :)

from bap-tutorial.

ivg avatar ivg commented on July 1, 2024

Don't hesitate to ask for help if you run into problems) Also, you may consider joining our gitter channel for faster replies :)

from bap-tutorial.

Related Issues (4)

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.