Skip to content

Commit

Permalink
Temporarily bump 0.5.0
Browse files Browse the repository at this point in the history
We temporarily use MiddleEnd packages from NuGet:
https://www.nuget.org/packages?q=B2R2.MiddleEnd
  • Loading branch information
sangkilc committed Oct 22, 2021
1 parent 9f5e7f7 commit c970898
Show file tree
Hide file tree
Showing 603 changed files with 46,290 additions and 36,383 deletions.
4 changes: 4 additions & 0 deletions .b2r2-ci.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"evaltest": "41af9961df3c75106aedefef2be91a0c96092604",
"switchtest": "fb9e2a0f94ed7cdf0dbd44e618ffdbb5cf153989"
}
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"b2r2.rearend.launcher": {
"version": "0.4.0",
"commands": [
"b2r2"
]
}
}
}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@

build/

B2R2.log
B2R2.log
17 changes: 7 additions & 10 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
image: mcr.microsoft.com/dotnet/core/sdk:3.1
image: mcr.microsoft.com/dotnet/sdk:5.0-focal

stages:
- build
- evaltest
- extra

build:
stage: build
Expand All @@ -14,18 +14,15 @@ build:
artifacts:
paths:
- build/
expire_in: 1 day
expire_in: 3 hrs
tags:
- b2r2

evaltest:
stage: evaltest
extra:
stage: extra
script:
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@softsec.kaist.ac.kr:8888/B2R2/evaltest
- dotnet nuget locals all --clear
- |
dotnet run -c Release --project evaltest/B2R2.TestDriver -- \
$TRACE_URL $CI_COMMIT_REF_NAME $CI_COMMIT_SHA "$GITLAB_USER_NAME"
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@softsec.kaist.ac.kr:8000/B2R2/ci-runner
- dotnet run -p ci-runner/CIStarter -- $CI_URL $CI_COMMIT_SHA $CI_COMMIT_REF_NAME "$GITLAB_USER_NAME"
dependencies:
- build
tags:
Expand Down
6 changes: 6 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,22 @@
B2R2 would not have been possible without the help of contributors. Below is a
list of contributors in alphabetic order.

- Anar Abbas
- Mehdi Aghakishiyev
- TA Thanh Dinh
- HyungSeok Han
- Cheonhoo Jeon
- Subin Jeong
- Minkyu Jung
- Dohyeok Kim
- Dongkwan Kim
- Doyeon Kim
- Hongsik Kim
- Jaemin Kim
- JungHyun Kim
- Kangsu Kim
- Junoh Lee
- Minsu Lee
- DongYeop Oh
- MyeongGeun Shin
- Michael Tegegn
1,032 changes: 483 additions & 549 deletions B2R2.sln

Large diffs are not rendered by default.

7 changes: 2 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,8 @@ using the following tags:

### F# Coding Style

Please read the [F# design
guidelines](https://fsharp.org/specs/component-design-guidelines/) and the [F#
style
guideline](https://github.com/fsprojects/fantomas/blob/master/docs/FormattingConventions.md),
before you proceed as we mostly follow these guidelines.
Please read the [F# code formatting guideline](https://docs.microsoft.com/en-us/dotnet/fsharp/style-guide/formatting),
before you proceed as we mostly follow it.

#### Basic Rules

Expand Down
11 changes: 8 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
<Product>B2R2</Product>
<Authors>SoftSec Lab. @ KAIST</Authors>
<Company>SoftSec Lab. @ KAIST</Company>
<VersionPrefix>0.4.0</VersionPrefix>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<Description>B2R2: the Next-Generation Reversing Platform</Description>
<VersionPrefix>0.5.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<Copyright>Copyright (c) SoftSec Lab. @ KAIST, since 2016</Copyright>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<RepositoryUrl>https://github.com/B2R2-org/B2R2</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://b2r2.org/</PackageProjectUrl>
<PackageTags>Binary;Disassembly;Assembly;CFG;Reversing;x86;AARCH64;MIPS;AVR;ELF;Mach-O;PE</PackageTags>
<CustomPropTarget>$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))</CustomPropTarget>
</PropertyGroup>
<Import Project="$(CustomPropTarget)" Condition="Exists('$(CustomPropTarget)')" />
</Project>
85 changes: 43 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
[![Build status](https://ci.appveyor.com/api/projects/status/0c0tcxh813ev8w6i?svg=true)](https://ci.appveyor.com/project/sangkilc/b2r2)
[![Build Status](https://travis-ci.com/B2R2-org/B2R2.svg?branch=master)](https://travis-ci.com/B2R2-org/B2R2)
![](https://img.shields.io/github/license/B2R2-org/B2R2.svg?style=flat)
[![](https://img.shields.io/nuget/vpre/B2R2.FrontEnd.svg?style=flat)](https://www.nuget.org/packages/B2R2.FrontEnd)
![](https://img.shields.io/tokei/lines/github/B2R2-org/B2R2)
[![](https://img.shields.io/nuget/v/B2R2.RearEnd.Launcher)](https://www.nuget.org/packages/B2R2.RearEnd.Launcher/)

B2R2
====
Expand Down Expand Up @@ -46,16 +47,28 @@ B2R2?
Features?
---------

Currently, our focus is on the front-end of binary analysis, which includes
binary parser, lifter, and optimizer. B2R2 natively supports parallel lifting,
which is a new technique we introduced in 2019 NDSS Bar. Please refer to our
[paper](#citation) for more details about the technique as well as our design
decisions. We also have our own back-end tools such as symbolic executor, but we
are *not* planning to open-source them yet. Nevertheless, B2R2 includes several
useful middle-end or back-end features such as ROP chain compilation, CFG
building, and automatic graph drawing, and etc. B2R2 also comes with a simple
command-line utility that we call [`BinExplorer`](src/Utilities/BinExplorer),
which can help explore such features using a simple command line interface.
B2R2 supports instruction parsing, binary disassembly, assembly, control-flow
recovery, and many more. B2R2 also comes with several user-level command-line
tools that are similar to readelf and objdump, although our tools are
platform-agnostic. B2R2 currently supports four binary file formats: ELF, PE,
Mach-O, and WebAssembly.

Below is a list of features that we currently support. Some of them are work in
progress, but we look forward to your contributions! Feel free to write a PR
(Pull Request) while making sure that you have read our [contribution
guideline](CONTRIBUTING.md).

| Feature | x86 | x86-64 | ARMv7 (& Thumb) | ARMv8 | MIPS32 | MIPS64 | EVM | TMS320C600 | AVR | PPC |
|-----------------------|:-----------:|:------------|:--------------------:|:--------------------:|:--------------------:|:--------------------:|:-----------:|:-----------:|:-----------:|:----------:|
| Instruction Parsing | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :new_moon: |
| Disassembly | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :new_moon: |
| Lifting | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :new_moon: | :full_moon: | :new_moon: |
| CFG Recovery | :full_moon: | :full_moon: | :first_quarter_moon: | :first_quarter_moon: | :first_quarter_moon: | :first_quarter_moon: | :full_moon: | :new_moon: | :new_moon: | :new_moon: |
| Data-Flow | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :new_moon: | :new_moon: | :new_moon: |
| Instruction Emulation | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :full_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: |
| Assembly | :full_moon: | :full_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: |
| REPL | :full_moon: | :full_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: |
| ROP Compilation | :full_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: | :new_moon: |

Dependencies?
-------------
Expand All @@ -68,6 +81,19 @@ leverage.
- [Microsoft.FSharpLu.Json](https://www.nuget.org/packages/Microsoft.FSharpLu.Json/)
- [FParsec](https://www.nuget.org/packages/FParsec)

Note about v0.5.0
-----------------

We have made significant changes in our middle-end (CFG recovery, and function
identification, etc.) engines for this version, and we are still improving it.
The current version is stable enough, but we are actively changing the
implementation while doing some internal research, which is hoding us back for
open-sourcing it. Hence, we decided to partly publicize our tool (everything but
the middle-end engine). We always welcome PRs for our front-end modules :smile:

We may bump few more versions before making everything public, but we will
eventually open-source everything. So please stay tuned!

API Documentation
-----------------

Expand All @@ -94,7 +120,7 @@ Let's try to use B2R2 APIs.
1. Add our nuget package *B2R2.FrontEnd* to the project:
```
$ dotnet add package B2R2.FrontEnd
$ dotnet add package B2R2.FrontEnd.BinInterface
```
1. Modify the `Program.fs` file with your favorite editor as follows:
Expand All @@ -107,9 +133,9 @@ Let's try to use B2R2 APIs.
let main argv =
let isa = ISA.OfString "amd64"
let bytes = [| 0x65uy; 0xffuy; 0x15uy; 0x10uy; 0x00uy; 0x00uy; 0x00uy |]
let handler = BinHandler.Init (isa, bytes)
let ins = BinHandler.ParseInstr handler 0UL
ins.Translate handler.TranslationContext |> printfn "%A"
let hdl = BinHandle.Init (isa, bytes)
let ins = BinHandle.ParseInstr (hdl, 0UL)
ins.Translate hdl.TranslationContext |> printfn "%A"
0
```
Expand All @@ -120,8 +146,8 @@ Let's try to use B2R2 APIs.
Build
-----
Building B2R2 is fun and easy. All you need to do is to install .NET Core SDK
3.0 or above. Yea, that's it!
Building B2R2 is fun and easy. All you need to do is to install .NET 5 SDK or
above. Yea, that's it!
- To build B2R2 in release mode, type ```make release``` or ```dotnet build -c
Release``` in the source root.
Expand All @@ -132,31 +158,6 @@ Building B2R2 is fun and easy. All you need to do is to install .NET Core SDK
For your information, please visit the official web site of F# to get more tips
about installing the development environment for F#: http://fsharp.org/.
Why Reinventing the Wheel?
--------------------------
There are many other great tools available, but we wanted to build a
*functional-first* binary analysis platform that is painless to install and runs
on any platform without any hassle. B2R2 is in its *infancy* stage, but we
believe it provides a rich set of library functions for binary analysis. It also
has a strong front-end that is easily adaptable and extendible! Currently it
reliably supports x86 and x86-64, meaning that we have heavily tested them; and
it partially supports ARMv7 (and Thumb), ARMv8, MIPS32, MIPS64, and EVM meaning
that they work, but we haven't tested them thorougly yet.
Features to be Added?
---------------------
Below is a list of features that we plan to add in the future: the list is
totally incomplete. Some of them are work in progress, but we look forward your
contributions! Feel free to write a PR (Pull Requst) while making sure that you
have read our [contribution guideline](CONTRIBUTING.md).
- Implement CFG recovery algorithms.
- Implement assembler for currently supported ISAs using a parser combinator.
- Support for more architectures such as PPC.
Credits
-------
Expand Down
File renamed without changes
1 change: 0 additions & 1 deletion lib/libfpu/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions lib/libfpu/Makefile

This file was deleted.

7 changes: 0 additions & 7 deletions lib/libfpu/fpu.c

This file was deleted.

17 changes: 5 additions & 12 deletions samples/CSharp/b2r2.csx
Original file line number Diff line number Diff line change
@@ -1,26 +1,19 @@
// ----------------------------------------------------------------------------
// B2R2 C# Sample.
// ----------------------------------------------------------------------------
// Currently we assume that you have published all the binaries into the
// `../../build` directory. To do so, you can simply run `make publish` in the
// source root directory.
// ----------------------------------------------------------------------------

#r "../../build/B2R2.Core.dll"
#r "../../build/B2R2.BinIR.dll"
#r "../../build/B2R2.FrontEnd.Core.dll"
#r "../../build/B2R2.FrontEnd.Library.dll"
#r "nuget: B2R2.FrontEnd.BinInterface"

using System;
using B2R2;
using B2R2.FrontEnd;
using B2R2.BinIR.LowUIR;
using B2R2.FrontEnd.BinLifter;
using B2R2.FrontEnd.BinInterface;

ISA isa = ISA.OfString( "amd64" );
byte [] binary = new byte[] { 0x65, 0xff, 0x15, 0x10, 0x00, 0x00, 0x00 };
BinHandler handler = BinHandler.Init( isa, binary );
BinHandle handler = BinHandle.Init( isa, binary );
// Parse the binary.
Instruction ins = BinHandler.ParseInstr( handler, 0UL );
Instruction ins = BinHandle.ParseInstr( handler, 0UL );
// Disassemble it.
string s = ins.Disasm();
// Print it.
Expand Down
17 changes: 4 additions & 13 deletions samples/FSharp/b2r2.fsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
// ----------------------------------------------------------------------------
// B2R2 F# Sample.
// ----------------------------------------------------------------------------
// Currently we assume that you have published all the binaries into the
// `../../build` directory. To do so, you can simply run `make publish` in the
// source root directory.
// ----------------------------------------------------------------------------

#r "../../build/B2R2.Core.dll"
#r "../../build/B2R2.BinIR.dll"
#r "../../build/B2R2.BinFile.dll"
#r "../../build/B2R2.FrontEnd.Core.dll"
#r "../../build/B2R2.FrontEnd.Library.dll"
#r "nuget: B2R2.FrontEnd.BinInterface"

open B2R2
open B2R2.FrontEnd
open B2R2.BinIR.LowUIR
open B2R2.FrontEnd.BinInterface

let isa = ISA.OfString "amd64"
let bytes = [| 0x65uy; 0xffuy; 0x15uy; 0x10uy; 0x00uy; 0x00uy; 0x00uy |]
let handler = BinHandler.Init (isa, bytes)
let ins = BinHandler.ParseInstr handler 0UL
let hdl = BinHandle.Init (isa, bytes)
let ins = BinHandle.ParseInstr (hdl, 0UL)
ins.Disasm () |> printfn "%s"
23 changes: 0 additions & 23 deletions samples/Python/b2r2.py

This file was deleted.

13 changes: 13 additions & 0 deletions samples/VB/B2R2.vbproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<RootNamespace>VB</RootNamespace>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="B2R2.FrontEnd.BinInterface" Version="0.5.0" />
</ItemGroup>

</Project>
17 changes: 17 additions & 0 deletions samples/VB/Program.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
' ---------------------------------------------------------------------------- '
' B2R2 VB Sample.
' ---------------------------------------------------------------------------- '

Imports System
Imports B2R2
Imports B2R2.FrontEnd.BinInterface

Module Program
Sub Main(args As String())
Dim i = ISA.OfString("amd64")
Dim bs = New Byte() { &H65, &Hff, &H15, &H10, &H00, &H00, &H00 }
Dim hdl = BinHandle.Init(i, bs)
Dim ins = BinHandle.ParseInstr(hdl, 0)
Console.WriteLine(ins.Disasm())
End Sub
End Module
Loading

0 comments on commit c970898

Please sign in to comment.