diff options
author | Alexey Dokuchaev <danfe@FreeBSD.org> | 2020-07-11 13:09:10 +0000 |
---|---|---|
committer | Alexey Dokuchaev <danfe@FreeBSD.org> | 2020-07-11 13:09:10 +0000 |
commit | 4974cb1b9c607c8c941e3aaf33e65e07d6afa431 (patch) | |
tree | 05ffedbe9972851024bba11aba6a92ccc08f78e1 /sysutils/scanmem | |
parent | 0c891a38af892c6fd4df611d1ae9f39c80241fdc (diff) | |
download | freebsd-ports-4974cb1b9c607c8c941e3aaf33e65e07d6afa431.zip |
Resurrect `sysutils/scanmem' and update to version 0.17.
Diffstat (limited to 'sysutils/scanmem')
-rw-r--r-- | sysutils/scanmem/Makefile | 39 | ||||
-rw-r--r-- | sysutils/scanmem/distinfo | 3 | ||||
-rw-r--r-- | sysutils/scanmem/files/patch-common.h | 22 | ||||
-rw-r--r-- | sysutils/scanmem/files/patch-gui-GameConqueror.py | 28 | ||||
-rw-r--r-- | sysutils/scanmem/files/patch-gui-gameconqueror.in | 15 | ||||
-rw-r--r-- | sysutils/scanmem/files/patch-handlers.c | 12 | ||||
-rw-r--r-- | sysutils/scanmem/files/patch-interrupt.h | 11 | ||||
-rw-r--r-- | sysutils/scanmem/files/patch-maps.c | 30 | ||||
-rw-r--r-- | sysutils/scanmem/files/patch-ptrace.c | 52 | ||||
-rw-r--r-- | sysutils/scanmem/files/patch-scanroutines.c | 20 | ||||
-rw-r--r-- | sysutils/scanmem/files/patch-targetmem.h | 11 | ||||
-rw-r--r-- | sysutils/scanmem/pkg-descr | 22 | ||||
-rw-r--r-- | sysutils/scanmem/pkg-plist | 50 |
13 files changed, 315 insertions, 0 deletions
diff --git a/sysutils/scanmem/Makefile b/sysutils/scanmem/Makefile new file mode 100644 index 000000000000..02a20f66dbc9 --- /dev/null +++ b/sysutils/scanmem/Makefile @@ -0,0 +1,39 @@ +# Created by: Alexey Dokuchaev <danfe@FreeBSD.org> +# $FreeBSD$ + +PORTNAME= scanmem +PORTVERSION= 0.17 +DISTVERSIONPREFIX= v +CATEGORIES= sysutils + +MAINTAINER= danfe@FreeBSD.org +COMMENT= Locate and modify various data in an executing process + +LICENSE= GPLv3 + +ONLY_FOR_ARCHS= i386 amd64 +ONLY_FOR_ARCHS_REASON= requires linprocfs(5) + +USES= autoreconf gettext-tools gmake gnome libtool readline +USE_GITHUB= yes +USE_GNOME= intltool +USE_LDCONFIG= yes +GNU_CONFIGURE= yes +CONFIGURE_ENV= ac_cv_file__proc_self_maps=yes \ + ac_cv_file__proc_self_mem=yes + +OPTIONS_DEFINE= X11 DOCS +OPTIONS_SUB= yes + +X11_DESC= Install PyGTK-based GUI (GameConqueror) +X11_CATEGORIES= python +X11_CONFIGURE_ON= --enable-gui +X11_USES= python:run shebangfix +X11_USE= GNOME=gtk30,pygobject3 +X11_VARS= SHEBANG_FILES+=gui/GameConqueror.py + +post-patch: + @${REINPLACE_CMD} -e 's,/proc/,/compat/linux&,' ${WRKSRC}/configure.ac + @${REINPLACE_CMD} -e 's, COPYING,,' ${WRKSRC}/gui/Makefile.am + +.include <bsd.port.mk> diff --git a/sysutils/scanmem/distinfo b/sysutils/scanmem/distinfo new file mode 100644 index 000000000000..205306e93cca --- /dev/null +++ b/sysutils/scanmem/distinfo @@ -0,0 +1,3 @@ +TIMESTAMP = 1507931596 +SHA256 (scanmem-scanmem-v0.17_GH0.tar.gz) = f02054b91322cf41517506158fcb74554e9fc6644e696f8aa25e5acf162d374b +SIZE (scanmem-scanmem-v0.17_GH0.tar.gz) = 220489 diff --git a/sysutils/scanmem/files/patch-common.h b/sysutils/scanmem/files/patch-common.h new file mode 100644 index 000000000000..99e55ac377fe --- /dev/null +++ b/sysutils/scanmem/files/patch-common.h @@ -0,0 +1,22 @@ +--- common.h.orig 2017-10-13 21:53:16 UTC ++++ common.h +@@ -28,7 +28,9 @@ + + /* from string.h in glibc for Android/BSD */ + #ifndef strdupa ++# ifdef HAVE_ALLOCA_H + # include <alloca.h> ++# endif + # include <string.h> + # define strdupa(s) \ + ({ \ +@@ -40,7 +42,9 @@ + #endif + + #ifndef strndupa ++# ifdef HAVE_ALLOCA_H + # include <alloca.h> ++# endif + # include <string.h> + # define strndupa(s, n) \ + ({ \ diff --git a/sysutils/scanmem/files/patch-gui-GameConqueror.py b/sysutils/scanmem/files/patch-gui-GameConqueror.py new file mode 100644 index 000000000000..0a0e560bfff9 --- /dev/null +++ b/sysutils/scanmem/files/patch-gui-GameConqueror.py @@ -0,0 +1,28 @@ +--- gui/GameConqueror.py.orig 2017-10-13 21:53:16 UTC ++++ gui/GameConqueror.py +@@ -909,7 +909,7 @@ class GameConqueror(): + + def get_process_list(self): + plist = [] +- for proc in os.popen('ps -wweo pid=,user:16=,command= --sort=-pid').readlines(): ++ for proc in reversed(os.popen('ps -axww -o pid= -o user= -o command=').readlines()): + (pid, user, pname) = [tok.strip() for tok in proc.split(None, 2)] + plist.append((int(pid), user, pname)) + return plist +@@ -942,7 +942,7 @@ class GameConqueror(): + self.cheatlist_liststore[i][1] = False + + def read_maps(self): +- lines = open('/proc/%d/maps' % (self.pid,)).readlines() ++ lines = open('/compat/linux/proc/%d/maps' % (self.pid,)).readlines() + self.maps = [] + for l in lines: + item = {} +@@ -1190,7 +1190,6 @@ if __name__ == '__main__': + args = parser.parse_args() + + # Init application +- GObject.threads_init() + Gdk.threads_init() + gc_instance = GameConqueror() + diff --git a/sysutils/scanmem/files/patch-gui-gameconqueror.in b/sysutils/scanmem/files/patch-gui-gameconqueror.in new file mode 100644 index 000000000000..c6e528dd84f8 --- /dev/null +++ b/sysutils/scanmem/files/patch-gui-gameconqueror.in @@ -0,0 +1,15 @@ +--- gui/gameconqueror.in.orig 2017-10-13 21:53:16 UTC ++++ gui/gameconqueror.in +@@ -1,10 +1,5 @@ +-#!/bin/bash ++#!/bin/sh + + DATADIR=@PKGDATADIR@ + +-PKEXEC=$(command -v "pkexec") +-if [ -n "$PKEXEC" ]; then +- $PKEXEC $DATADIR/GameConqueror.py "$@" +-else +- echo "install policykit!" +-fi ++exec "$DATADIR/GameConqueror.py" "$@" diff --git a/sysutils/scanmem/files/patch-handlers.c b/sysutils/scanmem/files/patch-handlers.c new file mode 100644 index 000000000000..7a0b6e899ece --- /dev/null +++ b/sysutils/scanmem/files/patch-handlers.c @@ -0,0 +1,12 @@ +--- handlers.c.orig 2017-10-13 21:53:16 UTC ++++ handlers.c +@@ -38,7 +38,9 @@ + #include <signal.h> + #include <assert.h> + #include <setjmp.h> ++#ifdef HAVE_ALLOCA_H + #include <alloca.h> ++#endif + #include <strings.h> + #include <string.h> + #include <stdbool.h> diff --git a/sysutils/scanmem/files/patch-interrupt.h b/sysutils/scanmem/files/patch-interrupt.h new file mode 100644 index 000000000000..b9ed48a2fc06 --- /dev/null +++ b/sysutils/scanmem/files/patch-interrupt.h @@ -0,0 +1,11 @@ +--- interrupt.h.orig 2017-10-13 21:53:16 UTC ++++ interrupt.h +@@ -30,7 +30,7 @@ + /* small header file to manage interrupted commands */ + + static sigjmp_buf jmpbuf; /* used when aborting a command due to an interrupt */ +-static sighandler_t oldsig; /* reinstalled before longjmp */ ++static sig_t oldsig; /* reinstalled before longjmp */ + static unsigned intused; + + /* signal handler used to handle an interrupt during commands */ diff --git a/sysutils/scanmem/files/patch-maps.c b/sysutils/scanmem/files/patch-maps.c new file mode 100644 index 000000000000..689513281c75 --- /dev/null +++ b/sysutils/scanmem/files/patch-maps.c @@ -0,0 +1,30 @@ +--- maps.c.orig 2017-10-13 21:53:16 UTC ++++ maps.c +@@ -31,7 +31,9 @@ + #include <stddef.h> + #include <stdlib.h> + #include <string.h> ++#ifdef HAVE_ALLOCA_H + #include <alloca.h> ++#endif + #include <stdbool.h> + #include <unistd.h> + +@@ -62,7 +64,7 @@ bool sm_readmaps(pid_t target, list_t *regions, region + return false; + + /* construct the maps filename */ +- snprintf(name, sizeof(name), "/proc/%u/maps", target); ++ snprintf(name, sizeof(name), "/compat/linux/proc/%u/maps", target); + + /* attempt to open the maps file */ + if ((maps = fopen(name, "r")) == NULL) { +@@ -73,7 +75,7 @@ bool sm_readmaps(pid_t target, list_t *regions, region + show_info("maps file located at %s opened.\n", name); + + /* get executable name */ +- snprintf(exelink, sizeof(exelink), "/proc/%u/exe", target); ++ snprintf(exelink, sizeof(exelink), "/compat/linux/proc/%u/exe", target); + linkbuf_size = readlink(exelink, exename, MAX_LINKBUF_SIZE - 1); + if (linkbuf_size > 0) + { diff --git a/sysutils/scanmem/files/patch-ptrace.c b/sysutils/scanmem/files/patch-ptrace.c new file mode 100644 index 000000000000..b22f53a6a2ea --- /dev/null +++ b/sysutils/scanmem/files/patch-ptrace.c @@ -0,0 +1,52 @@ +--- ptrace.c.orig 2017-10-13 21:53:16 UTC ++++ ptrace.c +@@ -25,11 +25,13 @@ + + #include "config.h" + ++#if 0 + /* for pread */ + # ifdef _XOPEN_SOURCE + # undef _XOPEN_SOURCE + # endif + # define _XOPEN_SOURCE 500 ++#endif + + #include <time.h> + #include <sys/types.h> +@@ -406,7 +408,7 @@ bool sm_checkmatches(globals_t *vars, + return sm_detach(vars->target); + } + +-/* read region using /proc/pid/mem */ ++/* read region using /compat/linux/proc/pid/mem */ + static inline ssize_t readregion(pid_t target, void *buf, size_t count, unsigned long offset) + { + char mem[32]; +@@ -414,7 +416,7 @@ static inline ssize_t readregion(pid_t target, void *b + ssize_t len; + + /* print the path to mem file */ +- snprintf(mem, sizeof(mem), "/proc/%d/mem", target); ++ snprintf(mem, sizeof(mem), "/compat/linux/proc/%d/mem", target); + + /* attempt to open the file */ + if ((fd = open(mem, O_RDONLY)) == -1) { +@@ -650,7 +652,7 @@ bool sm_setaddr(pid_t target, void *addr, const value_ + return false; + } + +- /* TODO: may use /proc/<pid>/mem here */ ++ /* TODO: may use /compat/linux/proc/<pid>/mem here */ + for (i = 0; i < sizeof(uint64_t)/sizeof(long); i++) + { + if (ptrace(PTRACE_POKEDATA, target, addr + i*sizeof(long), memarray[i]) == -1L) { +@@ -704,7 +706,7 @@ bool sm_read_array(pid_t target, const void *addr, cha + #endif + } + +-/* TODO: may use /proc/<pid>/mem here */ ++/* TODO: may use /compat/linux/proc/<pid>/mem here */ + bool sm_write_array(pid_t target, void *addr, const void *data, int len) + { + int i,j; diff --git a/sysutils/scanmem/files/patch-scanroutines.c b/sysutils/scanmem/files/patch-scanroutines.c new file mode 100644 index 000000000000..373a310f3393 --- /dev/null +++ b/sysutils/scanmem/files/patch-scanroutines.c @@ -0,0 +1,20 @@ +--- scanroutines.c.orig 2017-10-13 21:53:16 UTC ++++ scanroutines.c +@@ -369,7 +369,7 @@ extern inline unsigned int scan_routine_BYTEARRAY_EQUA + { + const uint8_t *bytes_array = user_value->bytearray_value; + const wildcard_t *wildcards_array = user_value->wildcard_value; +- uint length = user_value->flags; ++ unsigned int length = user_value->flags; + if (memlength < length || + *((uint64_t*)bytes_array) != (memory_ptr->uint64_value & *((uint64_t*)wildcards_array))) + { +@@ -470,7 +470,7 @@ DEFINE_BYTEARRAY_SMALLOOP_EQUALTO_ROUTINE(56) + extern inline unsigned int scan_routine_STRING_EQUALTO SCAN_ROUTINE_ARGUMENTS + { + const char *scan_string = user_value->string_value; +- uint length = user_value->flags; ++ unsigned int length = user_value->flags; + if(memlength < length || + memory_ptr->int64_value != *((int64_t*)scan_string)) + { diff --git a/sysutils/scanmem/files/patch-targetmem.h b/sysutils/scanmem/files/patch-targetmem.h new file mode 100644 index 000000000000..b206889a7c92 --- /dev/null +++ b/sysutils/scanmem/files/patch-targetmem.h @@ -0,0 +1,11 @@ +--- targetmem.h.orig 2017-10-13 21:53:16 UTC ++++ targetmem.h +@@ -257,7 +257,7 @@ static inline value_t + data_to_val_aux (const matches_and_old_values_swath *swath, + size_t index, size_t swath_length) + { +- uint i; ++ unsigned int i; + value_t val; + size_t max_bytes = swath_length - index; + diff --git a/sysutils/scanmem/pkg-descr b/sysutils/scanmem/pkg-descr new file mode 100644 index 000000000000..d931e2fc030e --- /dev/null +++ b/sysutils/scanmem/pkg-descr @@ -0,0 +1,22 @@ +Scanmem is a simple interactive debugging utility for Linux, used to locate +various data in an executing process. This can be used for the analysis or +modification of a hostile process on a compromised machine, help in reverse +engineering, or to cheat at video games. Brief list of its features: + + - Interactive command mode, with internal help + - Efficient and easy-to-use syntax + - Support for different data types: integers, floats, bytearrays, strings + - Support for different scan (comparison) types: equal, greater/less than, + changed, unchanged, increased/decreased + - Set any variable to any value + - Detailed information about mappings, allow users to eliminate regions + +More in GameConqueror, optional PyGTK-based GUI: + + - User-friendly CheatEngline-alike interface + - Modify and lock (freeze) variables + - Memory viewer/editor + +It requires linprocfs(5) to be mounted under /compat/linux/proc to operate. + +WWW: http://code.google.com/p/scanmem/ diff --git a/sysutils/scanmem/pkg-plist b/sysutils/scanmem/pkg-plist new file mode 100644 index 000000000000..915af44a8b38 --- /dev/null +++ b/sysutils/scanmem/pkg-plist @@ -0,0 +1,50 @@ +%%X11%%bin/gameconqueror +bin/scanmem +include/scanmem/commands.h +include/scanmem/list.h +include/scanmem/maps.h +include/scanmem/scanmem.h +include/scanmem/scanroutines.h +include/scanmem/sets.h +include/scanmem/show_message.h +include/scanmem/targetmem.h +include/scanmem/value.h +lib/libscanmem.a +lib/libscanmem.so +lib/libscanmem.so.1 +lib/libscanmem.so.1.0.0 +%%X11%%man/man1/gameconqueror.1.gz +man/man1/scanmem.1.gz +%%X11%%share/appdata/GameConqueror.appdata.xml +%%X11%%share/applications/GameConqueror.desktop +%%X11%%share/gameconqueror/GameConqueror.py +%%X11%%share/gameconqueror/GameConqueror.ui +%%X11%%share/gameconqueror/GameConqueror_128x128.png +%%X11%%share/gameconqueror/GameConqueror_48x48.png +%%X11%%share/gameconqueror/GameConqueror_72x72.png +%%X11%%share/gameconqueror/__pycache__/GameConqueror.cpython-%%PYTHON_SUFFIX%%.opt-1.pyc +%%X11%%share/gameconqueror/__pycache__/GameConqueror.cpython-%%PYTHON_SUFFIX%%.pyc +%%X11%%share/gameconqueror/__pycache__/backend.cpython-%%PYTHON_SUFFIX%%.opt-1.pyc +%%X11%%share/gameconqueror/__pycache__/backend.cpython-%%PYTHON_SUFFIX%%.pyc +%%X11%%share/gameconqueror/__pycache__/consts.cpython-%%PYTHON_SUFFIX%%.opt-1.pyc +%%X11%%share/gameconqueror/__pycache__/consts.cpython-%%PYTHON_SUFFIX%%.pyc +%%X11%%share/gameconqueror/__pycache__/hexview.cpython-%%PYTHON_SUFFIX%%.opt-1.pyc +%%X11%%share/gameconqueror/__pycache__/hexview.cpython-%%PYTHON_SUFFIX%%.pyc +%%X11%%share/gameconqueror/__pycache__/misc.cpython-%%PYTHON_SUFFIX%%.opt-1.pyc +%%X11%%share/gameconqueror/__pycache__/misc.cpython-%%PYTHON_SUFFIX%%.pyc +%%X11%%share/gameconqueror/backend.py +%%X11%%share/gameconqueror/consts.py +%%X11%%share/gameconqueror/hexview.py +%%X11%%share/gameconqueror/misc.py +%%X11%%share/icons/hicolor/128x128/apps/GameConqueror.png +%%X11%%share/icons/hicolor/48x48/apps/GameConqueror.png +%%X11%%share/icons/hicolor/72x72/apps/GameConqueror.png +%%X11%%share/locale/de/LC_MESSAGES/GameConqueror.mo +%%X11%%share/locale/es/LC_MESSAGES/GameConqueror.mo +%%X11%%share/locale/it/LC_MESSAGES/GameConqueror.mo +%%X11%%share/locale/ja/LC_MESSAGES/GameConqueror.mo +%%X11%%share/locale/ru/LC_MESSAGES/GameConqueror.mo +%%X11%%share/locale/sr_ME/LC_MESSAGES/GameConqueror.mo +%%X11%%share/polkit-1/actions/org.freedesktop.gameconqueror.policy +%%PORTDOCS%%%%DOCSDIR%%/README +%%X11%%%%PORTDOCS%%%%DOCSDIR%%/TODO |