Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use libosi to handle windows introspection #1138

Merged
merged 20 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ ENV PATH="/root/.cargo/bin:${PATH}"
# Sanity check to ensure cargo is installed
RUN cargo --help

# install libosi
RUN cd /tmp && \
git clone https://github.com/panda-re/libosi && \
mkdir /tmp/libosi/build && cd /tmp/libosi/build && \
cmake -GNinja .. && ninja && ninja package && dpkg -i libosi*.deb && \
cd /tmp && rm -rf libosi/

# Build and install panda
# Copy repo root directory to /panda, note we explicitly copy in .git directory
# Note .dockerignore file keeps us from copying things we don't need
Expand Down
5 changes: 5 additions & 0 deletions panda/dependencies/ubuntu:18.04_build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,8 @@ texinfo
uuid-dev
xfslibs-dev
zlib1g-dev

# libosi install deps
cmake
ninja-build
rapidjson-dev
5 changes: 5 additions & 0 deletions panda/dependencies/ubuntu:20.04_build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,8 @@ libc6.1-dev-alpha-cross

# rust install deps
curl

# libosi install deps
cmake
ninja-build
rapidjson-dev
2 changes: 0 additions & 2 deletions panda/plugins/callstack_instr/callstack_instr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ PANDAENDCOMMENT */
// needed for the threaded stack_type
#include "osi/osi_types.h"
#include "osi/osi_ext.h"
#include "wintrospection/wintrospection.h"
#include "wintrospection/wintrospection_ext.h"
#include "osi_linux/osi_linux_ext.h"

#include "callstack_instr.h"
Expand Down
3 changes: 0 additions & 3 deletions panda/plugins/config.panda
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,4 @@ textprinter
trace
track_intexc
unigrams
win2000x86intro
win7x86intro
wintrospection
winxpx86intro
7 changes: 3 additions & 4 deletions panda/plugins/file_taint/file_taint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ PANDAENDCOMMENT */
#include "osi/osi_types.h"
#include "osi/osi_ext.h"

#include "wintrospection/wintrospection.h"
#include "wintrospection/wintrospection_ext.h"

#include "osi_linux/osi_linux_ext.h"
Expand Down Expand Up @@ -207,11 +206,11 @@ void windows_read_enter(CPUState *cpu, target_ulong pc, uint32_t FileHandle,
uint32_t ByteOffset, uint32_t Key)
{
// get_handle_name will assert if the filename is null
char *filename = get_handle_name(cpu, get_current_proc(cpu), FileHandle);
char *filename = get_handle_name(FileHandle);
std::string ob_path = filename;
// Check if the file handle is absolute, if not we need to make it absolute.
if (filename[0] != '\\') {
char *cwd = get_cwd(cpu);
char *cwd = get_cwd();
ob_path = cwd;
// If the cwd doesn't have a slash, add it.
if (ob_path.back() != '\\') {
Expand All @@ -221,7 +220,7 @@ void windows_read_enter(CPUState *cpu, target_ulong pc, uint32_t FileHandle,
g_free(cwd);
}
verbose_printf("file_taint windows object path: %s\n", ob_path.c_str());
int64_t pos = get_file_handle_pos(cpu, get_current_proc(cpu), FileHandle);
int64_t pos = get_file_handle_pos(FileHandle);
read_enter(ob_path, FileHandle, pos);
g_free(filename);
}
Expand Down
2 changes: 1 addition & 1 deletion panda/plugins/syscalls2/syscalls2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ bool init_plugin(void *self) {
std::cerr << PANDA_MSG "using profile for windows sp3 x86 32-bit" << std::endl;
syscalls_profile = &profiles[PROFILE_WINDOWS_XPSP3_X86];
}
if (0 == strcmp(panda_os_variant, "7")) {
if (0 == strncmp(panda_os_variant, "7", 1)) {
std::cerr << PANDA_MSG "using profile for windows 7 x86 32-bit" << std::endl;
syscalls_profile = &profiles[PROFILE_WINDOWS_7_X86];
}
Expand Down
9 changes: 0 additions & 9 deletions panda/plugins/win2000x86intro/Makefile

This file was deleted.

30 changes: 0 additions & 30 deletions panda/plugins/win2000x86intro/README.md

This file was deleted.

156 changes: 0 additions & 156 deletions panda/plugins/win2000x86intro/win2000x86intro.cpp

This file was deleted.

6 changes: 0 additions & 6 deletions panda/plugins/win2000x86intro/win2000x86intro_int.h

This file was deleted.

8 changes: 0 additions & 8 deletions panda/plugins/win2000x86intro/win2000x86intro_int_fns.h

This file was deleted.

9 changes: 0 additions & 9 deletions panda/plugins/win7x86intro/Makefile

This file was deleted.

33 changes: 0 additions & 33 deletions panda/plugins/win7x86intro/README.md

This file was deleted.

Loading