Skip to content

Commit 85a15f6

Browse files
committed
use a script for start daemon to work around known issues
1 parent 43ec8a8 commit 85a15f6

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

cSploit/jni/build.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ build_core() {
109109
echo -n "building native executables..."
110110
ndk-build APP_OPTIM=debug NDK_DEBUG=1 -j$(grep -E "^processor" /proc/cpuinfo | wc -l) >&3 2>&1 || die
111111
echo -ne "ok\ncopying programs..."
112-
cp "${bins}/cSploitd" "${out}/"
112+
113+
for prog in cSploitd known-issues; do
114+
cp "${bins}/${prog}" "${out}/" >&3 2>&1 || die
115+
done
116+
113117
for tool in arpspoof tcpdump ettercap hydra nmap fusemounts; do
114118
mkdir -p "${out}/tools/$tool" >&3 2>&1
115119
cp "${bins}/$tool" "${out}/tools/$tool/$tool" >&3 2>&1 || die
@@ -132,6 +136,8 @@ build_core() {
132136
rsync -aq --include "*/" --include "*.lua" --exclude "*" "${jni_root}/nmap/" "${out}/tools/nmap/" >&3 2>&1 || die
133137
rsync -aq "${jni_root}/nmap/scripts/" "${out}/tools/nmap/scripts/" >&3 2>&1 || die
134138

139+
cp "${jni_root}/known-issues/start_daemon.sh" "${out}/"
140+
135141
echo -ne "ok\ncopying configuration/database files..."
136142
for f in $nmap_data; do
137143
cp "${jni_root}/nmap/$f" "${out}/tools/nmap/" >&3 2>&1 || die
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/system/bin/sh
2+
3+
exec 3<> ./start_daemon.log
4+
5+
script_dir="$(readlink /proc/$$/cwd )"
6+
7+
die1() {
8+
cd "$script_dir"
9+
grep -q "/cSploit" /proc/mounts && umount /cSploit
10+
test -d /cSploit && { mount -o remount,rw /; rmdir /cSploit; mount -o remount,ro / ;}
11+
echo "$1" >&3
12+
exit 1
13+
}
14+
15+
test -f ./issues || { ./known-issues > ./issues 2>&3 ; chmod 777 ./issues ;}
16+
17+
while read issue; do
18+
19+
echo "issue #$issue found" >&3
20+
21+
case issue in
22+
1)
23+
if [ ! -f "/cSploit/cSploitd" ]; then
24+
mount -o remount,rw / 2>&3 || die1 "remount rw failed"
25+
mkdir /cSploit 2>&3 || die1 "mkdir failed"
26+
mount -o bind "$script_dir" "/cSploit" 2>&3 || die1 "bind failed"
27+
mount -o remount,ro / 2>&3 || echo "remount ro failed" >&3
28+
fi
29+
cd /cSploit 2>&3 || die1 "chdir failed"
30+
;;
31+
32+
esac
33+
done < ./issues
34+
35+
exec 3>&-
36+
37+
exec ./cSploitd

cSploit/src/org/csploit/android/core/System.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ private static void startCoreDaemon() throws SuException, DaemonException {
241241
writer = new DataOutputStream(shell.getOutputStream());
242242
String cmd;
243243

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

247247
writer.write(cmd.getBytes());

0 commit comments

Comments
 (0)