Resurrect `sysutils/scanmem' and update to version 0.17.

This commit is contained in:
Alexey Dokuchaev 2020-07-11 13:09:10 +00:00
parent 0c891a38af
commit 4974cb1b9c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=541970
15 changed files with 316 additions and 1 deletions

1
MOVED
View File

@ -9148,7 +9148,6 @@ sysutils/sievelog||2017-04-30|Has expired: Unfetchable for more than six months
sysutils/ldapenter||2017-04-30|Has expired: Unfetchable for more than six months (google code has gone away)
sysutils/py-danzfs||2017-04-30|Has expired: Unfetchable for more than six months (google code has gone away)
sysutils/plasma-applet-apcups||2017-04-30|Has expired: Unfetchable for more than six months (google code has gone away)
sysutils/scanmem||2017-04-30|Has expired: Unfetchable for more than six months (google code has gone away)
sysutils/pdsh||2017-04-30|Has expired: Unfetchable for more than six months (google code has gone away)
deskutils/superswitcher||2017-04-30|Has expired: Unfetchable for more than six months (google code has gone away)
deskutils/plasma-applet-playwolf||2017-04-30|Has expired: Unfetchable for more than six months (google code has gone away)

View File

@ -1183,6 +1183,7 @@
SUBDIR += scalpel
SUBDIR += scan_ffs
SUBDIR += scanbuttond
SUBDIR += scanmem
SUBDIR += scct
SUBDIR += schedutils
SUBDIR += screen

39
sysutils/scanmem/Makefile Normal file
View File

@ -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>

View File

@ -0,0 +1,3 @@
TIMESTAMP = 1507931596
SHA256 (scanmem-scanmem-v0.17_GH0.tar.gz) = f02054b91322cf41517506158fcb74554e9fc6644e696f8aa25e5acf162d374b
SIZE (scanmem-scanmem-v0.17_GH0.tar.gz) = 220489

View File

@ -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) \
({ \

View File

@ -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()

View File

@ -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" "$@"

View File

@ -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>

View File

@ -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 */

View File

@ -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)
{

View File

@ -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;

View File

@ -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))
{

View File

@ -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;

View File

@ -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/

View File

@ -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