Skip to content

Commit

Permalink
use a script for start daemon to work around known issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tux-mind committed Jan 12, 2015
1 parent 43ec8a8 commit 85a15f6
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 2 deletions.
8 changes: 7 additions & 1 deletion cSploit/jni/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ build_core() {
echo -n "building native executables..."
ndk-build APP_OPTIM=debug NDK_DEBUG=1 -j$(grep -E "^processor" /proc/cpuinfo | wc -l) >&3 2>&1 || die
echo -ne "ok\ncopying programs..."
cp "${bins}/cSploitd" "${out}/"

for prog in cSploitd known-issues; do
cp "${bins}/${prog}" "${out}/" >&3 2>&1 || die
done

for tool in arpspoof tcpdump ettercap hydra nmap fusemounts; do
mkdir -p "${out}/tools/$tool" >&3 2>&1
cp "${bins}/$tool" "${out}/tools/$tool/$tool" >&3 2>&1 || die
Expand All @@ -132,6 +136,8 @@ build_core() {
rsync -aq --include "*/" --include "*.lua" --exclude "*" "${jni_root}/nmap/" "${out}/tools/nmap/" >&3 2>&1 || die
rsync -aq "${jni_root}/nmap/scripts/" "${out}/tools/nmap/scripts/" >&3 2>&1 || die

cp "${jni_root}/known-issues/start_daemon.sh" "${out}/"

echo -ne "ok\ncopying configuration/database files..."
for f in $nmap_data; do
cp "${jni_root}/nmap/$f" "${out}/tools/nmap/" >&3 2>&1 || die
Expand Down
37 changes: 37 additions & 0 deletions cSploit/jni/known-issues/start_daemon.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/system/bin/sh

exec 3<> ./start_daemon.log

script_dir="$(readlink /proc/$$/cwd )"

die1() {
cd "$script_dir"
grep -q "/cSploit" /proc/mounts && umount /cSploit
test -d /cSploit && { mount -o remount,rw /; rmdir /cSploit; mount -o remount,ro / ;}
echo "$1" >&3
exit 1
}

test -f ./issues || { ./known-issues > ./issues 2>&3 ; chmod 777 ./issues ;}

while read issue; do

echo "issue #$issue found" >&3

case issue in
1)
if [ ! -f "/cSploit/cSploitd" ]; then
mount -o remount,rw / 2>&3 || die1 "remount rw failed"
mkdir /cSploit 2>&3 || die1 "mkdir failed"
mount -o bind "$script_dir" "/cSploit" 2>&3 || die1 "bind failed"
mount -o remount,ro / 2>&3 || echo "remount ro failed" >&3
fi
cd /cSploit 2>&3 || die1 "chdir failed"
;;

esac
done < ./issues

exec 3>&-

exec ./cSploitd
2 changes: 1 addition & 1 deletion cSploit/src/org/csploit/android/core/System.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ private static void startCoreDaemon() throws SuException, DaemonException {
writer = new DataOutputStream(shell.getOutputStream());
String cmd;

cmd = String.format("{ echo 'ACCESS GRANTED' >&2; cd '%s' && exec ./cSploitd ;} || exit 1\n",
cmd = String.format("{ echo 'ACCESS GRANTED' >&2; cd '%s' && exec ./start_daemon.sh ;} || exit 1\n",
System.getCoreBinPath());

writer.write(cmd.getBytes());
Expand Down

0 comments on commit 85a15f6

Please sign in to comment.