Skip to content

Commit aac6665

Browse files
authored
Add files via upload
1 parent e147be2 commit aac6665

File tree

2 files changed

+331
-0
lines changed

2 files changed

+331
-0
lines changed

kali.sh

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#!/data/data/com.termux/files/usr/bin/bash
2+
pkg install wget -y
3+
folder=kali-fs
4+
if [ -d "$folder" ]; then
5+
first=1
6+
echo "skipping downloading"
7+
fi
8+
tarball="kali-rootfs.tar.xz"
9+
if [ "$first" != 1 ];then
10+
if [ ! -f $tarball ]; then
11+
echo "Download Rootfs, this may take a while base on your internet speed."
12+
case `dpkg --print-architecture` in
13+
aarch64)
14+
archurl="arm64" ;;
15+
arm)
16+
archurl="armhf" ;;
17+
amd64)
18+
archurl="amd64" ;;
19+
x86_64)
20+
archurl="amd64" ;;
21+
i*86)
22+
archurl="i386" ;;
23+
x86)
24+
archurl="i386" ;;
25+
*)
26+
echo "unknown architecture"; exit 1 ;;
27+
esac
28+
29+
if [ $archurl == "arm64" ]; then
30+
wget "https://github.com/AndronixApp/AndronixOrigin/releases/download/kali-arm64-tarball/kali-rootfs-arm64.tar.xz" -O $tarball
31+
else
32+
wget "https://github.com/Techriz/AndronixOrigin/blob/master/Rootfs/Kali/${archurl}/kali-rootfs-${archurl}.tar.xz?raw=true" -O $tarball
33+
fi
34+
fi
35+
cur=`pwd`
36+
mkdir -p "$folder"
37+
cd "$folder"
38+
echo "Decompressing Rootfs, please be patient."
39+
proot --link2symlink tar -xJf ${cur}/${tarball}||:
40+
cd "$cur"
41+
fi
42+
mkdir -p kali-binds
43+
bin=start-kali.sh
44+
echo "writing launch script"
45+
cat > $bin <<- EOM
46+
#!/bin/bash
47+
cd \$(dirname \$0)
48+
## unset LD_PRELOAD in case termux-exec is installed
49+
unset LD_PRELOAD
50+
command="proot"
51+
command+=" --link2symlink"
52+
command+=" -0"
53+
command+=" -r $folder"
54+
if [ -n "\$(ls -A kali-binds)" ]; then
55+
for f in kali-binds/* ;do
56+
. \$f
57+
done
58+
fi
59+
command+=" -b /dev"
60+
command+=" -b /proc"
61+
command+=" -b kali-fs/root:/dev/shm"
62+
## uncomment the following line to have access to the home directory of termux
63+
#command+=" -b /data/data/com.termux/files/home:/root"
64+
## uncomment the following line to mount /sdcard directly to /
65+
#command+=" -b /sdcard"
66+
command+=" -w /root"
67+
command+=" /usr/bin/env -i"
68+
command+=" HOME=/root"
69+
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
70+
command+=" TERM=\$TERM"
71+
command+=" LANG=C.UTF-8"
72+
command+=" /bin/bash --login"
73+
com="\$@"
74+
if [ -z "\$1" ];then
75+
exec \$command
76+
else
77+
\$command -c "\$com"
78+
fi
79+
EOM
80+
81+
cat > $folder/root/.bash_logout <<- EOM
82+
#!/bin/bash
83+
vncserver-stop
84+
pkill dbus*
85+
pkill ssh*
86+
EOM
87+
88+
echo -e "\e[31m Patching mirrorlist temporarily until further source update. Don't worry about GPG errors\e[0m"
89+
echo "deb [trusted=yes] http://http.kali.org/kali kali-rolling main contrib non-free" > $folder/etc/apt/sources.list
90+
91+
echo "fixing shebang of $bin"
92+
termux-fix-shebang $bin
93+
echo "making $bin executable"
94+
chmod +x $bin
95+
echo "removing image for some space"
96+
rm $tarball
97+
echo "You can now launch Kali with the ./${bin} script"

ubuntu22.sh

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
#!/data/data/com.termux/files/usr/bin/bash
2+
pkg install wget -y
3+
folder=ubuntu22-fs
4+
cur=`pwd`
5+
if [ -d "$folder" ]; then
6+
first=1
7+
echo "skipping downloading"
8+
fi
9+
tarball="ubuntu22-rootfs.tar.gz"
10+
11+
termux-setup-storage
12+
13+
if [ "$first" != 1 ];then
14+
if [ ! -f $tarball ]; then
15+
echo "Download Rootfs, this may take a while base on your internet speed."
16+
case `dpkg --print-architecture` in
17+
aarch64)
18+
archurl="arm64" ;;
19+
*)
20+
echo "unknown architecture"; exit 1 ;;
21+
esac
22+
wget "https://github.com/AndronixApp/AndronixOrigin/raw/master/Rootfs/Ubuntu22/jammy-${archurl}.tar.gz" -O $tarball
23+
fi
24+
25+
mkdir -p "$folder"
26+
cd "$folder"
27+
echo "Decompressing Rootfs, please be patient."
28+
proot --link2symlink tar -xf ${cur}/${tarball} --exclude=dev||:
29+
cd "$cur"
30+
fi
31+
32+
mkdir -p ubuntu22-binds
33+
mkdir -p ${folder}/proc/fakethings
34+
35+
if [ ! -f "${cur}/${folder}/proc/fakethings/stat" ]; then
36+
cat <<- EOF > "${cur}/${folder}/proc/fakethings/stat"
37+
cpu 5502487 1417100 4379831 62829678 354709 539972 363929 0 0 0
38+
cpu0 611411 171363 667442 7404799 61301 253898 205544 0 0 0
39+
cpu1 660993 192673 571402 7853047 39647 49434 29179 0 0 0
40+
cpu2 666965 186509 576296 7853110 39012 48973 26407 0 0 0
41+
cpu3 657630 183343 573805 7863627 38895 48768 26636 0 0 0
42+
cpu4 620516 161440 594973 7899146 39438 47605 26467 0 0 0
43+
cpu5 610849 155665 594684 7912479 40258 46870 26044 0 0 0
44+
cpu6 857685 92294 387182 8096756 46609 22110 12364 0 0 0
45+
cpu7 816434 273809 414043 7946709 49546 22311 11284 0 0 0
46+
intr 601715486 0 0 0 0 70612466 0 2949552 0 93228 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12862684 625329 10382717 16209 55315 8510 0 0 0 0 11 11 13 270 192 40694 95 7 0 0 0 36850 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 286 6378 0 0 0 54 0 3239423 2575191 82725 0 0 127 0 0 0 1791277 850609 20 9076504 0 301 0 0 0 0 0 3834621 0 0 0 0 0 0 0 0 0 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 806645 0 0 0 0 0 7243 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2445850 52 1783 0 0 5091520 0 0 0 3 0 0 0 0 0 5475 0 198001 0 2 42 1289224 0 2 202483 4 0 8390 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3563336 4202122 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 1 0 0 1 0 1 0 17948 0 0 612 0 0 0 0 2103 0 0 20 0 0 0 0 0 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 11 11 12 0 12 0 52 752 0 0 0 0 0 0 0 743 0 14 0 0 12 0 0 1863 229 0 464 0 0 0 0 0 0 8588 97 7236426 92766 622 31 0 0 0 18 4 4 0 5 0 0 116013 7 0 0 752406
47+
ctxt 826091808
48+
btime 1611513513
49+
processes 288493
50+
procs_running 1
51+
procs_blocked 0
52+
softirq 175407567 14659158 51739474 28359 5901272 8879590 0 11988166 46104015 0 36107533
53+
EOF
54+
fi
55+
56+
57+
if [ ! -f "${cur}/${folder}/proc/fakethings/version" ]; then
58+
cat <<- EOF > "${cur}/${folder}/proc/fakethings/version"
59+
Linux version 5.4.0-faked (andronix@fakeandroid) (gcc version 4.9.x (Andronix fake /proc/version) ) #1 SMP PREEMPT Sun Sep 13 00:00:00 IST 2020
60+
EOF
61+
fi
62+
63+
if [ ! -f "${cur}/${folder}/proc/fakethings/vmstat" ]; then
64+
cat <<- EOF > "${cur}/${folder}/proc/fakethings/vmstat"
65+
nr_free_pages 15717
66+
nr_zone_inactive_anon 87325
67+
nr_zone_active_anon 259521
68+
nr_zone_inactive_file 95508
69+
nr_zone_active_file 57839
70+
nr_zone_unevictable 58867
71+
nr_zone_write_pending 0
72+
nr_mlock 58867
73+
nr_page_table_pages 24569
74+
nr_kernel_stack 49552
75+
nr_bounce 0
76+
nr_zspages 80896
77+
nr_free_cma 0
78+
nr_inactive_anon 87325
79+
nr_active_anon 259521
80+
nr_inactive_file 95508
81+
nr_active_file 57839
82+
nr_unevictable 58867
83+
nr_slab_reclaimable 17709
84+
nr_slab_unreclaimable 47418
85+
nr_isolated_anon 0
86+
nr_isolated_file 0
87+
workingset_refault 33002180
88+
workingset_activate 5498395
89+
workingset_restore 2354202
90+
workingset_nodereclaim 140006
91+
nr_anon_pages 344014
92+
nr_mapped 193745
93+
nr_file_pages 218441
94+
nr_dirty 0
95+
nr_writeback 0
96+
nr_writeback_temp 0
97+
nr_shmem 1880
98+
nr_shmem_hugepages 0
99+
nr_shmem_pmdmapped 0
100+
nr_anon_transparent_hugepages 0
101+
nr_unstable 0
102+
nr_vmscan_write 8904094
103+
nr_vmscan_immediate_reclaim 139732
104+
nr_dirtied 8470080
105+
nr_written 16835370
106+
nr_indirectly_reclaimable 8273152
107+
nr_unreclaimable_pages 130861
108+
nr_dirty_threshold 31217
109+
nr_dirty_background_threshold 15589
110+
pgpgin 198399484
111+
pgpgout 31742368
112+
pgpgoutclean 45542744
113+
pswpin 3843200
114+
pswpout 8903884
115+
pgalloc_dma 192884869
116+
pgalloc_normal 190990320
117+
pgalloc_movable 0
118+
allocstall_dma 0
119+
allocstall_normal 3197
120+
allocstall_movable 1493
121+
pgskip_dma 0
122+
pgskip_normal 0
123+
pgskip_movable 0
124+
pgfree 384653565
125+
pgactivate 34249517
126+
pgdeactivate 44271435
127+
pglazyfree 192
128+
pgfault 46133667
129+
pgmajfault 5568301
130+
pglazyfreed 0
131+
pgrefill 55909145
132+
pgsteal_kswapd 58467386
133+
pgsteal_direct 255950
134+
pgscan_kswapd 86628315
135+
pgscan_direct 415889
136+
pgscan_direct_throttle 0
137+
pginodesteal 18
138+
slabs_scanned 31242197
139+
kswapd_inodesteal 1238474
140+
kswapd_low_wmark_hit_quickly 11637
141+
kswapd_high_wmark_hit_quickly 5411
142+
pageoutrun 32167
143+
pgrotated 213328
144+
drop_pagecache 0
145+
drop_slab 0
146+
oom_kill 0
147+
pgmigrate_success 729722
148+
pgmigrate_fail 450
149+
compact_migrate_scanned 43510584
150+
compact_free_scanned 248175096
151+
compact_isolated 1494774
152+
compact_stall 6
153+
compact_fail 3
154+
compact_success 3
155+
compact_daemon_wake 9438
156+
compact_daemon_migrate_scanned 43502436
157+
compact_daemon_free_scanned 248107303
158+
unevictable_pgs_culled 66418
159+
unevictable_pgs_scanned 0
160+
unevictable_pgs_rescued 8484
161+
unevictable_pgs_mlocked 78830
162+
unevictable_pgs_munlocked 8508
163+
unevictable_pgs_cleared 11455
164+
unevictable_pgs_stranded 11455
165+
swap_ra 0
166+
swap_ra_hit 7
167+
speculative_pgfault 221449963
168+
EOF
169+
fi
170+
171+
bin=start-ubuntu22.sh
172+
echo "writing launch script"
173+
cat > $bin <<- EOM
174+
#!/bin/bash
175+
cd \$(dirname \$0)
176+
## unset LD_PRELOAD in case termux-exec is installed
177+
unset LD_PRELOAD
178+
command="proot"
179+
command+=" --kill-on-exit"
180+
command+=" --link2symlink"
181+
command+=" -0"
182+
command+=" -r $folder"
183+
if [ -n "\$(ls -A ubuntu22-binds)" ]; then
184+
for f in ubuntu22-binds/* ;do
185+
. \$f
186+
done
187+
fi
188+
command+=" -b /dev"
189+
command+=" -b /proc"
190+
command+=" -b /sys"
191+
command+=" -b /data"
192+
command+=" -b ubuntu22-fs/root:/dev/shm"
193+
command+=" -b /proc/self/fd/2:/dev/stderr"
194+
command+=" -b /proc/self/fd/1:/dev/stdout"
195+
command+=" -b /proc/self/fd/0:/dev/stdin"
196+
command+=" -b /dev/urandom:/dev/random"
197+
command+=" -b /proc/self/fd:/dev/fd"
198+
command+=" -b ${cur}/${folder}/proc/fakethings/stat:/proc/stat"
199+
command+=" -b ${cur}/${folder}/proc/fakethings/vmstat:/proc/vmstat"
200+
command+=" -b ${cur}/${folder}/proc/fakethings/version:/proc/version"
201+
## uncomment the following line to have access to the home directory of termux
202+
#command+=" -b /data/data/com.termux/files/home:/root"
203+
command+=" -b /sdcard"
204+
command+=" -w /root"
205+
command+=" /usr/bin/env -i"
206+
command+=" MOZ_FAKE_NO_SANDBOX=1"
207+
command+=" HOME=/root"
208+
command+=" PATH=/usr/local/sbin:/usr/local/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/games:/usr/local/games"
209+
command+=" TERM=\$TERM"
210+
command+=" LANG=C.UTF-8"
211+
command+=" /bin/bash --login"
212+
com="\$@"
213+
if [ -z "\$1" ];then
214+
exec \$command
215+
else
216+
\$command -c "\$com"
217+
fi
218+
EOM
219+
220+
chmod +x ubuntu22-fs/root/.bash_profile
221+
touch $folder/root/.hushlogin
222+
echo "127.0.0.1 localhost localhost" > $folder/etc/hosts
223+
echo "nameserver 1.1.1.1" > $folder/etc/resolv.conf
224+
chmod +x $folder/etc/resolv.conf
225+
echo "fixing shebang of $bin"
226+
termux-fix-shebang $bin
227+
echo "making $bin executable"
228+
chmod +x $bin
229+
echo "removing image for some space"
230+
rm $tarball
231+
clear
232+
echo "You can now launch Ubuntu with the ./${bin} script from next time"
233+
bash $bin
234+

0 commit comments

Comments
 (0)