Giter Club home page Giter Club logo

Comments (5)

cielonet avatar cielonet commented on June 11, 2024

I know I modified to use 0.7.0 but I confirmed 0.6.0 also gets same error!

root@362df194b334:/data# mkdir out
root@362df194b334:/data# bin2ml extract --fpath /bin/true --output-dir out --mode cfg
[2023-12-06T03:43:37Z INFO  bin2ml] Creating extraction job
[2023-12-06T03:43:37Z INFO  bin2ml] Single file found
[2023-12-06T03:43:37Z INFO  bin2ml] Extraction Job Type: CFG
[2023-12-06T03:43:37Z INFO  bin2ml::extract] out/true_cfg.json not found. Continuing processing.
[2023-12-06T03:43:37Z INFO  bin2ml::extract] Executing agfj @@f on /bin/true
[2023-12-06T03:43:37Z INFO  bin2ml::extract] Closing r2p process for /bin/true
[2023-12-06T03:43:37Z INFO  bin2ml::extract] Starting JSON fixup for /bin/true
[2023-12-06T03:43:37Z INFO  bin2ml::extract] JSON fixup finished for /bin/true
[2023-12-06T03:43:37Z INFO  bin2ml] Extraction complete for /bin/true
root@362df194b334:/data# bin2ml extract --fpath /bin/true --output-dir out --mode reg
[2023-12-06T03:43:42Z INFO  bin2ml] Creating extraction job
[2023-12-06T03:43:42Z INFO  bin2ml] Single file found
[2023-12-06T03:43:42Z INFO  bin2ml] Extraction Job Type: Register Behaviour
[2023-12-06T03:43:42Z INFO  bin2ml::extract] Starting register behaviour extraction
[2023-12-06T03:43:42Z INFO  bin2ml::extract] Getting function information from binary
[2023-12-06T03:43:42Z INFO  bin2ml::extract] Executing aeafj for each function
thread 'main' panicked at src/extract.rs:311:45:
Unable to convert to JSON object!: Error("invalid value: integer `18446744073709551615`, expected i64", line: 1, column: 2449)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Aborted (core dumped)

from bin2ml.

cielonet avatar cielonet commented on June 11, 2024

Full Backtrace

root@e3dd4fe48b76:/data# RUST_BACKTRACE=full bin2ml extract --fpath /bin/true --output-dir out --mode reg
[2023-12-06T04:06:15Z INFO  bin2ml] Creating extraction job
[2023-12-06T04:06:15Z INFO  bin2ml] Single file found
[2023-12-06T04:06:15Z INFO  bin2ml] Extraction Job Type: Register Behaviour
[2023-12-06T04:06:15Z INFO  bin2ml::extract] Starting register behaviour extraction
[2023-12-06T04:06:15Z INFO  bin2ml::extract] Getting function information from binary
[2023-12-06T04:06:15Z INFO  bin2ml::extract] Executing aeafj for each function
thread 'main' panicked at src/extract.rs:311:45:
Unable to convert to JSON object!: Error("invalid value: integer `18446744073709551615`, expected i64", line: 1, column: 2449)
stack backtrace:
   0:     0x55f6d559fb4c - std::backtrace_rs::backtrace::libunwind::trace::h67a838aed1f4d6ec
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x55f6d559fb4c - std::backtrace_rs::backtrace::trace_unsynchronized::h1d1786bb1962baf8
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55f6d559fb4c - std::sys_common::backtrace::_print_fmt::h5a0b1f807a002d23
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x55f6d559fb4c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hf84ab6ad0b91784c
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x55f6d55cc69c - core::fmt::rt::Argument::fmt::h28f463bd1fdabed5
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/fmt/rt.rs:138:9
   5:     0x55f6d55cc69c - core::fmt::write::ha37c23b175e921b3
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/fmt/mod.rs:1114:21
   6:     0x55f6d559c7fe - std::io::Write::write_fmt::haa1b000741bcbbe1
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/io/mod.rs:1763:15
   7:     0x55f6d559f934 - std::sys_common::backtrace::_print::h1ff1030b04dfb157
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x55f6d559f934 - std::sys_common::backtrace::print::hb982056c6f29541c
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x55f6d55a1063 - std::panicking::default_hook::{{closure}}::h11f92f82c62fbd68
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:272:22
  10:     0x55f6d55a0d84 - std::panicking::default_hook::hb8810fe276772c66
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:292:9
  11:     0x55f6d55a15e5 - std::panicking::rust_panic_with_hook::hd2f0efd2fec86cb0
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:731:13
  12:     0x55f6d55a14e1 - std::panicking::begin_panic_handler::{{closure}}::h3651b7fc4f61d784
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:609:13
  13:     0x55f6d55a0076 - std::sys_common::backtrace::__rust_end_short_backtrace::hbc468e4b98c7ae04
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:170:18
  14:     0x55f6d55a1232 - rust_begin_unwind
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:597:5
  15:     0x55f6d4ccb165 - core::panicking::panic_fmt::h979245e2fdb2fabd
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/panicking.rs:72:14
  16:     0x55f6d4ccb733 - core::result::unwrap_failed::h8c4b86241881fbbb
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1652:5
  17:     0x55f6d4e3c152 - core::result::Result<T,E>::expect::he5f5e88010243300
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/result.rs:1034:23
  18:     0x55f6d4d5d1ad - bin2ml::extract::FileToBeProcessed::extract_register_behaviour::haae871e53cc61166
                               at /opt/bin2ml/src/extract.rs:311:17
  19:     0x55f6d4d8c5a3 - bin2ml::main::habbebb2823d940bb
                               at /opt/bin2ml/src/main.rs:815:21
  20:     0x55f6d4e1583b - core::ops::function::FnOnce::call_once::he49eb80480453bc2
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:250:5
  21:     0x55f6d4ddf76e - std::sys_common::backtrace::__rust_begin_short_backtrace::hb99d6e8691d383b9
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/sys_common/backtrace.rs:154:18
  22:     0x55f6d4e2d9c1 - std::rt::lang_start::{{closure}}::hf2931d54c2103a66
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:166:18
  23:     0x55f6d559412b - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hf9057cfaeeb252e2
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/core/src/ops/function.rs:284:13
  24:     0x55f6d559412b - std::panicking::try::do_call::h629e203a624883e4
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:504:40
  25:     0x55f6d559412b - std::panicking::try::h7b61614724d6a4f1
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:468:19
  26:     0x55f6d559412b - std::panic::catch_unwind::h354ac1c0268491d8
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panic.rs:142:14
  27:     0x55f6d559412b - std::rt::lang_start_internal::{{closure}}::h919fee3c5ba8f617
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:148:48
  28:     0x55f6d559412b - std::panicking::try::do_call::h54583f67455bff32
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:504:40
  29:     0x55f6d559412b - std::panicking::try::hb0e12c4e01d39dc2
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panicking.rs:468:19
  30:     0x55f6d559412b - std::panic::catch_unwind::h367b6339e3ca9a3b
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/panic.rs:142:14
  31:     0x55f6d559412b - std::rt::lang_start_internal::ha5ce8533eaa0fda8
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:148:20
  32:     0x55f6d4e2d99a - std::rt::lang_start::h3b86df858eab145f
                               at /rustc/79e9716c980570bfd1f666e3b16ac583f0168962/library/std/src/rt.rs:165:17
  33:     0x55f6d4d9a5ae - main
  34:     0x7f6cd9f671ca - <unknown>
  35:     0x7f6cd9f67285 - __libc_start_main
  36:     0x55f6d4ccba31 - _start
  37:                0x0 - <unknown>

from bin2ml.

cielonet avatar cielonet commented on June 11, 2024

Modified extract.rs i64 to u64 and it works! But I'm not sure if this is the intended result from this tool given negative values will not be captured perhaps?

// Structs related to AEAFJ
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct AEAFJRegisterBehaviour {
    #[serde(rename = "A")]
    pub a: Vec<String>,
    #[serde(rename = "I")]
    pub i: Vec<String>,
    #[serde(rename = "R")]
    pub r: Vec<String>,
    #[serde(rename = "W")]
    pub w: Vec<String>,
    #[serde(rename = "V")]
    pub v: Vec<String>,
    #[serde(rename = "N")]
    #[serde(default)]
    pub n: Vec<String>,
    #[serde(rename = "@R")]
    #[serde(default)]
    pub r2: Vec<u64>,
    #[serde(rename = "@W")]
    #[serde(default)]
    pub w2: Vec<u64>,
}
root@80a0d156bece:/data# bin2ml extract --fpath /bin/true --output-dir out --mode reg
[2023-12-06T11:41:35Z INFO  bin2ml] Creating extraction job
[2023-12-06T11:41:35Z INFO  bin2ml] Single file found
[2023-12-06T11:41:35Z INFO  bin2ml] Extraction Job Type: Register Behaviour
[2023-12-06T11:41:35Z INFO  bin2ml::extract] Starting register behaviour extraction
[2023-12-06T11:41:36Z INFO  bin2ml::extract] Getting function information from binary
[2023-12-06T11:41:36Z INFO  bin2ml::extract] Executing aeafj for each function
[2023-12-06T11:41:36Z INFO  bin2ml::extract] All functions processed
[2023-12-06T11:41:36Z INFO  bin2ml::extract] r2p closed
[2023-12-06T11:41:36Z INFO  bin2ml::extract] Writing extracted data to file
[2023-12-06T11:41:36Z INFO  bin2ml] Extraction complete for /bin/true

from bin2ml.

br0kej avatar br0kej commented on June 11, 2024

Hey @cielonet! Thanks for raising this issue.

I'll have a look at what style radare2 uses internally and then open a MR for the fix.

I've run into this a few times already in some of the other extract functionality and have typically fixed by converting the value to a string. I much prefer your approach!

from bin2ml.

br0kej avatar br0kej commented on June 11, 2024

The dtype used within r2 is a u64 so definitely a good idea mirroring it! The change has been pushed to main

from bin2ml.

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.