Skip to content

Commit

Permalink
Add Cydia package, considering this r2frida-1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae committed Dec 15, 2016
1 parent 48e1f55 commit 30315ba
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 4 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ frida_os := $(shell uname -s | tr '[A-Z]' '[a-z]' | sed 's,^darwin$$,mac,')
frida_arch := $(shell uname -m | sed 's,i[0-9]86,i386,g')
frida_os_arch := $(frida_os)-$(frida_arch)

DESTDIR?=

SO_EXT=dylib
CC?=gcc
CXX?=g++
Expand Down Expand Up @@ -106,11 +108,11 @@ mrproper: clean
$(RM) -r ext/node

install:
mkdir -p "$(R2_PLUGDIR)"
cp -f io_frida.$(SO_EXT) "$(R2_PLUGDIR)"
mkdir -p $(DESTDIR)/"$(R2_PLUGDIR)"
cp -f io_frida.$(SO_EXT) $(DESTDIR)/"$(R2_PLUGDIR)"

uninstall:
$(RM) "$(R2_PLUGDIR)/io_frida.$(SO_EXT)"
$(RM) $(DESTDIR)/"$(R2_PLUGDIR)/io_frida.$(SO_EXT)"

frida-sdk: ext/frida-$(frida_os)-$(frida_version)
rm -f ext/frida
Expand Down
6 changes: 6 additions & 0 deletions cydia/CONFIG
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
PACKAGE=r2frida
VERSION=1.2
ARCH=iphoneos-arm
SECTION=user/shell
PRIORITY=optional
MAINTAINER=pancake <[email protected]>
2 changes: 2 additions & 0 deletions cydia/DESCR
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Frida plugin for radare2
This plugin will allow r2 on iOS to use the frida:// URI handler in the IO plugin in order to communicate with a local or remote Frida server and get the benefits of R2 and Frida together!
18 changes: 18 additions & 0 deletions cydia/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
include ./CONFIG
DEPENDS=
PACKAGE_DIR?=${PWD}

all: root
sudo rm -rf control data
${MAKE} clean
mkdir -p data
cp -rf root/* data
${MAKE} control
${MAKE} deb

root:
cd .. ; $(MAKE) ios && $(MAKE) install \
R2_PLUGDIR=/private/var/radare2/lib/radare2/last \
DESTDIR=$(shell pwd)/root

include deb.mk
130 changes: 130 additions & 0 deletions cydia/deb.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Create .deb without using dpkg tools.
#
# Author: Tim Wegener <[email protected]>
#
# Use 'include deb_hand.mak' after defining the user variables in a local
# makefile.
#
# The 'data' rule must be customised in the local make file.
# This rule should make a 'data' directory containing the full file
# layout of the installed package.
#
# This makefile will create a debian-binary file a control directory and a
# a build directory in the current directory.
# Do 'make clobber' to remove these generated files.
#
# Destination:
# PACKAGE_DIR - directory where package (and support files) will be built
# defaults to the current directory
#
# Sources:
# SOURCE_DIR - directory containing files to be packaged
# ICON_SOURCE - 26x26 icon file for maemo
# DESCR - description with summary on first line
# preinst, postinst, prerm, postrm - optional control shell scripts

# These fields are used to build the control file:
# PACKAGE =
# VERSION =
# ARCH =
# SECTION =
# PRIORITY =
# MAINTAINER =
# DEPENDS =
#
# SOURCE_DIR =
# ICON_SOURCE =
# (ICON_SOURCE is optional)

# *** NO USER CHANGES REQUIRED BEYOND THIS POINT ***
ifeq ($(shell uname),Darwin)
MD5SUM=md5
else
MD5SUM=md5sum
endif

GAWK=awk
PACKAGE_DIR=$(shell pwd)
CONTROL_EXTRAS ?= ${wildcard preinst postinst prerm postrm}

${PACKAGE_DIR}/control: ${PACKAGE_DIR}/data ${CONTROL_EXTRAS} DESCR \
${ICON_SOURCE}
#rm -rf $@
mkdir -p $@
ifneq (${CONTROL_EXTRAS},)
cp ${CONTROL_EXTRAS} $@
endif
# Make control file.
echo "Package: ${PACKAGE}" > $@/control
echo "Version: ${VERSION}" >> $@/control
echo "Section: ${SECTION}" >> $@/control
echo "Priority: ${PRIORITY}" >> $@/control
echo "Architecture: ${ARCH}" >> $@/control
ifneq (${DEPENDS},)
echo "Depends: ${DEPENDS}" >> $@/control
endif
echo "Installed-Size: ${shell du -s ${PACKAGE_DIR}/data|cut -f1}" \
>> $@/control
echo "Maintainer: ${MAINTAINER}" >> $@/control
printf "Description:" >> $@/control
cat DESCR | ${GAWK} '{print " "$$0;}' >> $@/control
#ifneq (${ICON_SOURCE},)
# echo "Maemo-Icon-26:" >> $@/control
# base64 ${ICON_SOURCE} | ${GAWK} '{print " "$$0;}' >> $@/control
#endif
# Make md5sums.
cd ${PACKAGE_DIR}/data && find . -type f -exec ${MD5SUM} {} \; \
| sed -e 's| \./||' \
> $@/md5sums

${PACKAGE_DIR}/debian-binary:
echo "2.0" > $@

${PACKAGE_DIR}/clean:
rm -rf ${PACKAGE_DIR}/data ${PACKAGE_DIR}/control ${PACKAGE_DIR}/build *.deb

${PACKAGE_DIR}/build: ${PACKAGE_DIR}/debian-binary ${PACKAGE_DIR}/control \
${PACKAGE_DIR}/data
rm -rf $@
mkdir $@
cp ${PACKAGE_DIR}/debian-binary $@/
cd ${PACKAGE_DIR}/control && tar czvf $@/control.tar.gz *
cd ${PACKAGE_DIR}/data && \
COPY_EXTENDED_ATTRIBUTES_DISABLE=true \
COPYFILE_DISABLE=true \
tar cpzvf $@/data.tar.gz *

# Convert GNU ar to BSD ar that debian requires.
# Note: Order of files within ar archive is important!
${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb: ${PACKAGE_DIR}/build
ar -rc $@ $</debian-binary $</control.tar.gz $</data.tar.gz
#sed -e 's|^\([^/]\+\)/ \(.*\)|\1 \2|g' $@tmp > $@fail
#rm -f $@tmp
#mv $@fail $@

.PHONY: data
data: ${PACKAGE_DIR}/data

.PHONY: control
control: ${PACKAGE_DIR}/control

.PHONY: build
build: ${PACKAGE_DIR}/build

.PHONY: clean
clean: ${PACKAGE_DIR}/clean $(EXTRA_CLEAN)
rm -f debian-binary

.PHONY: deb
deb: ${PACKAGE_DIR}/${PACKAGE}_${VERSION}_${ARCH}.deb


clobber::
rm -rf ${PACKAGE_DIR}/debian_binary ${PACKAGE_DIR}/control \
${PACKAGE_DIR}/data ${PACKAGE_DIR}/build

push:
scp *.deb radare.org:/srv/http/radareorg/cydia/debs

mrproper: clean
rm -rf root
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "r2frida-agent",
"version": "1.1.0",
"version": "1.2.0",
"description": "Agent for frida:// io plugin",
"private": true,
"main": "src/agent/index.js",
Expand Down

0 comments on commit 30315ba

Please sign in to comment.