Git Product home page Git Product logo

medusa's Introduction

Medusa

Medusa is a disassembler designed to be both modular and interactive. It runs on Windows and Linux, it should be the same on OSX. This project is organized as a library. To disassemble a file you have to use medusa_text or qMedusa.

Build-bot

branch Travis AppVeyor
dev Build status of the dev branch on Mac/Linux Build status of the dev branch on Windows

Prerequisites

Medusa requires the following libraries: boost >= 1.55 (system, filesystem, thread, date_time), OGDF (required git), and Qt5 >= 5.2 for the GUI. You also need CMake for compilation and a C++11 compiler (VS2015 update 2 on Windows). Git is optional but allows to clone remote repository for specific features, see Compilation/Options.

Feature

Loader
Name Mapping Import Export Symbols Notes
ELF yes yes no no Some kind of reloc are not handled
PE yes yes yes no Reloc are not handled
Mach-O yes yes no no
  • Doesn't support FAT binary
  • on X86, esi as glbptr is not handled
GameBoy yes yes yes yes
  • GameBoy Color registers are not handled
  • All mappers are not handled
ST62ROM yes yes yes yes  
Architecture
Name Mode Disassembly Semantic Notes
x86 16-bit yes partial Support until SEE4.2
x86 32-bit yes
x86 64-bit yes
z80 gameboy yes yes  
avr8   no no Broken
arm normal partial partial  
arm thumb partial no
arm thumb2 partial no
st62   yes partial  
Tool
Name interactivity Comment Label Graph Database Notes
qt partial yes yes yes yes  
text no no no no yes  
Binding
Name Notes
Python WIP
Database
Name Save Load Notes
text yes yes Incomplete
Operating System
Name Notes
UNIX WIP
Windows

Roadmap

Each versions of Medusa bring a new specific feature.

  • 0.1 the beginning of the project
  • 0.2 new qt interface
  • 0.3 flow graph
  • 0.4 load/save database
  • 0.5 semantic support
  • 0.6 better python binding
  • 0.7 debugger

Compilation

First off, you need boost libraries; you can either download a built version or compile yourself. Boost is available here

Now, make sure you have installed Qt5 if you need a graphical user interface (and I'm pretty sure you do ;)). Medusa requires at least the version 5.2, be sure to pick the good version on the official website or use your package manager.

Finally, we're ready to retrieve and compile medusa:

git clone https://github.com/wisk/medusa.git
mkdir build
cd build
# UNIX users should define CMAKE_BUILD_TYPE e.g. -DCMAKE_BUILD_TYPE=Release to compile Medusa with optimization
cmake -DBOOST_ROOT:PATH=<path to the boost directory> -DQT5_CMAKE_PATH:PATH=<Path to Qt5 cmake scripts directory> ..

# for UNIX users
make && cd bin && ./qMedusa

# for Windows users
explorer Medusa.sln

Note: If CMake is unable to find Boost on Windows, try to define BOOST_LIBRARYDIR. This variable must be set to the library directory (e.g.: C:\boost_1_55_0\lib64-msvc-14.0). In my configuration, QT5_CMAKE_PATH is set to /usr/lib/cmake on ArchLinux and C:\Qt\5.6\msvc2015_64\lib\cmake on Windows. For Windows users, you should probably add -G"Visual Studio 14 Win64" where 14 is your Visual Studio version and Win64 if you build medusa in 64-bit. To run the Qt interface on Windows, you may have to add the folder %QTDIR%\bin to your %PATH% and copy the folder %QTDIR%\plugins\platforms. By default, Medusa searches modules in the current folder, so you should run medusa executables from the folder where modules are located (e.g. build/bin on UNIX or build\bin\{Debug,Release,...} on Windows).

Options

Name Default value Meaning
MEDUSA_BUILD_TOOLS TRUE Compile tools
MEDUSA_BUILD_TESTS TRUE Compile tests
MEDUSA_CMAKE_USE_COTIRE FALSE Use cotire for building
MEDUSA_BUILD_WITH_OGDF FALSE Add OGDF project and build it, this library allows qMedusa to display graph
MEDUSA_MODULES_TO_BUILD "all" Semicolon-separated list of modules to build, or "all"

Screenshots

Main interface

https://raw.github.com/wisk/medusa/dev/img/shots/main_interface.png

Control flow graph

https://raw.github.com/wisk/medusa/dev/img/shots/cfg.png

Interactivity

https://raw.github.com/wisk/medusa/dev/img/shots/interactivity.png

https://raw.github.com/wisk/medusa/dev/img/shots/label.png

Binding

https://raw.github.com/wisk/medusa/dev/img/shots/python_binding.png

Docker image

If you do not wish to install the various dependencies on your system, you can use this docker image instead. Even though it is working out of the box, you may want to customize it to suit your needs or for added security (e.g. restrict ssh access to public key authentication only).

Build the Medusa container

docker build -t medusa .

Going inside the container

docker run -it medusa /bin/bash

OR launch qMedusa (ssh with X forwarding)

  • docker run -it -d medusa
  • ssh -X developer@<containers_ip> "medusa/build/bin/qMedusa"

Contacts

Acknowledgements

  • My schoolmates: epieddy, flalande and FX.
  • My workmate: gg, w1gz, lemme.
  • Yusuke Kamiyamane for his icons
  • gunmetal313, saeschdivara, kangjoni76, KarlVogel, ekse for their contributions.

medusa's People

Contributors

ekse avatar flalande avatar gunmetalbackupgooglecode avatar karlvogel avatar lem2clide avatar wisk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

medusa's Issues

Error when running cmake: extracting cvpixelbuffer archive failed

I am trying to build the dev branch(commit: adb3b54) on Ubuntu 16.04.1 and I encounter the following error:

-- downloading...
     src='https://github.com/hunter-packages/Qt/releases/download/v5.5.1-cvpixelbuffer-2-p9/hunter-5.5.1-cvpixelbuffer-2.7z'
     dst='/home/introssoc/.hunter/_Base/Download/Qt/5.5.1-cvpixelbuffer-2-p9/da86822/hunter-5.5.1-cvpixelbuffer-2.7z'
     timeout='none'
<removed few download progress output>
-- [download 100% complete]
-- downloading... done
-- verifying file...
     file='/home/introssoc/.hunter/_Base/Download/Qt/5.5.1-cvpixelbuffer-2-p9/da86822/hunter-5.5.1-cvpixelbuffer-2.7z'
-- verifying file... done
-- extracting...
     src='/home/introssoc/.hunter/_Base/Download/Qt/5.5.1-cvpixelbuffer-2-p9/da86822/hunter-5.5.1-cvpixelbuffer-2.7z'
     dst='/home/introssoc/.hunter/_Base/8c538a0/a1b471c/15fdb4a/QtBuild/10'
-- extracting... [tar xfz]
CMake Error: Problem with archive_read_next_header(): Damaged 7-Zip archive
CMake Error: Problem extracting tar: /home/introssoc/.hunter/_Base/Download/Qt/5.5.1-cvpixelbuffer-2-p9/da86822/hunter-5.5.1-cvpixelbuffer-2.7z
-- extracting... [error clean up]
CMake Error at /home/introssoc/.hunter/_Base/8c538a0/a1b471c/15fdb4a/Build/Qt/__qtbase/Build/Qt-qtbase-prefix/src/Qt-qtbase-stamp/extract-Qt-qtbase.cmake:33 (message):
  error: extract of
  '/home/introssoc/.hunter/_Base/Download/Qt/5.5.1-cvpixelbuffer-2-p9/da86822/hunter-5.5.1-cvpixelbuffer-2.7z'
  failed

I think the wrong command is being used[extracting... [tar xfz]] to extract a 7zip archive - the archive is not damaged in any way since I could extract it's contents using the file explorer.

Please sanitize the build system

Even if all dependencies listed in README.rst and the build instructions are followed the build system tries download and build giga bytes of common libraries which all are provided by typical Linux distributions. This simply doesn't make any sense as it wastes the time of potential users and contributors without giving them any benefit.

dev or master dont build due to -Werror

[ 49%] Building CXX object src/backends/odbc/CMakeFiles/soci_odbc.dir/blob.cpp.o
/home/eho/work/Workspace/portage/dev-util/medusa-9999/work/medusa-9999/deps/soci/src/backends/odbc/standard-use-type.cpp: In member function ‘void* soci::odbc_standard_use_type_backend::prepare_for_bind(SQLLEN&, SQLSMALLINT&, SQLSMALLINT&)’:
/home/eho/work/Workspace/portage/dev-util/medusa-9999/work/medusa-9999/deps/soci/src/backends/odbc/standard-use-type.cpp:22:12: error: enumeration value ‘x_xmltype’ not handled in switch [-Werror=switch]
switch (type_)
^
/home/eho/work/Workspace/portage/dev-util/medusa-9999/work/medusa-9999/deps/soci/src/backends/odbc/standard-use-type.cpp:22:12: error: enumeration value ‘x_longstring’ not handled in switch [-Werror=switch]
cc1plus: all warnings being treated as errors
src/backends/odbc/CMakeFiles/soci_odbc_static.dir/build.make:182: recipe for target 'src/backends/odbc/CMakeFiles/soci_odbc_static.dir/standard-use-type.cpp.o' failed

The -Werror seems to be introduced by the pybind11 external project.

Needed items for building into a package

  • libraries should install under /usr/lib/medusa or /usr/lib/qmedusa
  • Binaries should install under /usr/bin/
  • Optionally set python to be python2 by default as it fails on ArchLinux, or allow python var to set
  • Provide Cmake variable to set location of medusa modules

OGDF OS X Build Failure

Reference: ogdf/ogdf#11

if("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin")
  #if(${CMAKE_SYSTEM_VERSION} MATCHES "todo-some-number-here")
       add_definitions("-DGTEST_USE_OWN_TR1_TUPLE=1")
  #endif()
endif()

This should be added to the main CMakeLists.txt

Mac OS X Unix Module

Hey,

I wanted to say that your code for unique_module.cpp needs an update so that it works too on OS X:

char const* Module::GetExtension(void)
{
#ifdef __APPLE__
    return "dylib";
#else
    return "so";
#endif
}

error: ‘format’ is not a member of ‘boost’

When compiling on Lubuntu in my virtual machine I get the following error:

medusa/src/core/instruction.cpp:40:22: error: ‘format’ is not a member of ‘boost’
   std::string Res = (boost::format("mnem: %s(%08x), length: %d, prefix: %08x, oprd: %d")

This can be fixed by adding #include <boost/format.hpp> at the top of the instruction.cpp file, but I am assuming I am doing something else wrong during build.

I created the makefiles using cmake -DCMAKE_BUILD_TYPE=Release -DBOOST_ROOT:PATH=/usr/local/lib/ -DLLVM_ROOT=~/User/tools/llvm-build ..

I built boost from the source code directly and installed it using ./b2 install once it was done. The output and a check in the file system finds the installed files in /usr/local/lib.

My boost version is 1.62.0 and there have been CMake warnings before this happens, but it seemed to have found the boost dependencies anyway. This can be seen here

CMake Warning at /usr/share/cmake-3.5/Modules/FindBoost.cmake:725 (message):
  Imported targets not available for Boost version 106200
Call Stack (most recent call first):
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:763 (_Boost_COMPONENT_DEPENDENCIES)
  /usr/share/cmake-3.5/Modules/FindBoost.cmake:1332 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:102 (find_package)


-- Boost version: 1.62.0
-- Found the following Boost libraries:
--   system
--   filesystem
--   thread
--   date_time
--   program_options
--   unit_test_framework

Any ideas what I'm doing wrong?

Compilation Error on Ubuntu 16.04 with boost 1.58 and QT 5.5.1

I am very interesting in playing with this piece of software! but I have problems compiling it.

After executing make, and compiling for a while... I get this error:

make[2]: *** No rule to make target 'src/db/soci/soci/src/soci-build/lib/soci_core_4_0.a', needed by 'lib/db_soci.so'. Stop.
CMakeFiles/Makefile2:583: recipe for target 'src/db/soci/CMakeFiles/db_soci.dir/all' failed
make[1]: *** [src/db/soci/CMakeFiles/db_soci.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

Any way to solve this? Thanks!

Pybind11 - unknown <unsigned int> in enumeration

While trying to build Medusa, I encountered and error while building "src/tools/pydusa/py_memory_area.cpp" line #24 stating - unknown in enumeration

After reviewing src/tools/pydusa/py_memory_area.cpp#24 I make the following change to get build to complete.

change:
py::enum_(rMod, "MemoryAccess")

to:
py::enum_MemoryArea::Access(rMod, "MemoryAccess")

OziDrifter

.mdt files management problems

  • If the file /bin_dir_path/bin_name.mdt doesn't exist and is in a writable directory, no choice is given for the .mdt file location and name
  • If the file /bin_dir_path/bin_name.mdt already exists the "replace" option doesn't work
  • "cancel" button doesn't cancel the opening process, it only closes and re-open the same window

Problem building Docker

I used an Ubuntu 15.10 for building the docker image. While building I got the following error:

...
checking if /usr/bin/cc supports -Werror... yes
checking if /usr/bin/cc supports -Werror=attributes... yes
./configure: line 17571: --print-errors: command not found
checking whether ln -s works... yes
checking for XAU... configure: error: in `/home/developer/.hunter/_Base/8c538a0/a1b471c/d09ac7c/Build/xau/Source':
configure: error: The pkg-config script could not be found or is too old.  Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.

Alternatively, you may set the environment variables XAU_CFLAGS
and XAU_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

To get pkg-config, see <http://pkg-config.freedesktop.org/>.
See `config.log' for more details
CMakeFiles/xau.dir/build.make:105: recipe for target 'xau-prefix/src/xau-stamp/xau-configure' failed
make[2]: *** [xau-prefix/src/xau-stamp/xau-configure] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/xau.dir/all' failed
Makefile:75: recipe for target 'all' failed
make[1]: *** [CMakeFiles/xau.dir/all] Error 2
make: *** [all] Error 2

[hunter ** FATAL ERROR **] Build step failed (dir: /home/developer/.hunter/_Base/8c538a0/a1b471c/d09ac7c/Build/xau
[hunter ** FATAL ERROR **] [Directory:/home/developer/.hunter/_Base/Download/Hunter/unknown/8c538a0/Unpacked/cmake/projects/xau]

apt-get install pkg-config sais: ...already newest version

Running under MATE desktop environment leads to dummy application w/o menu due to stray Ubuntu Unity menu plugin (appmenu-qt5)

I followed instructions to build medusa (I used master branch) on Ubuntu 14.04 system (so, Qt5, etc. as supplied by official repos). In the result, I get completely dummy looking application screen, which even appear to be 90degree rotated. No menus, no nothing. Passing file on command line has no effect. Screenshort attached.

So, what's the actual status of Medusa and how to build working version, similar to provided screenshots on README?

Thanks.
screenshot-medusa

test_arch uses a non existent BOOST_MESSAGE

Hi :)

OS: Windows 10 x64
Boost version: 1.60.0
Tool Chain: Visual Studio C++ 2013 Update 5
Current commit:
$ git rev-parse --verify HEAD
0237f80

In test_arch.cpp it seems that the test for st62 architecture is using an older boost message style (BOOST_MESSAGE instead of BOOST_TEST_MESSAGE) which ultimately results in a compile error (at least if using Boost 1.60.0).

see: https://github.com/wisk/medusa/blob/dev/src/test/test_arch.cpp#L339

Let me know if I'm right or I have missed something.

P.S : compile target is ALL_BUILD, and I'm compiling without Qt

Thank you ! <3

Boost version requirement is not present/incorrect.

I attempted to compile medusa on Slackware 14.0x64. After updating cmake and installing ogdf, the cmake completed successfully, but the make would crash with the following error.

ash-4.2$ make -j2
Scanning dependencies of target Medusa
[  1%] [  1%] Building CXX object src/core/CMakeFiles/Medusa.dir/analyzer.cpp.o
Building CXX object src/core/CMakeFiles/Medusa.dir/address.cpp.o
[  2%] Building CXX object src/core/CMakeFiles/Medusa.dir/architecture.cpp.o
[  3%] Building CXX object src/core/CMakeFiles/Medusa.dir/array.cpp.o
[  4%] Building CXX object src/core/CMakeFiles/Medusa.dir/basic_block.cpp.o
[  5%] Building CXX object src/core/CMakeFiles/Medusa.dir/cell.cpp.o
[  6%] Building CXX object src/core/CMakeFiles/Medusa.dir/cell_action.cpp.o
[  7%] Building CXX object src/core/CMakeFiles/Medusa.dir/cell_data.cpp.o
[  8%] Building CXX object src/core/CMakeFiles/Medusa.dir/cell_text.cpp.o
[  9%] Building CXX object src/core/CMakeFiles/Medusa.dir/character.cpp.o
[ 10%] Building CXX object src/core/CMakeFiles/Medusa.dir/configuration.cpp.o
In file included from /home/oldtopman/applications/medusa/inc/medusa/cell_action.hpp:16:0,
                 from /home/oldtopman/applications/medusa/src/core/cell_action.cpp:1:
/home/oldtopman/applications/medusa/inc/medusa/medusa.hpp:88:98: error: default argument for parameter of type ‘medusa::Architecture::SharedPtr {aka boost::shared_ptr<medusa::Architecture>}’ has type ‘std::nullptr_t’
[ 11%] Building CXX object src/core/CMakeFiles/Medusa.dir/control_flow_graph.cpp.o
make[2]: *** [src/core/CMakeFiles/Medusa.dir/cell_action.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [src/core/CMakeFiles/Medusa.dir/all] Error 2
make: *** [all] Error 2

Updating to Boost 1.56 resolved the problem, so I propose a version check, or at least a modified one.
EDIT: I was on Boost 1.49 before.

build fails mingw

I try to build using mingw 4.9 using boost 1.5.7

mingw32-make
[ 31%] Built target coin
[ 84%] Built target ogdf
[ 85%] Built target ogdf-test
Scanning dependencies of target Medusa
[ 85%] Building CXX object src/core/CMakeFiles/Medusa.dir/analyzer.cpp.obj
In file included from D:/medusa-dev/inc/medusa/det
ail.hpp:7:0,
                 from D:/medusa-dev/inc/medusa/val
ue.hpp:8,
                 from D:/medusa-dev/inc/medusa/mem
ory_area.hpp:7,
                 from D:/medusa-dev/inc/medusa/doc
ument.hpp:9,
                 from D:/medusa-dev/inc/medusa/ana
lyzer.hpp:6,
                 from D:\medusa-dev\src\core\analy
zer.cpp:1:
D:/medusa-dev/inc/medusa/binary_stream.hpp:248:40:
 error: 'INVALID_HANDLE_VALUE' was not declared in this scope
   TFileHandle             m_FileHandle=INVALID_HANDLE_VALUE;
                                        ^
src\core\CMakeFiles\Medusa.dir\build.make:78: recipe for target 'src/core/CMakeF
iles/Medusa.dir/analyzer.cpp.obj' failed
mingw32-make[2]: *** [src/core/CMakeFiles/Medusa.dir/analyzer.cpp.obj] Error 1
CMakeFiles\Makefile2:455: recipe for target 'src/core/CMakeFiles/Medusa.dir/all'
 failed
mingw32-make[1]: *** [src/core/CMakeFiles/Medusa.dir/all] Error 2
makefile:146: recipe for target 'all' failed
mingw32-make: *** [all] Error 2

D:\medusa-dev\build>mingw32-make >d
mingw32-make[2]: *** [deps/ogdf/CMakeFiles/ogdf.dir/depend] Interrupt
mingw32-make[1]: *** [deps/ogdf/CMakeFiles/ogdf.dir/all] Error 130
mingw32-make: *** [all] Error 130

D:\medusa-dev\build>mingw32-make >d
D:\medusa-dev\src\core\windows_binary_stream.cpp:
In constructor 'medusa::FileBinaryStream::FileBinaryStream(const boost::filesyst
em::path&)':
D:\medusa-dev\src\core\windows_binary_stream.cpp:2
5:22: error: invalid conversion from 'HANDLE {aka void*}' to 'medusa::TFileHandl
e {aka int}' [-fpermissive]
 , m_MapHandle(nullptr)
                      ^
D:\medusa-dev\src\core\windows_binary_stream.cpp:
In member function 'void medusa::FileBinaryStream::Open(const boost::filesystem:
:path&)':
D:\medusa-dev\src\core\windows_binary_stream.cpp:4
1:16: error: invalid conversion from 'HANDLE {aka void*}' to 'medusa::TFileHandl
e {aka int}' [-fpermissive]
   m_FileHandle = INVALID_HANDLE_VALUE;
                ^
D:\medusa-dev\src\core\windows_binary_stream.cpp:5
3:7: error: invalid conversion from 'HANDLE {aka void*}' to 'medusa::TFileHandle
 {aka int}' [-fpermissive]
       );
       ^
In file included from D:/mingw32/i686-w64-mingw32/
include/winbase.h:19:0,
                 from D:/mingw32/i686-w64-mingw32/
include/Windows.h:70,
                 from D:\medusa-dev\src\core\windo
ws_binary_stream.cpp:3:
D:\medusa-dev\src\core\windows_binary_stream.cpp:5
5:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissiv
e]
   if (m_FileHandle == INVALID_HANDLE_VALUE)
                       ^
D:\medusa-dev\src\core\windows_binary_stream.cpp:6
0:44: error: invalid conversion from 'medusa::TFileHandle {aka int}' to 'HANDLE
{aka void*}' [-fpermissive]
   if (GetFileSizeEx(m_FileHandle, &FileSize) == FALSE)
                                            ^
In file included from D:/mingw32/i686-w64-mingw32/
include/winbase.h:18:0,
                 from D:/mingw32/i686-w64-mingw32/
include/Windows.h:70,
                 from D:\medusa-dev\src\core\windo
ws_binary_stream.cpp:3:
D:/mingw32/i686-w64-mingw32/include/fileapi.h:67:2
9: note: initializing argument 1 of 'WINBOOL GetFileSizeEx(HANDLE, PLARGE_INTEGE
R)'
   WINBASEAPI WINBOOL WINAPI GetFileSizeEx (HANDLE hFile, PLARGE_INTEGER lpFileS
ize);
                             ^
D:\medusa-dev\src\core\windows_binary_stream.cpp:7
2:7: error: invalid conversion from 'medusa::TFileHandle {aka int}' to 'HANDLE {
aka void*}' [-fpermissive]
       );
       ^
In file included from D:/mingw32/i686-w64-mingw32/
include/winbase.h:25:0,
                 from D:/mingw32/i686-w64-mingw32/
include/Windows.h:70,
                 from D:\medusa-dev\src\core\windo
ws_binary_stream.cpp:3:
D:/mingw32/i686-w64-mingw32/include/memoryapi.h:63
:28: note: initializing argument 1 of 'void* CreateFileMappingW(HANDLE, LPSECURI
TY_ATTRIBUTES, DWORD, DWORD, DWORD, LPCWSTR)'
   WINBASEAPI HANDLE WINAPI CreateFileMappingW (HANDLE hFile, LPSECURITY_ATTRIBU
TES lpFileMappingAttributes, DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwM
aximumSizeLow, LPCWSTR lpName);
                            ^
In file included from D:/mingw32/i686-w64-mingw32/
include/winbase.h:19:0,
                 from D:/mingw32/i686-w64-mingw32/
include/Windows.h:70,
                 from D:\medusa-dev\src\core\windo
ws_binary_stream.cpp:3:
D:\medusa-dev\src\core\windows_binary_stream.cpp:
In member function 'void medusa::FileBinaryStream::Close()':
D:\medusa-dev\src\core\windows_binary_stream.cpp:1
00:23: error: ISO C++ forbids comparison between pointer and integer [-fpermissi
ve]
   if (m_FileHandle != INVALID_HANDLE_VALUE)
                       ^
D:\medusa-dev\src\core\windows_binary_stream.cpp:1
02:29: error: invalid conversion from 'medusa::TFileHandle {aka int}' to 'HANDLE
 {aka void*}' [-fpermissive]
     CloseHandle(m_FileHandle);
                             ^
In file included from D:/mingw32/i686-w64-mingw32/
include/winbase.h:19:0,
                 from D:/mingw32/i686-w64-mingw32/
include/Windows.h:70,
                 from D:\medusa-dev\src\core\windo
ws_binary_stream.cpp:3:
D:/mingw32/i686-w64-mingw32/include/handleapi.h:19
:29: note: initializing argument 1 of 'WINBOOL CloseHandle(HANDLE)'
   WINBASEAPI WINBOOL WINAPI CloseHandle (HANDLE hObject);
                             ^
D:\medusa-dev\src\core\windows_binary_stream.cpp:1
03:18: error: invalid conversion from 'HANDLE {aka void*}' to 'medusa::TFileHand
le {aka int}' [-fpermissive]
     m_FileHandle = INVALID_HANDLE_VALUE;
                  ^
D:\medusa-dev\src\core\windows_binary_stream.cpp:
In member function 'void medusa::MemoryBinaryStream::Open(const void*, medusa::u
32)':
D:\medusa-dev\src\core\windows_binary_stream.cpp:1
24:12: error: 'unique_path' is not a member of 'boost::filesystem'
   m_Path = boost::filesystem::unique_path();
            ^
mingw32-make[2]: *** [src/core/CMakeFiles/Medusa.dir/windows_binary_stream.cpp.o
bj] Error 1
mingw32-make[1]: *** [src/core/CMakeFiles/Medusa.dir/all] Error 2
mingw32-make: *** [all] Error 2

Loading executable into qMedusa works but then nothing happens

I launch qMedusa and selected a binary to analyze(a simple hello world program). qMedusa identifies the file parameters correct, asks for a database path and then nothing happens: an empty screen is displayed as shown in the image. Did I miss something?

qmedusa-after-loading

PS: Are paths to libraries not setup correctly when qMedusa is invoked? I had to copy files from lib folder into bin for any loaders to be detected.

x86 Release?

Any chance you can release an x86 release version of the project? It looks really impressive and very promising, would be nice to be able to play with it before diving into the source repository and compiling everything.

Boost 1.59 incompatibility

The documentation currently says that any version of Boost greater than or equal to 1.55 should work but when trying to compile against 1.59 you get compile errors about missing BOOST_MESSAGE. Switching to 1.55 fixes this. May need to update the documentation to mention that 1.59 is not compatible.

Error when linking libmedusa to libOGDF

I am trying to build the dev branch of medusa(15ce1d7) and I get the following error:

Linking CXX shared library ../../lib/libmedusa.so
/usr/bin/ld: $HOME/.hunter/_Base/8c538a0/a1b471c/15fdb4a/Install/lib/libOGDF.a(Graph.cpp.o): relocation R_X86_64_32S against `_ZN4ogdf13AdjEntryArrayIbE10resetIndexEii' can not be used when making a shared object; recompile with -fPIC
$HOME/.hunter/_Base/8c538a0/a1b471c/15fdb4a/Install/lib/libOGDF.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
src/core/CMakeFiles/medusa.dir/build.make:1607: recipe for target 'lib/libmedusa.so' failed
make[2]: *** [lib/libmedusa.so] Error 1
CMakeFiles/Makefile2:200: recipe for target 'src/core/CMakeFiles/medusa.dir/all' failed
make[1]: *** [src/core/CMakeFiles/medusa.dir/all] Error 2
Makefile:162: recipe for target 'all' failed
make: *** [all] Error 2

Seems like there's an issue when building OGDF.

I'm using a fully updated Ubuntu 16.04.2 running cmake 3.8.0. Steps to reproduce:

  1. Clone the repository.
  2. Run cmake -DCMAKE_BUILD_TYPE=Release .. from a build directory in source tree.
  3. Run make.

Extraneous semicolon in make file for ogdf

When building with ogdf, somewhere in the whole mess there's an extra ; getting added to the compiler flags. This causes the compile command to be split into two commands and fail with a "no input files" error. I'm apparently not familiar enough with cmake to find the source of the problem, but manually correcting the results allows the compilation to progress normally.

You'll notice the extra ; in the middle of "-fabi-version=9;-std=gnu++0x" It appears to have taken the place of a space.

OS: Gentoo Linux
cmake: 3.3.1
make: 4.1

# make --trace Makefile:692: target 'cmake_check_build_system' does not exist /usr/bin/cmake -H/root/medusa -B/root/medusa/build --check-build-system CMakeFiles/Makefile.cmake 0 Makefile:160: update target 'all' due to: cmake_check_build_system /usr/bin/cmake -E cmake_progress_start /root/medusa/build/CMakeFiles /root/medusa/build/CMakeFiles/progress.marks make -f CMakeFiles/Makefile2 all CMakeFiles/Makefile2:121: target 'deps/ogdf/CMakeFiles/coin.dir/all' does not exist make -f deps/ogdf/CMakeFiles/coin.dir/build.make deps/ogdf/CMakeFiles/coin.dir/depend deps/ogdf/CMakeFiles/coin.dir/build.make:5350: target 'deps/ogdf/CMakeFiles/coin.dir/depend' does not exist cd /root/medusa/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /root/medusa /root/medusa/deps/ogdf /root/medusa/build /root/medusa/build/deps/ogdf /root/medusa/build/deps/ogdf/CMakeFiles/coin.dir/DependInfo.cmake --color= make -f deps/ogdf/CMakeFiles/coin.dir/build.make deps/ogdf/CMakeFiles/coin.dir/build deps/ogdf/CMakeFiles/coin.dir/build.make:62: update target 'deps/ogdf/CMakeFiles/coin.dir/src/coin/Cgl/CglAllDifferent.cpp.o' due to: ../deps/ogdf/src/coin/Cgl/CglAllDifferent.cpp ../deps/ogdf/include/coin/CglAllDifferent.hpp ../deps/ogdf/include/coin/CglCutGenerator.hpp ../deps/ogdf/include/coin/CglTreeInfo.hpp ../deps/ogdf/include/coin/CoinDistance.hpp ../deps/ogdf/include/coin/CoinError.hpp ../deps/ogdf/include/coin/CoinFinite.hpp ../deps/ogdf/include/coin/CoinFloatEqual.hpp ../deps/ogdf/include/coin/CoinHelperFunctions.hpp ../deps/ogdf/include/coin/CoinMessageHandler.hpp ../deps/ogdf/include/coin/CoinPackedMatrix.hpp ../deps/ogdf/include/coin/CoinPackedVector.hpp ../deps/ogdf/include/coin/CoinPackedVectorBase.hpp ../deps/ogdf/include/coin/CoinPragma.hpp ../deps/ogdf/include/coin/CoinShallowPackedVector.hpp ../deps/ogdf/include/coin/CoinSort.hpp ../deps/ogdf/include/coin/CoinTypes.hpp ../deps/ogdf/include/coin/CoinUtilsConfig.h ../deps/ogdf/include/coin/OsiColCut.hpp ../deps/ogdf/include/coin/OsiCollections.hpp ../deps/ogdf/include/coin/OsiCut.hpp ../deps/ogdf/include/coin/OsiCuts.hpp ../deps/ogdf/include/coin/OsiRowCut.hpp ../deps/ogdf/include/coin/OsiRowCutDebugger.hpp ../deps/ogdf/include/coin/OsiSolverInterface.hpp ../deps/ogdf/include/coin/OsiSolverParameters.hpp ../deps/ogdf/include/coin/config.h ../deps/ogdf/include/coin/config_coinutils_default.h ../deps/ogdf/include/coin/config_default.h ../deps/ogdf/include/coin/config_sym_default.h ../deps/ogdf/include/coin/configall_system.h ../deps/ogdf/include/coin/configall_system_msc.h deps/ogdf/CMakeFiles/coin.dir/flags.make /usr/bin/cmake -E cmake_echo_color --switch= --green --progress-dir=/root/medusa/build/CMakeFiles --progress-num= "Building CXX object deps/ogdf/CMakeFiles/coin.dir/src/coin/Cgl/CglAllDifferent.cpp.o" [ 0%] Building CXX object deps/ogdf/CMakeFiles/coin.dir/src/coin/Cgl/CglAllDifferent.cpp.o cd /root/medusa/build/deps/ogdf && /usr/bin/c++ -DBOOST_ALL_DYN_LINK -DCLP_BUILD -DCOINUTILS_BUILD -DCOMPILE_IN_CG -DCOMPILE_IN_CP -DCOMPILE_IN_LP -DCOMPILE_IN_TM -DHAVE_CONFIG_H -DOSI_BUILD -DSYMPHONY_BUILD -DUSE_CGL_CUTS -D__OSI_CLP__ -fabi-version=9;-std=gnu++0x -fno-operator-names -I/root/medusa/deps/ogdf/include/coin -I/root/medusa/deps/ogdf/include -std=gnu++11 -o CMakeFiles/coin.dir/src/coin/Cgl/CglAllDifferent.cpp.o -c /root/medusa/deps/ogdf/src/coin/Cgl/CglAllDifferent.cpp c++: fatal error: no input files compilation terminated. /bin/sh: -std=gnu++0x: command not found deps/ogdf/CMakeFiles/coin.dir/build.make:62: recipe for target 'deps/ogdf/CMakeFiles/coin.dir/src/coin/Cgl/CglAllDifferent.cpp.o' failed make[2]: *** [deps/ogdf/CMakeFiles/coin.dir/src/coin/Cgl/CglAllDifferent.cpp.o] Error 127 CMakeFiles/Makefile2:121: recipe for target 'deps/ogdf/CMakeFiles/coin.dir/all' failed make[1]: *** [deps/ogdf/CMakeFiles/coin.dir/all] Error 2 Makefile:160: recipe for target 'all' failed make: *** [all] Error 2

Hash mismatch

Hi,

-- SHA1 hash of
/root/.hunter/_Base/Download/OGDF/snapshot-2015-12-04/fb9b5d9/snapshot-2015-12-04.tar.gz
does not match expected value
expected: 'fb9b5d93fd27feae91799c5a52805e10c139b22e'
actual: '0a55144b31d165f4b3009693cb9089c6b8930c88'
-- Hash mismatch, removing...

On Kali 2.0

Partially Missing Generated CFG

The generated CFG from the latest commit https://github.com/wisk/medusa/commit/e34650e9639dd4f750a393d017ed4ed984b8d2f9 will create nodes without any directional arrows whatsoever. So its just nodes floating around.

--halsten

Compile and Run Problems - OSX 10.10

Compiling medusa on OSX 10.10 Yosemite took me a bit more of my time than expected. Now, I face two more problems:

  1. I get "core: there is not supported loader" for every file (e.g. hello_world-vs2012.pe.x86-64). The dylibs for the accordings systems are in the same bin folder as qmedusa and the correct folder is used for the modules (according to the logs) Without further logs (last resort debugging) I assume I can't use medusa. Maybe if I get enough time time to further check the source code myself...
  2. The menu works only after changing the focus to another program and back. Probably a qt problem.

In the following a description how I compiled medusa:

Compiling Dev version

First, compiling the dev branch didn't work at all.

  1. Calling cmake from build folder leads to "does not appear to contain CMakeLists.txt". I'm no expert in cmake, so I don't even know how this is supposed to work. Or is cmake supposed to search in parent folders?
  2. Calling cmake from the root folder gives us errors for OGDF: " Source directory is polluted"
    Deleting the CMakeFiles Directory is meaningless, as it gets created again. Removing the causing part from CMakeLists
    "# Check for polluted source tree.
    if(EXISTS ${CMAKE_SOURCE_DIR}/CMakeCache.txt OR
    ...
    "
    leads to the next error. I didn't spend further time here. If somebody can help me out here, I will try out the dev version on OSX 10.10.

Compiling 4.3

Second, compiling the last pre-release version 4.3.
I used homebrew and clang (the default usr/bin/g++ is clang) with libc++ compiler flag. OGDF suggests using libstdc++ on OSX, but this means you need to get other libraries compiled with this setting as well. Missing to do so will lead to: "Undefined symbols for architecture x86_64" Linking to libraries with different runtimes would otherwise lead to crashes.

Homebrew

brew install cmake
brew install python
brew install doxygen
brew install boost --c++11
brew install boost-python --c++11
brew install qt5

OGDF

Download the current OGDF version from http://www.ogdf.net/doku.php/tech:download and extract it.

Patch gtest because this is the only code part that isn't compatible with libc++: #20 or https://gist.github.com/pgriess/7046324
You just need to make sure that tr1/tuple is not used. For the current version 2015.5 of OGDF you can change gtest.h as follows:

547,548c547,548
< # if (defined(__GNUC__) && !defined(__CUDACC__) && (GTEST_GCC_VER_ >= 40000)) \
<     || _MSC_VER >= 1600

---
> # if (defined(__GNUC__) && !defined(__CUDACC__) && !defined(_LIBCPP_VERSION) && (GTEST_GCC_VER_ >= 40000)) \
>      || _MSC_VER >= 1600

In makeMakefile.conf add c++11 support

compilerCommand = g++ -std=c++11

Now just:

make
make debug

Medusa

Download medusa 4.3 and compile it:
For "unknown" reasons cmake does not use the python libraries from homebrew. So with the current version of python and qt5 we get:

cmake  -DQT5_CMAKE_PATH:PATH=/usr/local/Cellar/qt5/5.5.0/lib/cmake -DOGDF_PATH:PATH=<Your OGDF path> -DCMAKE_BUILD_TYPE=Release -DPYTHON_INCLUDE_DIR:PATH=/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/Headers -DPYTHON_LIBRARY:PATH=/usr/local/Cellar/python/2.7.10_2/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
make

I'm open for any ideas.

Cannot open file from command line with qMedusa

When I run "qMedusa ", qMedusa just starts with empty windows, ignoring argument. It would be nice if it instead opened the given executable as if with Open->File menu.

Besides pure command-line convenience, this would reduce much the confusion for weird cases like #14.

UNDO

something that is really needed is an undo function .. like once i do something theres no way i can just revert. i think this a really important feature

Bug in ogdf

qMedusa: /home/ivan/projects/medisa_project/ogdf/include/ogdf/basic/NodeArray.h:145: T& ogdf::NodeArray::operator [with T = double; ogdf::node = ogdf::NodeElement*]:
An assertion «v != 0 && v->graphOf() == m_pGraph» missed.
Аварийный останов (сделан дамп памяти)

1)open any file
2)click To log window
3)press Ctrl+F

CFG view fall too...((

Abnormal Behavior on Disassembler Widget

Hi,

I currently was using the latest development branch on a 32-bit machine on Windows 10 Professional. And I was using the sample provided with medusa as input to see how is it going to behave. The sample in question is the "Semantics Loop" sample. Once you open it and medusa finishes analyzing clicking on 1 of the XREFS of any of the function should take you that function, however it took me to the bottom of the screen and everything else disappeared. As the lack of a vertical scrollbar disabled me from getting back where I was, I quickly used the function list to the output again. This is where shit hits the fan, and the editor starts to behave abnormally. Resetting such behavior was achieved when I went to settings and changed the font to probably force a complete paint on the viewport. This fixed the issue, however trying to click on the second line of the editor where "start" was located it would only reflect to the line above it (line number 1). and that line became totally immune to my several attempts to click it.

--halsten

Gameboy 3 Bytes instructions

For example gameboy games have their start point at 0x0100, normaly with a NOP and J instructions, but medusa says:
0xCE
0x50
0x01

Medusa doesn't translate it.

AssignmentExpression assert nullptr Error

Assertion failed: (spSrcExpr != nullptr && "Source expression is null"), function AssignmentExpression, file /src/core/expression.cpp, line 342.

The file is a pe x86 Intel Windows Executable.

This happens, qMedusa stops to work and nothing of the progression was saved.
Is there something not fully implemented that this can happen? Or how can I fix this?

I am working with the newest code of the master branch.

Question: FormatDisassembly

Hey,

I was trying to print out every single line of the disassembly with formating. It got really slow in the following method:

// OPTIMIZEME: This function could be very time consumming (use deque?)
bool MappedMemoryArea::_GetPreviousCellOffset(TOffset Offset, TOffset& rPreviousOffset) const
{
  while (Offset != 0x0)
  {
    --Offset;
    if (m_Cells[Offset] != nullptr)
    {
      rPreviousOffset = Offset;
      return true;
    }
  }

  return false;
}

Now my question is if I can just switch the type of m_Cells to a deque or do I need to change something else?

I can not compile the project

Kubundu 14.04 Boost 1.55

/home/ivan/projects/medisa_project/medusa/src/ui/qt/SettingsDialog.cpp:8:28: fatal error: QKeySequenceEdit:
#include
^
compilation terminated.

cmake .. -DOGDF_PATH:PATH=/home/ivan/projects/medisa_project/ogdf/ -DQT5_CMAKE_PATH:PATH=/home/ivan/programmertools/qt/5.2.0/gcc/lib/cmake

I have tried different versions of qt:

cmake .. -DOGDF_PATH:PATH=/home/ivan/projects/medisa_project/ogdf/ -DQT5_CMAKE_PATH:PATH=/home/ivan/programmertools/qt/5.3/gcc/lib/cmake

cmake .. -DOGDF_PATH:PATH=/home/ivan/projects/medisa_project/ogdf/ -DQT5_CMAKE_PATH:PATH=/home/ivan/programmertools/qt/5.0.2/gcc/lib/cmake

Build fails on Ubuntu 16.10

Hello, I just tried building medusa (master branch) and got this error:

Scanning dependencies of target Qt-qtbase
[ 12%] Creating directories for 'Qt-qtbase'
[ 25%] Performing download step (download, verify and extract) for 'Qt-qtbase'
-- verifying file...
     file='/home/talanor/.hunter/_Base/Download/Qt/5.5.1-cvpixelbuffer-2-p9/da86822/hunter-5.5.1-cvpixelbuffer-2.7z'
-- verifying file... done
-- extracting...
     src='/home/talanor/.hunter/_Base/Download/Qt/5.5.1-cvpixelbuffer-2-p9/da86822/hunter-5.5.1-cvpixelbuffer-2.7z'
     dst='/home/talanor/.hunter/_Base/8c538a0/a1b471c/15fdb4a/QtBuild/10'
-- extracting... [tar xfz]
CMake Error: Problem with archive_read_next_header(): Damaged 7-Zip archive
CMake Error: Problem extracting tar: /home/talanor/.hunter/_Base/Download/Qt/5.5.1-cvpixelbuffer-2-p9/da86822/hunter-5.5.1-cvpixelbuffer-2.7z
-- extracting... [error clean up]
CMake Error at /home/talanor/.hunter/_Base/8c538a0/a1b471c/15fdb4a/Build/Qt/__qtbase/Build/Qt-qtbase-prefix/src/Qt-qtbase-stamp/extract-Qt-qtbase.cmake:33 (message):
  error: extract of
  '/home/talanor/.hunter/_Base/Download/Qt/5.5.1-cvpixelbuffer-2-p9/da86822/hunter-5.5.1-cvpixelbuffer-2.7z'
  failed


CMakeFiles/Qt-qtbase.dir/build.make:92: recipe for target 'Qt-qtbase-prefix/src/Qt-qtbase-stamp/Qt-qtbase-download' failed
make[2]: *** [Qt-qtbase-prefix/src/Qt-qtbase-stamp/Qt-qtbase-download] Error 1

It would seem that tar xfz can't unzip the hunter-5.5.1-cvpixelbuffer-2.7z archive, 7z x however unzips it just fine. Any idea of why that happens or how I can circumvent this?

Thanks for your help.

I want add support windows pdb files

Hi.I have question about architecture.I want add support windows pdb files.
My algoritm is:
1)parse PE_DIRECTORY_ENTRY_DEBUG
2)try download pdb file from microsoft site
3)valid pdb file
4)if file not system,then try load user pdb file.(filename.pdb)
5)parse pdb file and add comments

questions:
1)Pe loader parse PE_DIRECTORY_ENTRY_DEBUG.Can be add IsHasDebugSymbols to Loader?Download symbols with TaskManager?(AddTask)

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.