-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsfa
More file actions
396 lines (343 loc) · 8.7 KB
/
Copy pathsfa
File metadata and controls
396 lines (343 loc) · 8.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
#!/bin/sh
#Screenfetch for Android (c)aspadm, 2016
#MIT license
#dependings: root(for screenshots), busybox(?)
#Used: cat, echo, ls, pm, grep, [[, clear, input, screencap, getprop, let, dumpsys, am
sfav="1.0.4"
#Help section
if [[ "$1" == -*h* ]]; then
echo "Screenfetch for Android v$sfav"
echo "(c)Aspadm 2016, MIT license"
echo
echo "usage: sfa <-hctsv>"
echo " h - show help (this message)"
echo " v - show version and exit"
echo " c - also take screenshots of console/homescreen (need root)"
echo " s - show system info with simple no utf8 logo"
echo " t - as is prev, but without color (simple text)"
echo
echo "example: sfa -tc - show textual sysinfo and take 2 screenshot to your /sdcard"
echo " sfa - just show sysinfo (with colored utf8 logo)"
exit 0
fi
#Version
if [[ "$1" == -*v* ]]; then
echo "Screenfetch for Android v$sfav"
exit 0
fi
#Initialization
input keyevent BACK
clear
#Detection section
model=$(getprop ro.product.manufacturer)" "$(getprop ro.product.model)
#Uncomment next string, if you see "Device: <brand> <brand-name>"
#model=$(getprop ro.product.model)
usern=$(id -u)
usern=${usern#?*"="}
usern=${usern%%'('*?}
if [[ "$usern" == "0" ]]; then
root=1
usern=$(pm list users|grep -m 1 "UserInfo")
usern=${usern#?*:}
usern=${usern%:*?}
else
usern=$USER
fi
hostn=$(getprop net.hostname)
os="Android "$(getprop ro.build.version.release)
api=$(getprop ro.build.version.sdk)
case "$api" in
3)
kname=Cupcake
;;
4)
kname=Donut
;;
5)
kname=Eclair
;;
6)
kname=Eclair
;;
7)
kname=Eclair
;;
8)
kname=Froyo
;;
9)
kname=Gingerbread
;;
10)
kname=Gingerbread
;;
11)
kname=Honeycomb
;;
12)
kname=Honeycomb
;;
13)
kname=Honeycomb
;;
14)
kname=ICS
;;
15)
kname=ICS
;;
16)
kname=JellyBean
;;
17)
kname=JellyBean
;;
18)
kname=JellyBean
;;
19)
kname=KitKat
;;
21)
kname=Lolipop
;;
22)
kname=Lolipop
;;
23)
kname=Marshmallow
;;
24)
kname=Nougat
;;
25)
kname=Nougat
;;
26)
kname=Oreo
;;
27)
kname=Oreo
;;
28)
kname=Pie
;;
esac
kname=" "$kname
api=" (API "$api")"
if [[ $(getprop ro.cm.version) != "" ]]; then
rom=$(getprop ro.cm.version)
rom=${rom%%'-'*?}
rom="CyanogenMod "$rom'/'
os=$rom$os
else
os=$os$kname$api
fi
ker=$(getprop ro.product.cpu.abi)" "$(cat /proc/sys/kernel/ostype)" "$(cat /proc/sys/kernel/osrelease)
upt=$(cat /proc/uptime)
sec=${upt%%'.'*?}
let "day=(sec/3600/24)"
let "sec-=day*24*3600"
let "hour=(sec/3600)"
let "sec-=hour*3600"
let "min=(sec/60)"
if [[ "$day" -eq "0" ]]; then
upt=$hour"h "$min"m"
else
upt=$day"d "$hour"h "$min"m"
fi
cpuid=$(cat /proc/cpuinfo|grep "Hardware")
cpuid=${cpuid##?*:}
cpuc=$(cat /sys/devices/system/cpu/kernel_max)
cpuf=$(cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_max_freq)
let "cpuf/=1000"
cpuf=$cpuf"MHz"
if [[ $cpuc == "0" ]]; then
cpuid=$cpuid' @ '$cpuf
else
let "cpuc+=1"
cpuid=$cpuid' ('$cpuc') @'$cpuf
fi
chips=$(getprop ro.board.platform)" "$(getprop ro.product.board)
instp=$(pm list packages|grep package -c)
disp=$(dumpsys display|grep -m 1 "mPhys")
disp=${disp##?*'{'}
disp=${disp%%,*?}
if [[ "$disp" == "" ]]; then
disp=$(wm size|grep -m 1 "[Pp]hysical")
disp=${disp##?* }
fi
bbx=$(ls /system/xbin|grep "busybox" -c)$(ls /system/bin|grep "busybox" -c)
if [[ "$bbx" != "00" ]]; then
bbx=$(busybox|grep "BusyBox" -m 1)
bbx=${bbx%%'-'*?}
bbx=${bbx#B*v}
if [[ "$bbx" == "" ]]; then
bbx="can't detect"
fi
else
bbx="not installed"
fi
launcher=$(dumpsys activity processes|grep -m 1 "mHomeProcess")
launcher=${launcher## *:}
launcher=${launcher%%/*?}
case "$launcher" in
com.android*)
launcher="Stock Android"
;;
com.example)
launcher="test"
;;
com.asus.launcher)
launcher="ZenUI Launcher"
;;
com.cyanogenmod.trebuchet)
launcher="Trebuchet Launcher"
;;
org.lineageos.trebuchet)
launcher="Trebuchet Launcher"
;;
org.adw.launcher)
launcher="ADW.Launcher"
;;
com.teslacoilsw.launcher)
launcher="Nova Launcher"
;;
com.anddoes.launcher)
launcher="Apex Launcher"
;;
ginlemon.flower*)
launcher="Smart Launcher"
;;
com.gau.go.launcherex)
launcher="GO Launcher EX"
;;
com.google.android.launcher)
launcher="Google Now"
;;
com.blackberry.blackberrylauncher)
launcher="BlackBerry Launcher"
;;
com.ksmobile.launcher)
launcher="CM Launcher 3D"
;;
com.microsoft.launcher)
launcher="Arrow Launcher"
;;
com.apusapps.launcher)
launcher="APUS Launcher"
;;
home.solo.launcher*)
launcher="Solo Launcher"
;;
com.yandex.launcher)
launcher="Yandex Launcher"
;;
com.gtp.nextlauncher*)
launcher="Next Launcher 3D"
;;
com.hola.launcher)
launcher="Hola Launcher"
;;
com.dlto.atom.launcher)
launcher="Atom Launcher"
;;
com.cma.launcher*)
launcher="C Launcher"
;;
com.actionlauncher*)
launcher="Action Launcher"
;;
com.google.android.apps.nexuslauncher)
launcher="Pixel Launcher"
;;
is.shortcut)
launcher="Evie launcher"
;;
ohi.andre.consolelauncher)
launcher="T-UI"
;;
com.miui.mihome*)
launcher="MI launcher"
;;
*)
if [[ "$launcher" == "" ]]; then
launcher="can't detect"
fi
;;
esac
ram=$(grep -m 1 "MemTotal" "/proc/meminfo")
ramf=$(grep -m 1 "MemFree" "/proc/meminfo")
ramc=$(grep -m 1 "Cached" "/proc/meminfo")
ram=${ram% *?}
ram=${ram##M* }
ramf=${ramf% *?}
ramf=${ramf##M* }
ramc=${ramc% *?}
ramc=${ramc##C* }
let "ramf=(ram-ramf-ramc)/1024"
let "ram/=1024"
ram=$ramf'MB / '$ram"MB"
#Info printing
if [[ "$1" == -*t* ]]; then
#Text without color
echo
echo " \__nnn__/ $USER@$HOSTNAME"
echo " nnHHHHHHHnn ($usern@$hostn)"
echo " nHH[]HHH[]HHn OS: $os"
echo " HHHHHHHHHHHHH Kernel: $ker"
echo " /H\ nnnnnnnnnnnnn /H\ Uptime: $upt"
echo " MHN NHHHHHHHHHHHN MHN Packages: $instp"
echo " MHN NHHHHHHHHHHHN MHN Busybox: $bbx"
echo " MHN NHHHHHHHHHHHN MHN Device: $model"
echo " MHN NHHHHHHHHHHHN MHN Resolution: $disp"
echo " \HHHHHHHHHHH/ Launcher: $launcher"
echo " IHH HHI Chipset: $chips"
echo " IHH HHI CPU: $cpuid"
echo " IHH HHI Memory: $ram"
echo
elif [[ "$1" == -*s* ]]; then
#Colored text
echo
echo -e "\E[32;40m\033[1m \__nnn__/ $USER@$HOSTNAME"
echo -e "\E[32;40m\033[1m nnHHHHHHHnn \033[0m\E[32;40m($usern@$hostn)"
echo -e "\E[32;40m\033[1m nHH[]HHH[]HHn OS: \033[0m\E[37;40m$os"
echo -e "\E[32;40m\033[1m HHHHHHHHHHHHH Kernel: \033[0m\E[37;40m$ker"
echo -e "\E[32;40m\033[1m /H\ nnnnnnnnnnnnn /H\ Uptime: \033[0m\E[37;40m$upt"
echo -e "\E[32;40m\033[1m MHN NHHHHHHHHHHHN MHN Packages: \033[0m\E[37;40m$instp"
echo -e "\E[32;40m\033[1m MHN NHHHHHHHHHHHN MHN Busybox: \033[0m\E[37;40m$bbx"
echo -e "\E[32;40m\033[1m MHN NHHHHHHHHHHHN MHN Device: \033[0m\E[37;40m$model"
echo -e "\E[32;40m\033[1m MHN NHHHHHHHHHHHN MHN Resolution: \033[0m\E[37;40m$disp"
echo -e "\E[32;40m\033[1m \HHHHHHHHHHH/ Launcher: \033[0m\E[37;40m$launcher"
echo -e "\E[32;40m\033[1m IHH HHI Chipset: \033[0m\E[37;40m$chips"
echo -e "\E[32;40m\033[1m IHH HHI CPU: \033[0m\E[37;40m$cpuid"
echo -e "\E[32;40m\033[1m IHH HHI Memory: \033[0m\E[37;40m$ram"
echo -e '\E[37;40m\033[0m'
else
#utf8 colored logo
echo -e '\E[32;40m'
echo -e "\E[32;40m ╲▂▃▄▄▄▃▂╱ \033[1m$USER@$HOSTNAME\033[0m"
echo -e "\E[32;40m ▄▇███████▇▄ ($usern@$hostn)"
echo -e "\E[32;40m \E[30;42m▌\E[32;47m██▃█████▃██\E[32;40m▌ \033[1mOS: \033[0m\E[37;40m$os"
echo -e "\E[32;40m █████████████ \033[1mKernel: \033[0m\E[37;40m$ker"
echo -e "\E[32;40m ▆█▆ ▆▆▆▆▆▆▆▆▆▆▆▆▆ ▆█▆ \033[1mUptime: \033[0m\E[37;40m$upt"
echo -e "\E[32;40m ███ █████████████ ███ \033[1mPackages: \033[0m\E[37;40m$instp"
echo -e "\E[32;40m ███ █████████████ ███ \033[1mBusybox: \033[0m\E[37;40m$bbx"
echo -e "\E[32;40m ███ █████████████ ███ \033[1mDevice: \033[0m\E[37;40m$model"
echo -e "\E[32;40m ███ █████████████ ███ \033[1mResolution: \033[0m\E[37;40m$disp"
echo -e "\E[32;40m █████████████ \033[1mLauncher: \033[0m\E[37;40m$launcher"
echo -e "\E[32;40m ███ ███ \033[1mChipset: \033[0m\E[37;40m$chips"
echo -e "\E[32;40m ███ ███ \033[1mCPU: \033[0m\E[37;40m$cpuid"
echo -e "\E[32;40m ███ ███ \033[1mMemory: \033[0m\E[37;40m$ram"
echo -e '\E[37;40m\033[0m'
fi
#Screenshot taking
if [[ "$1" == -*c* ]]; then
if [[ "$root" == "1" ]]; then
sleep 1&&screencap -p /sdcard/sfa-console.png
am start -a android.intent.action.MAIN -c android.intent.category.HOME&&sleep 1&&screencap -p /sdcard/sfa-homescreen.png
else
echo "Need root access for screenshot"
fi
fi
exit 0