Urlencode r4g curl calls

This commit is contained in:
pancake committed 2025-07-29 02:47:28 +02:00
1 parent 120fce4dd0
commit 0f6a5cba80
1 file changed
+13 -5
+13 -5
View File
@@ -7,15 +7,23 @@ ROOT=$(dirname `readlink $0` 2> /dev/null)
if [ -n "${ROOT}" ]; then
cd "${ROOT}"
fi
r4cmd() {
ARG=`jq -nr --arg x "$@" '$x|@uri'`
curl "http://${HOST}:${PORT}/cmd/$ARG"
rc=$?
echo
exit $rc
}
if [ -z "$R2PIPE_IN" ]; then
if [ "$1" = cmd ]; then
shift
curl "http://${HOST}:${PORT}/cmd/$@"
rc=$?
echo
exit $rc
r4cmd "$@"
fi
echo "# You can run commands in the R4Ghidra webserver like this"
echo
echo "r4g cmd px"
echo
echo "# This program is experimental and requires r2pipe to run"
echo
echo "In the radare2 shell type: r2 -c '#!pipe r4g'"
@@ -84,7 +92,7 @@ import|pull)
cat ghidra-output.r2
;;
cmd|*)
curl "http://${HOST}:${PORT}/cmd/$@"
r4cmd "$@"
;;
esac