├── LICENSE
├── README.md
├── sys-install
├── sys-uninstall
└── sysinfo
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 - present AJ
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
sysinfo
2 | Displays various info about Android on Termux app that written in BASH
3 |
4 |
5 |
6 |
7 |
8 |
9 |
11 |
12 |
13 |
14 | 
15 |
16 | ## :star: Features
17 |
18 | - Enhanced menu design to improve information visibility.
19 | - Enhanced command mode for executing specific functions.
20 | - Precise system load calculation using ADB HACK.
21 | - Memory and CPU functions optimized for better performance.
22 | - Continuous monitoring of CPU, memory, and battery in real-time.
23 | - sysinfo can now receive future updates.
24 | - Header menu shows updates, termux-api and ADB status.
25 | - Now device sensors list will display.
26 |
27 | ## Installation :white_check_mark:
28 |
29 | > **Attention!**
30 | > - You have to install latest version of Termux from F-Droid **[here](https://f-droid.org/repo/com.termux_118.apk)**
31 | > - Install termux-api latest version from F-Droid **[here](https://f-droid.org/repo/com.termux.api_51.apk)**
32 |
33 | #### Automatic Installation
34 |
35 | :star2: using curl
36 | - Install curl pkg
37 | ``` bash
38 | pkg install -y curl
39 | ```
40 | - Run one line command to setup the script installation.
41 | - Installation depends on Internet speed.
42 | ``` bash
43 | bash <(curl -s https://raw.githubusercontent.com/Aj-Seven/Android-Sysinfo/master/sys-install)
44 | ```
45 | - It will install the script with required dependencies.
46 |
47 | > *After Successful Installation, execute it by*
48 | ``` bash
49 | sysinfo
50 | ```
51 |
52 |
53 |
54 | Manual way
55 |
56 |
57 | - Download or clone this Repository
58 |
59 | ``` bash
60 | git clone https://github.com/Aj-Seven/Android-Sysinfo
61 | ```
62 |
63 | - move this repo folder to `usr/share` directory
64 |
65 | ``` bash
66 | mv Android-Sysinfo $PREFIX/share/Android-Sysinfo
67 | ```
68 |
69 | - link the script to bin directory
70 |
71 | ``` bash
72 | ln -s $PREFIX/share/Android-Sysinfo/sysinfo $PREFIX/bin/sysinfo
73 | ```
74 |
75 | **Make sure that required dependencies is installed before running**
76 |
77 | required pkgs
78 |
79 | - Install required pkgs by
80 | `pkg install -y git curl termux-api ncurses-utils duf figlet bc jq nmap speedtest-go`
81 |
82 |
83 | > *Thats it, sysinfo is Successfully Installed :tada:*
84 |
85 | - Run by `sysinfo`
86 |
87 |
88 |
89 |
90 | ## ADB Connection :zap:
91 |
92 | - To use ADB connection in the script, you need to activate remote TCP by running:
93 | ``` bash
94 | adb tcpip 5555
95 | ```
96 | - This command opens a TCP connection that stays active until your phone restarts.
97 | - You can check the ADB status in the header menu.
98 |
99 |
100 |
101 | Showcase
102 |
103 |
104 | > This screenshots were taken by [AwesomeShot](https://github.com/Awesomesh0t/awesomeshot)
105 |
106 | - **Android Info**
107 | ``` bash
108 | sysinfo android
109 | ```
110 | 
111 |
112 | - **Disk Fetch**
113 | ``` bash
114 | sysinfo disk
115 | ```
116 | 
117 |
118 | > **Disk Fetch (all)**
119 | 
120 |
121 | - **CPU Info**
122 | ``` bash
123 | sysinfo cpu
124 | ```
125 | 
126 |
127 | > **Monitoring**
128 | 
129 |
130 | - **Memory Fetch**
131 | ``` bash
132 | sysinfo memory
133 | ```
134 | 
135 |
136 | > **Monitoring**
137 | 
138 |
139 | - **System Baseinfo**
140 | ``` bash
141 | sysinfo sysbinfo
142 | ```
143 | 
144 |
145 | - **Network Stats**
146 | ``` bash
147 | sysinfo netstats
148 | ```
149 | 
150 | > **Cellular Info**
151 | ``` bash
152 | sysinfo netstats --cellular
153 | ```
154 | 
155 | > **WiFi Info**
156 | ``` bash
157 | sysinfo netstats --wifi
158 | ```
159 | 
160 | - **Internet Speed**
161 | ``` bash
162 | sysinfo speed
163 | ```
164 | 
165 |
166 | - **Battery Statistics**
167 | ``` bash
168 | sysinfo Battery
169 | ```
170 | 
171 |
172 | > **Battery Monitoring**
173 | 
174 |
175 | - **Update view**
176 | 
177 |
178 | - **Sensors Info**
179 | ``` bash
180 | sysinfo sensor
181 | ```
182 | 
183 |
184 |
185 | ## Note
186 | - Some information may not be visible in certain functions because I only use a specific fetching method on one device.
187 | - Your contributions could enhance this script by providing even more detailed information about Android System.
188 |
189 | ## Uninstallation
190 |
191 | ``` bash
192 | bash <(curl -s https://raw.githubusercontent.com/Aj-Seven/Android-Sysinfo/master/sys-uninstall)
193 | ```
194 |
195 | ## Contribution
196 | Contributions are welcome! Feel free to fork the repository, make your changes and submit a pull request with relevant message of update or changes.
197 |
198 | ## Credits
199 |
200 | - [Awesomeshot](https://github.com/Awesomesh0t/awesomeshot.git) For Awesome screenshot Images.
201 |
202 | - [myTermux](https://github.com/mayTermux/myTermux.git) For Custom shell,themes and config of termux.
203 |
204 | - [duf](https://github.com/muesli/duf) For Disk Usage.
205 |
--------------------------------------------------------------------------------
/sys-install:
--------------------------------------------------------------------------------
1 | #!/data/data/com.termux/files/usr/bin/bash
2 |
3 | # Author: Abdul Jaber(Aj-Seven)
4 | # Github: @Aj-Seven
5 | # Reddit: @A_J07
6 |
7 | red='\033[1;91m'
8 | green='\033[1;92m'
9 | off='\033[0;0m'
10 | cyan='\033[1;96m'
11 | yellow='\033[1;33m'
12 | white='\033[1;97m'
13 |
14 | clear
15 | echo -e "$yellow Name:$off$white sysinfo installer$off"
16 | echo -e "$yellow Version:$off$white V2.0$off"
17 | echo -e "$white Installing Required Dependencies. Please wait... :) $off"
18 | echo -e "$cyan Installation Depends on internet speed$off"
19 |
20 | # Function to install package and show message
21 | install_package() {
22 | local package_name="$1"
23 | if ! command -v "$package_name" >/dev/null 2>&1; then
24 | echo -e "$cyan (Installing $package_name...) $off"
25 | if pkg install -y "$package_name" >/dev/null 2>&1; then
26 | echo -e "$green Installed $package_name successfully $off"
27 | else
28 | echo -e "$red Failed to install $package_name $off"
29 | exit 1
30 | fi
31 | else
32 | echo -e "$green $package_name is already installed $off"
33 | fi
34 | }
35 |
36 | # Function to check if tput exists under ncurses-utils package
37 | check_without_version() {
38 | if [[ (-f $PREFIX/bin/termux-battery-status) && (-f $PREFIX/bin/tput) ]]; then
39 | echo -e "$green termux-api is already installed$off"
40 | echo -e "$green tput is already installed$off"
41 | else
42 | echo -e "$yellow Installing termux-api...$off"
43 | if pkg install -y termux-api >/dev/null 2>&1; then
44 | echo -e "$green Installed termux-api successfully$off"
45 | else
46 | echo -e "$red Failed to install termux-api$off"
47 | exit 1
48 | fi
49 | echo -e "$yellow Installing tput...$off"
50 | if pkg install -y ncurses-utils >/dev/null 2>&1; then
51 | echo -e "$green Installed tput successfully$off"
52 | else
53 | echo -e "$red Failed to install tput$off"
54 | exit 1
55 | fi
56 | fi
57 | }
58 |
59 | install_script() {
60 | REPO_URL="https://github.com/Aj-Seven/Android-Sysinfo"
61 | REPO_DIR="$PREFIX/share/Android-Sysinfo"
62 | SCRIPT_NAME="sysinfo"
63 | BIN_DIR="$PREFIX/bin"
64 | SCRIPT_PATH="$BIN_DIR/$SCRIPT_NAME"
65 |
66 | echo -e "$red Deleting files from previous installation... $off"
67 | rm -rf $SCRIPT_PATH $REPO_DIR >/dev/null 2>&1;
68 |
69 | # Clone the repository directory
70 | echo -e "$cyan Cloning repository directory... $off"
71 | if git clone "$REPO_URL" "$REPO_DIR" >/dev/null 2>&1; then
72 | echo -e "$green Repository directory cloned Successfully... $off"
73 | # Check if the script file exists in the repository directory
74 | if [ -f "$REPO_DIR/$SCRIPT_NAME" ]; then
75 | # Create a symbolic link to the script in the bin directory
76 | ln -s "$REPO_DIR/$SCRIPT_NAME" "$SCRIPT_PATH"
77 | if [ -L "$SCRIPT_PATH" ]; then
78 | echo -e "$green Script linked and Installed Successfully. Run it by sysinfo $off"
79 | else
80 | echo -e "$red Failed to link script $off"
81 | exit 1
82 | fi
83 | else
84 | echo -e "$red Script not Installed :( $off"
85 | exit 1
86 | fi
87 | else
88 | echo -e "$red Failed to clone repository directory $off"
89 | exit 1
90 | fi
91 | }
92 |
93 | install_pkg() {
94 | echo -e "$yellow Performing package update...$off"
95 | if pkg update -y >/dev/null 2>&1; then
96 | echo -e "$green Package update completed successfully$off"
97 | else
98 | echo -e "$red Failed to update packages$off"
99 | exit 1
100 | fi
101 |
102 | check_without_version
103 | install_package curl
104 | install_package git
105 | install_package duf
106 | install_package figlet
107 | install_package bc
108 | install_package jq
109 | install_package nmap
110 | install_package speedtest-go
111 | }
112 |
113 | # Set the default PREFIX if not provided
114 | if [ -z "$PREFIX" ]; then
115 | PREFIX="/data/data/com.termux/files/usr/"
116 | fi
117 |
118 | # Install packages
119 | if ! install_pkg; then
120 | echo -e "$red Installation of packages failed. Exiting...$off"
121 | exit 1
122 | fi
123 |
--------------------------------------------------------------------------------
/sys-uninstall:
--------------------------------------------------------------------------------
1 | #!/data/data/com.termux/files/usr/bin/bash
2 |
3 | #Author: Abdul Jaber(Aj-Seven)
4 | #Github: @Aj-Seven
5 | #Reddit: @A_J07
6 |
7 | red='\033[1;91m'
8 | green='\033[1;92m'
9 | off='\033[0;0m'
10 | cyan='\033[1;96m'
11 | yellow='\033[1;33m'
12 | white='\033[1;97m'
13 |
14 | uninstall_script() {
15 | REPO_URL="https://github.com/Aj-Seven/Android-Sysinfo"
16 | REPO_DIR="$PREFIX/share/Android-Sysinfo"
17 | SCRIPT_NAME="sysinfo"
18 | BIN_DIR="$PREFIX/bin"
19 | SCRIPT_PATH="$BIN_DIR/$SCRIPT_NAME"
20 |
21 |
22 | if [[ (-L $SCRIPT_PATH ) && (-d $REPO_DIR ) ]]; then
23 | echo -e "$red Deleting files... $off"
24 | rm -rf $SCRIPT_PATH $REPO_DIR; true;
25 | fi
26 |
27 |
28 | if [ ! -d "$REPO_DIR" ]; then
29 | echo -e "$red Repository directory Deleted Successfully.$off"
30 | if [ ! -f "$SCRIPT_PATH" ]; then
31 | echo -e "$red Script UnInstalled Successfully..$off"
32 | else
33 | echo -e "$red Script not un-installed :) $off"
34 | fi
35 | else
36 | echo -e "$red Failed to delete repository directory $off"
37 | fi
38 | }
39 |
40 | clear
41 | echo -e "$yellow Name:$off$white sysinfo uninstaller$off"
42 | echo -e "$yellow Version:$off$white V2.0$off"
43 | echo -e "$white Do you want to un-install the sysinfo script?(Y/N)$off"
44 | read select
45 | case $select in
46 | Y|y) uninstall_script
47 | ;;
48 | N|n) exit 1
49 | ;;
50 | *) echo -e "$yellow INFO:$off $white Error Selection...$off"
51 | ;;
52 | esac
53 |
--------------------------------------------------------------------------------
/sysinfo:
--------------------------------------------------------------------------------
1 | #!/data/data/com.termux/files/usr/bin/bash
2 |
3 | # Author: Abdul Jaber(Aj-Seven)
4 | # Github: @Aj-Seven
5 | # Reddit: @A_J07
6 |
7 | #color codes
8 | RED=$(tput setaf 1)
9 | GREEN=$(tput setaf 2)
10 | YELLOW=$(tput setaf 3)
11 | BLUE=$(tput setaf 4)
12 | MAGENTA=$(tput setaf 5)
13 | CYAN=$(tput setaf 6)
14 | WHITE=$(tput setaf 7)
15 | RESET=$(tput sgr0)
16 |
17 | #text formatting
18 | BOLD=$(tput bold)
19 | UNDERLINE=$(tput smul)
20 | NO_UNDERLINE=$(tput rmul)
21 |
22 | #store repo info
23 | REPO_DIR="$PREFIX/share/Android-Sysinfo"
24 | SCRIPT_NAME="sysinfo"
25 | REPO_URL="https://github.com/Aj-Seven/Android-Sysinfo"
26 | BIN_DIR="$PREFIX/bin"
27 |
28 | # Function to print texts
29 | PRINT() {
30 | local style=$1
31 | local color=$2
32 | local message=$3
33 | echo -e "${style}${color}${message}${RESET}"
34 | }
35 |
36 | # Function to update the repository
37 | update_repo() {
38 | cd "$REPO_DIR" || exit 1
39 |
40 | # Run git pull origin and parse the output to show only relevant lines
41 | if output=$(git pull origin $(git rev-parse --abbrev-ref HEAD) 2>&1); then
42 | if echo "$output" | grep -q 'Already up to date'; then
43 | echo "up-to-date"
44 | elif echo "$output" | grep -q 'Updating'; then
45 | echo "updated"
46 | PRINT "
47 | $BOLD$YELLOW Updated the script, start it again to apply changes..."
48 | exit 0
49 | else
50 | echo "Failed"
51 | fi
52 | fi
53 | }
54 |
55 | # Function to check for updates in the repository
56 | monitor_update() {
57 | # Check if the repository folder exists
58 | if [ ! -d "$REPO_DIR" ]; then
59 | git clone "$REPO_URL" "$REPO_DIR" > /dev/null 2>&1 || { UPDATE_STATUS="failed"; return; }
60 | fi
61 |
62 | # Fetch updates forcefully
63 | cd "$REPO_DIR" || { UPDATE_STATUS="failed"; return; }
64 | git fetch --force origin > /dev/null 2>&1
65 |
66 | # Get the current branch
67 | current_branch=$(git rev-parse --abbrev-ref HEAD)
68 |
69 | # Check if the local branch is behind the remote branch
70 | if [ $(git rev-list HEAD...origin/$current_branch --count) -gt 0 ]; then
71 | return 0
72 | else
73 | return 1
74 | fi
75 | }
76 |
77 | # Function to check the termux api android pkg availabity
78 | check_termux_api() {
79 | # Capture the output and check if the string "Error: Not found" exists
80 | local status=$(termux-api-start 2>&1 | grep -o "Error: Not found")
81 |
82 | # Compare the status with the string "Error: Not found"
83 | if [ "$status" == "Error: Not found" ]; then
84 | return 0
85 | else
86 | return 1
87 | fi
88 | }
89 |
90 | # Function to check from termux_api and prompt request for installation
91 | termux_api_with_prompt_setup() {
92 | if check_termux_api; then
93 | clear
94 | PRINT $BOLD"$RED Please Install termux-api in your device, to run this option$RESET
95 |
96 | $BLUE Visit here: $GREEN https://f-droid.org/en/packages/com.termux.api/$RESET
97 |
98 | $BOLD$WHITE Do you want to visit the site?? Enter Y"
99 |
100 | read visit
101 |
102 | if [[ $visit == "Y" ]] || [[ $visit == "y" ]]; then
103 | xdg-open https://f-droid.org/en/packages/com.termux.api/
104 | else
105 | main
106 | fi
107 | fi
108 | }
109 |
110 |
111 | #check update function for menu selection
112 | check_update() {
113 | clear
114 | cd "$REPO_DIR" || { UPDATE_STATUS="failed"; return; }
115 | git fetch --force origin > /dev/null 2>&1
116 |
117 | current_branch=$(git rev-parse --abbrev-ref HEAD)
118 |
119 | if [ $(git rev-list HEAD...origin/$current_branch --count) -gt 0 ]; then
120 | clear
121 | PRINT "
122 | $BOLD$GREEN Updates Available :)\n"
123 | read -p "Do you want to update it?(Y/N) " select
124 | case $select in
125 | Y|y) update_repo
126 | ;;
127 | N|n)
128 | PRINT "
129 | $BOLD$YELLOW Returning to main Menu"
130 | UPDATE_STATUS=$(monitor_update)
131 | main
132 | ;;
133 | *)
134 | PRINT "
135 | $BOLD$YELLOW INFO:$RESET Invalid Selection, Select options in Between Y/N..."
136 | ;;
137 | esac
138 | else
139 | PRINT "
140 | $BOLD$CYAN Already Up-to-date."
141 | PRINT "
142 | $BOLD$YELLOW INFO:$RESET Press 'Enter' or any key to return main menu..."
143 | read -r
144 | fi
145 | }
146 |
147 | #Function to check whether ADB remote tcp is open or not.
148 | check_adb_port() {
149 | local state=$(nmap -p 5555 127.0.0.1)
150 | if echo "$state" | grep -q "open"; then
151 | return 0
152 | else
153 | return 1
154 | fi
155 | }
156 |
157 | #Function to connect ADB to the device
158 | connect_adb() {
159 | adb connect 127.0.0.1:5555 >/dev/null 2>&1
160 | }
161 |
162 | #Function to run adb shell command within localhost port to avoid conflicts
163 | run-shell() {
164 | adb -s 127.0.0.1:5555 shell "$@"
165 | }
166 |
167 | #spinner function
168 | spinner() {
169 | local message=$1
170 | local pid=$2
171 | local delay=0.1
172 | local colors=("31;5")
173 | local spinstr='⣾⣽⣻⢿⡿⣟⣯⣷'
174 | local i=0
175 | tput civis
176 | while ps -p $pid > /dev/null; do
177 | local color=${colors[i++ % ${#colors[@]}]}
178 | printf "\e[${color}m%s\e[0m" "${spinstr:i++%${#spinstr}:1}"
179 | sleep $delay
180 | printf "\b"
181 | done
182 | tput cnorm
183 | printf " \b\b\b"
184 | }
185 |
186 | memusage() {
187 | clear
188 | get_memory_info() {
189 | local mem_info=$(free -m | awk '/Mem/ {print}')
190 | TOTAL_MEM=$(awk '{print $2}' <<< "$mem_info")
191 | AVAILABLE_MEM=$(awk '{print $7}' <<< "$mem_info")
192 | TOTAL_USED_MEM=$(( TOTAL_MEM - AVAILABLE_MEM ))
193 | BUFFCACHE_MEM=$(awk '{print $6}' <<< "$mem_info")
194 | FREE_BUFF_MEM=$(awk '{print $4}' <<< "$mem_info")
195 | PERCENT_USED_MEM=$(awk 'NR==2{printf "%.2f%%", $3*100/$2 }' <<< "$(free -m)")
196 | }
197 |
198 | print_memory_details() {
199 | PRINT $BOLD"
200 | $CYAN Total Memory: $WHITE $TOTAL_MEM MB
201 | $CYAN Used Memory: $WHITE $TOTAL_USED_MEM MB
202 | $CYAN Available Memory: $WHITE $AVAILABLE_MEM MB
203 | $CYAN Buffer+Cache Memory: $WHITE $BUFFCACHE_MEM MB
204 | $CYAN Free Buff+Cache Memory: $WHITE $FREE_BUFF_MEM MB
205 | $CYAN Percentage Usage: $WHITE $PERCENT_USED_MEM"
206 | }
207 | get_memory_info
208 | PRINT $BOLD"
209 | $UNDERLINE$MAGENTA Memory Details:$RESET"
210 | print_memory_details
211 | PRINT "
212 | $YELLOW$BOLD INFO:$RESET Press 'l' for Live Monitoring...
213 | $YELLOW$BOLD INFO:$RESET Press 'Enter' or any key to Quit."
214 | read -n 1 key
215 | if [[ $key = "l" ]]; then
216 | clear
217 | while true; do
218 | tput cup 0
219 | tput el
220 | get_memory_info
221 | PRINT $BOLD"
222 | $UNDERLINE$MAGENTA Memory Live Monitoring:$RESET"
223 | print_memory_details
224 | PRINT "
225 | $YELLOW$BOLD INFO:$RESET Press 'Enter' or any key to Quit."
226 | sleep 1
227 | read -n 1 -s -t 1 && break
228 | done
229 | fi
230 | }
231 |
232 | #CPU Information
233 | cpu() {
234 | clear
235 | cpu_info() {
236 | data=$(lscpu)
237 | name=$(echo "$data" | grep "Vendor ID" | awk '{print $3}')
238 | model=$(getprop ro.soc.model)
239 | arch=$(echo "$data" | grep "Architecture" | awk '{print $2}')
240 | cores=$(grep -c "^processor" /proc/cpuinfo)
241 | governor=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor)
242 | order=$(echo "$data" | awk '/Byte Order/ {for (i=3; i<=NF; i++) printf "%s ", $i}')
243 | op_modes=$(echo "$data" | awk '/CPU op-mode\(s\)/ {print $(NF-1), $NF}')
244 | features=$(awk '/Features/ && !flag {sub(/^[[:space:]]*Features[[:space:]]*:[[:space:]]*/, ""); print; flag=1}' /proc/cpuinfo)
245 |
246 | model_names=$(echo "$data" | awk '/Model name/ {for (i=3; i<=NF; i++) printf "%s ", $i}')
247 |
248 | min_max_values=$(echo "$data" | awk '/CPU (min|max) MHz:/ {print $NF}')
249 |
250 | scaling_percentages=$(echo "$data" | grep -oP 'CPU\(s\) scaling MHz:\s+\K\d+%')
251 |
252 | vulnerabilities=$(echo "$data" | grep -E "Vulnerability|bugs" | awk '/Vulnerability/ {gsub("Vulnerability ", ""); print $0}')
253 |
254 | abi=$(getprop ro.product.cpu.abi)
255 | s_abi=$(getprop ro.product.cpu.abilist)
256 | # Number of CPUs
257 | num_cpus=$(echo "$model_names" | wc -l)
258 |
259 | PRINT "$BOLD
260 | $CYAN Name: $WHITE $name
261 | $CYAN Model: $WHITE $model
262 | $CYAN Architecture: $WHITE $arch
263 | $CYAN Operation Mode: $WHITE $op_modes
264 | $CYAN No. of Cores: $WHITE $cores
265 | $CYAN Governor: $WHITE $governor
266 | $CYAN ABI: $WHITE $abi
267 | $CYAN Supported ABIs: $WHITE $s_abi
268 | $CYAN Byte Order: $WHITE $order
269 | $CYAN Model name: $WHITE $(echo "$model_names" | awk NR==1)
270 | $CYAN Min MHz: $WHITE $(echo "$min_max_values" | awk NR==2) $(echo "$min_max_values" | awk NR==4)
271 | $CYAN Max MHz: $WHITE $(echo "$min_max_values" | awk NR==1) $(echo "$min_max_values" | awk NR==3)
272 | $CYAN Max Scaling: $WHITE $(echo "$scaling_percentages" | awk NR==1) $(echo "$scaling_percentages" | awk NR==2)
273 | $CYAN Features: $WHITE $features
274 | $UNDERLINE$RED Vulnerabilities:$RESET$BOLD
275 | $WHITE$vulnerabilities"
276 |
277 | }
278 |
279 | #default state of getting cpu load
280 | cpu_load_without_adb() {
281 | local cpu_usage=$(ps aux | awk 'BEGIN {sum=0} {sum+=$3}; END {printf "%.2f%%\n",sum}')
282 | PRINT $BOLD"
283 | $CYAN CPU Load(within Termux): $WHITE $cpu_usage"
284 | }
285 |
286 | #Function to read CPU stats from /proc/stat
287 | read_cpu_stats() {
288 | read cpu user nice system idle iowait irq softirq steal guest guest_nice <<< $(run-shell grep '^cpu ' /proc/stat)
289 | }
290 |
291 | #get CPU frequency
292 | read_cpu_mhz() {
293 | local core_number=-1
294 | local cores=()
295 | local freqs=()
296 |
297 | #loop through each CPU core.
298 | for file in /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq; do
299 |
300 | #get CPU core number.
301 | ((core_number++))
302 |
303 | #store it in array.
304 | cores+=("$core_number")
305 |
306 | #extract frequency values in KHz.
307 | freq_khz=$(cat "$file")
308 |
309 | # Convert kHz to MHz
310 | freq_mhz=$(echo "scale=2; $freq_khz / 1000" | bc)
311 | freqs+=("$freq_mhz")
312 | done
313 |
314 | for ((i=0; i<${#cores[@]}; i++)); do
315 | PRINT $BOLD"
316 | $CYAN CPU core ${cores[i]}:$WHITE ${freqs[i]} MHz"
317 | done
318 | }
319 |
320 | #Function to calculate CPU usage percentage
321 | calculate_cpu_usage() {
322 | local prev_idle=$1
323 | local prev_total=$2
324 | local idle=$3
325 | local total=$4
326 |
327 | local idle_delta=$((idle - prev_idle))
328 | local total_delta=$((total - prev_total))
329 |
330 | # Avoid division by zero
331 | if [[ $total_delta -eq 0 ]]; then
332 | echo "0.00"
333 | return
334 | fi
335 |
336 | local cpu_usage=$(bc -l <<< "scale=2; (1 - ($idle_delta /$total_delta)) * 100")
337 | echo $cpu_usage
338 | }
339 |
340 | # Initial readings
341 | read_cpu_stats
342 | prev_idle=$idle
343 | prev_total=$((user + nice + system + idle + iowait + irq + softirq + steal))
344 |
345 | #fetch cpu load by adb
346 | cpu_load_with_adb() {
347 | read_cpu_stats
348 | local cpu_usage=$(calculate_cpu_usage $prev_idle $prev_total $idle $((user + nice + system + idle + iowait + irq + softirq + steal)))
349 | # Update previous values
350 | prev_idle=$idle
351 | prev_total=$((user + nice + system + idle + iowait + irq + softirq + steal))
352 | PRINT $BOLD"
353 | $CYAN Overall System Load:$WHITE $cpu_usage%"
354 | }
355 |
356 | #check status to run function by adb or without adb
357 | check_status() {
358 | if check_adb_port; then
359 | connect_adb
360 | cpu_load_with_adb
361 | else
362 | PRINT $BOLD"
363 | $YELLOW$BOLD INFO:$RESET Fetching CPU load via 'ps'"
364 | cpu_load_without_adb
365 | fi
366 | }
367 |
368 | PRINT $BOLD"
369 | $UNDERLINE$MAGENTA CPU Details:$RESET"
370 | cpu_info
371 | PRINT $BOLD"
372 | $UNDERLINE$MAGENTA CPU Load:$RESET"
373 | check_status
374 | PRINT "
375 | $YELLOW$BOLD INFO:$RESET Press 'l' for Live Monitoring...
376 | $YELLOW$BOLD INFO:$RESET Press 'Enter' or any key to Quit."
377 | read -n 1 key
378 | if [[ $key = "l" ]]; then
379 | clear
380 | while true; do
381 | tput cup 0
382 | tput el
383 | PRINT $BOLD"
384 | $UNDERLINE$MAGENTA CPU Load Live Monitoring:$RESET"
385 | PRINT $BOLD"
386 | $CYAN Model name: $WHITE $(echo "$model_names" | awk NR==1)
387 | $CYAN Min MHz: $WHITE $(echo "$min_max_values" | awk NR==2) $(echo "$min_max_values" | awk NR==4)
388 | $CYAN Max MHz: $WHITE $(echo "$min_max_values" | awk NR==1) $(echo "$min_max_values" | awk NR==3)"
389 | PRINT $BOLD"
390 | $UNDERLINE$MAGENTA CPU Cores:$RESET"
391 | read_cpu_mhz
392 | PRINT $BOLD"
393 | $UNDERLINE$MAGENTA CPU Load:$RESET"
394 | check_status
395 | PRINT "
396 | $YELLOW$BOLD INFO:$RESET Press 'Enter' or any key to Quit."
397 | sleep 1
398 | read -n 1 -s -t 1 && break
399 | done
400 | fi
401 | }
402 |
403 | #Disk Usage
404 | disk() {
405 | clear
406 | PRINT $BOLD"
407 | $UNDERLINE$MAGENTA Disk Usage:$RESET"
408 | duf -only-fs sdcardfs
409 | PRINT "
410 | $YELLOW$BOLD INFO:$RESET Press 'm' to get all disk usage...
411 | $YELLOW$BOLD INFO:$RESET Press 'Enter' or any key to Quit."
412 | read -n 1 key
413 | if [[ $key = "m" ]]; then
414 | clear
415 | PRINT $BOLD"
416 | $UNDERLINE$MAGENTA Disk Usage(all):$RESET"
417 | duf
418 | PRINT "
419 | $YELLOW$BOLD INFO:$RESET Press 'Enter' or any key to Quit."
420 | read -n 1 && break
421 | fi
422 | }
423 |
424 | #info about android software
425 | androidinfo() {
426 | clear
427 | PRINT $BOLD"
428 | $UNDERLINE$MAGENTA Android Software Info:$RESET$BOLD
429 | $CYAN Brand: $WHITE $(getprop ro.product.brand)
430 | $CYAN Manufacturer: $WHITE $(getprop ro.product.manufacturer)
431 | $CYAN Device Model: $WHITE $(getprop ro.product.model)
432 | $CYAN Device UI: $WHITE $(getprop ro.product.brand.ui)
433 | $CYAN Android Version: $WHITE $(getprop ro.build.version.release)
434 | $CYAN SDK Version: $WHITE $(getprop ro.build.version.sdk)
435 | $CYAN Build Number: $WHITE $(getprop ro.build.display.id)
436 | $CYAN Build Date: $WHITE $(date -d @$(getprop ro.build.date.utc))
437 | $CYAN Baseband: $WHITE $(getprop gsm.version.baseband)
438 | $CYAN Build Type: $WHITE $(getprop ro.build.type)
439 | $CYAN Build ID: $WHITE $(getprop ro.product.build.id)
440 | $CYAN Language: $WHITE $(getprop persist.sys.locale)
441 | $CYAN Timezone: $WHITE $(getprop persist.sys.timezone)"
442 | PRINT "$BOLD
443 | $YELLOW INFO:$RESET Press 'Enter' or any key to Quit..."
444 | read -r
445 | }
446 |
447 | #wifi info
448 | wifi_info() {
449 | termux_api_with_prompt_setup
450 | local data=$(termux-wifi-connectioninfo)
451 | local status=$(jq -r '.supplicant_state' <<< "$data")
452 | local name=$(jq -r '.ssid' <<< "$data")
453 | local hidden_state=$(jq -r '.ssid_hidden' <<< "$data")
454 | local freq=$(jq -r '.frequency_mhz' <<< "$data")
455 | local ip=$(jq -r '.ip' <<< "$data")
456 | local mac_address=$(jq -r '.mac_address' <<< "$data")
457 | local max_speed=$(jq -r '.link_speed_mbps' <<< "$data")
458 |
459 | if [[ $status != "COMPLETED" ]]; then
460 | PRINT $YELLOW "WiFi information not available."
461 | return 1
462 | fi
463 | hidden_state=$( [[ "$hidden_state" == "true" ]] && echo "Yes" || echo "No" )
464 |
465 | PRINT $BOLD"
466 | $UNDERLINE $MAGENTA WiFi Info:$RESET$BOLD
467 | $CYAN WiFi Name: $WHITE $name
468 | $CYAN Hidden State: $WHITE $hidden_state
469 | $CYAN Frequency: $WHITE $freq MHz
470 | $CYAN IP Address: $WHITE $ip
471 | $CYAN MAC Address: $WHITE $mac_address
472 | $CYAN Max Speed: $WHITE $max_speed mbps"
473 | }
474 |
475 | #cellular info
476 | cellular_info() {
477 | termux_api_with_prompt_setup
478 | local data=$(termux-telephony-deviceinfo)
479 | local network=$(jq -r '.network_operator_name' <<< "$data")
480 | local type=$(jq -r '.network_type' <<< "$data")
481 | local roaming=$(jq -r '.network_roaming' <<< "$data")
482 | local data_enabled=$(jq -r '.data_enabled' <<< "$data")
483 | local connection=$(jq -r '.data_state' <<< "$data")
484 | local signal=$(jq -r '.signal_strength' <<< "$data")
485 | local sim=$(jq -r '.sim_operator_name' <<< "$data")
486 | local country=$(jq -r '.sim_country_iso' <<< "$data")
487 | local state=$(jq -r '.sim_state' <<< "$data")
488 | local dualsim=$(jq -r '.phone_count' <<< "$data")
489 | local phone=$(jq -r '.phone_type' <<< "$data")
490 |
491 | if [[ $state == "absent" ]]; then
492 | echo "Cellular Network Info Not Available.."
493 | return 1
494 | fi
495 |
496 | dualsim=$( [[ $dualsim -eq 2 ]] && echo "Yes" || echo "No" )
497 | roaming=$( [[ $roaming == "true" ]] && echo "Enabled" || echo "Disabled" )
498 | data_enabled=$( [[ $data_enabled == "true" ]] && echo "Enabled" || echo "Disabled" )
499 |
500 | PRINT $BOLD"
501 | $UNDERLINE$MAGENTA Cellular Info:$RESET$BOLD
502 | $CYAN Network Operator: $WHITE $network
503 | $CYAN Network Type: $WHITE $type
504 | $CYAN Roaming: $WHITE $roaming
505 | $CYAN Data Enabled: $WHITE $data_enabled
506 | $CYAN Data Connection: $WHITE $connection
507 | $CYAN Signal Strength: $WHITE $signal
508 | $CYAN SIM Operator: $WHITE $sim
509 | $CYAN SIM Country ISO: $WHITE $country
510 | $CYAN SIM State: $WHITE $state
511 | $CYAN Dual SIM Support: $WHITE $dualsim
512 | $CYAN Phone Network Type: $WHITE $phone"
513 | }
514 |
515 | #Network Information
516 | netstats () {
517 | clear
518 | HOST_NAME=$(hostname)
519 | EXTERNALIP=$(curl -4 ifconfig.me 2>/dev/null)
520 | INTERNALIP=$(hostname -i)
521 | local STATUS=$(
522 | if ping -q -c2 google.com &>/dev/null; then
523 | PRINT $BOLD $GREEN "You are Up :)"
524 | else
525 | PRINT $BOLD $RED "You are Down :("
526 | fi)
527 | PRINT $BOLD"
528 | $UNDERLINE$MAGENTA Network Basic Info:$RESET$BOLD
529 | $CYAN Host Name: $WHITE $HOST_NAME
530 | $CYAN External IP: $WHITE $EXTERNALIP
531 | $CYAN Internal IP: $WHITE $INTERNALIP
532 | $CYAN Connection Status: $WHITE $STATUS"
533 | if check_termux_api; then
534 | PRINT "$BOLD
535 | $RED INFO:$RESET Some of data hidden, Please install termux-api to view properly...
536 | $YELLOW INFO:$RESET Press 'Enter' or any key to Quit..."
537 | read -r
538 | else
539 | wifi_info
540 | cellular_info
541 | fi
542 | }
543 |
544 |
545 | #System Base Information like kernel uptime
546 | sysbaseinfo() {
547 | clear
548 | kn=$(uname -s)
549 | kv=$(uname -v)
550 | kr=$(uname -r)
551 | ka=$(uname -m)
552 | ko=$(uname -o)
553 | uptime=$(uptime -p)
554 | suptime=$(uptime -s)
555 | PRINT $BOLD"
556 | $UNDERLINE$MAGENTA Android Base Info:$RESET$BOLD
557 | $CYAN Operating System: $WHITE $ko
558 | $CYAN Kernel Name: $WHITE $kn
559 | $CYAN Kernel Version: $WHITE $kr
560 | $CYAN Kernel Release: $WHITE $kv
561 | $CYAN System Architect: $WHITE $ka
562 | $CYAN System Uptime: $WHITE $uptime
563 | $CYAN System Since Boot: $WHITE $suptime"
564 | PRINT "$BOLD
565 | $YELLOW INFO:$RESET Press 'Enter' or any key to Quit..."
566 | read -r
567 | }
568 |
569 |
570 | #Network Speed Checker
571 | network_speed() {
572 | clear
573 | PRINT "
574 | $UNDERLINE$YELLOW Running SpeedTest, Please Wait..."
575 | tmpfile=$(mktemp)
576 | speedtest-go | grep -E "Download|Upload|Latency" > "$tmpfile" & 2>/dev/null
577 |
578 | local pid=$!
579 |
580 | spinner "Fetching innternet speed..." $pid
581 |
582 | wait $pid
583 |
584 | download=$(grep -oP "Download:\s+\K[0-9.]+" "$tmpfile")
585 | upload=$(grep -oP "Upload:\s+\K[0-9.]+" "$tmpfile")
586 | latency=$(grep -oP "Latency:\s+\K[0-9.]+" "$tmpfile")
587 |
588 | PRINT $BOLD"
589 | $UNDERLINE$MAGENTA Internet Speed Data:$RESET$BOLD
590 | $CYAN Download speed: $WHITE $download Mbps
591 | $CYAN Upload speed: $WHITE $upload Mbps
592 | $CYAN Latency: $WHITE $latency ms"
593 |
594 | rm "$tmpfile"
595 | PRINT "$BOLD
596 | $YELLOW INFO:$RESET Press 'Enter' or any key to Quit..."
597 | read -r
598 | }
599 |
600 | # battery function
601 | battery() {
602 | clear
603 | termux_api_with_prompt_setup
604 |
605 | get_batt_info() {
606 | local data=$(termux-battery-status)
607 | health=$(jq -r '.health' <<< "$data")
608 | percentage=$(jq -r '.percentage' <<< "$data")
609 | plugged=$(jq -r '.plugged' <<< "$data")
610 | charging=$(jq -r '.status' <<< "$data")
611 | temp=$(jq -r '.temperature' <<< "$data")
612 | current=$(jq -r '.current' <<< "$data")
613 | }
614 |
615 | print_batt_details() {
616 | PRINT $BOLD"
617 | $CYAN Percentage: $WHITE $percentage%
618 | $CYAN Health: $WHITE $health
619 | $CYAN Current: $WHITE $current
620 | $CYAN Temperature: $WHITE $temp
621 | $CYAN Plugged: $WHITE $plugged
622 | $CYAN Charging: $WHITE $charging"
623 | }
624 |
625 | get_batt_info
626 | PRINT $BOLD"
627 | $UNDERLINE$MAGENTA Battery Statistics:$RESET"
628 | print_batt_details
629 | PRINT "
630 | $YELLOW$BOLD INFO:$RESET Press 'l' for Live Monitoring...
631 | $YELLOW$BOLD INFO:$RESET Press 'Enter' or any key to Quit."
632 | read -n 1 key
633 | if [[ $key == "l" ]]; then
634 | clear
635 | while true; do
636 | tput cup 0
637 | tput el
638 | get_batt_info
639 | PRINT $BOLD"
640 | $UNDERLINE$MAGENTA Battery Live Monitoring:$RESET"
641 | print_batt_details
642 | PRINT "
643 | $YELLOW$BOLD INFO:$RESET Press 'Enter' or any key to Quit."
644 | read -n 1 -s -t 1 && break
645 | done
646 | fi
647 | }
648 |
649 | # Sensors Info function
650 | get_sensor_info() {
651 | clear
652 | termux_api_with_prompt_setup
653 |
654 | local data=$(termux-sensor -l)
655 | local SENSORS=$(jq -r '.sensors[]' <<< "$data")
656 | PRINT $BOLD"
657 | $UNDERLINE$MAGENTA Sensors List:$RESET
658 |
659 | $WHITE$SENSORS
660 |
661 | $YELLOW$BOLD INFO:$RESET Press 'Enter' or any key to Quit."
662 | read -r
663 | }
664 |
665 | # Version
666 | version() {
667 | PRINT $BOLD"Android System Information
668 | $WHITE Version: 2.1.0"
669 | }
670 |
671 | #Help Function
672 | _help() {
673 | PRINT $WHITE"$BOLD
674 | Usage:$RESET .
675 |
676 | A tool for displaying Android System Information
677 | $BOLD
678 | Flags:$RESET
679 | -h, --help Show this help.
680 | -v, --version Print the version number
681 | $BOLD
682 | Commands:$RESET
683 | android Display Android System Overview.
684 | disk Show disk usage.
685 | cpu View CPU Information.
686 | memory Display memory usage.
687 | sysbinfo Provide system information.
688 | netstats Show network statistics.
689 | speed Measure internet Speed.
690 | battery Display battery statistics.
691 | sensor Get device sensors list.
692 | $BOLD
693 | Example:$RESET
694 | sysinfo disk
695 | "
696 | }
697 |
698 | netstat_help() {
699 | PRINT $WHITE"$BOLD
700 | Usage:$RESET sysinfo netstats [ ].
701 | $BOLD
702 | Flags:$RESET
703 | --wifi - Show Wi-Fi connection Information if available.
704 | --cellular - Show cellular connection Information if available.
705 | --help - Shows this Help.
706 | $BOLD
707 | Example:$RESET
708 | sysinfo netstats --wifi
709 | "
710 | }
711 |
712 | #check adb status
713 | ADB_STATUS=$(
714 | if check_adb_port; then
715 | PRINT "$BOLD$GREEN CONNECTED $RESET"
716 | else
717 | PRINT "$BOLD$RED DIS-CONNECTED $RESET"
718 | fi)
719 |
720 | #check termux-api status
721 | TERMUX_API_STATUS=$(
722 | if check_termux_api; then
723 | PRINT "$BOLD$RED NOT-INSTALLED"
724 | else
725 | PRINT "$BOLD$GREEN INSTALLED"
726 | fi)
727 |
728 | #check script update status
729 | UPDATE_STATUS=$(
730 | if monitor_update; then
731 | PRINT "$BOLD$GREEN AVAILABLE"
732 | else
733 | PRINT "$BOLD$BLUE UP-TO-DATE"
734 | fi)
735 |
736 | # Display menu function
737 | display_menu() {
738 | PRINT "
739 | $BOLD$BLUE $(figlet -c -t -f term "SYSTEM INFORMATION v2.0")
740 |
741 | $BOLD$YELLOW $(figlet -c -t -f term "Github: https://github.com/Aj-Seven/Android-Sysinfo")
742 |
743 | $BOLD$CYAN $(figlet -c -t -f digital "Author: @Aj-Seven")
744 |
745 | $BOLD$MAGENTA UPDATES:$RESET$UPDATE_STATUS | $BOLD$MAGENTA ADB:$RESET$ADB_STATUS
746 |
747 | $BOLD$MAGENTA TERMUX-API:$RESET$TERMUX_API_STATUS
748 |
749 |
750 | $UNDERLINE Select the options below:$RESET$BOLD$WHITE
751 | 01) Android Info
752 | 02) Disk Fetch
753 | 03) CPU Info
754 | 04) Memory Fetch
755 | 05) System BaseInfo
756 | 06) Network Stats
757 | 07) Internet Speed
758 | 08) Battery Stats
759 | 09) Sensor Info
760 | 10) Check Updates
761 | 00) Quit\n"
762 | }
763 |
764 | main() {
765 | clear
766 | display_menu
767 | read opt
768 | case $opt in
769 | 1) androidinfo ;;
770 | 2) disk ;;
771 | 3) cpu ;;
772 | 4) memusage ;;
773 | 5) sysbaseinfo ;;
774 | 6) netstats ;;
775 | 7) network_speed ;;
776 | 8) battery;;
777 | 9) get_sensor_info;;
778 | 10) check_update ;;
779 | 0) PRINT $RED "Exiting...:)"
780 | sleep 0.5s;
781 | exit 0;
782 | ;;
783 | *)
784 | PRINT $CYAN "Error Selection. Try Again..."
785 | ;;
786 | esac
787 | }
788 |
789 |
790 | # Set the default PREFIX if not provided
791 | if [ -z "$PREFIX" ]; then
792 | PREFIX="/data/data/com.termux/files/usr/"
793 | fi
794 |
795 | if [ $# -eq 0 ]; then
796 | command clear
797 | while true; do
798 | main
799 | done
800 | fi
801 |
802 | while [[ "$#" -gt 0 ]]; do
803 | case $1 in
804 | -v|--version) version;;
805 | android) androidinfo;;
806 | disk) disk;;
807 | cpu) cpu;;
808 | memory) memusage;;
809 | sysbinfo) sysbaseinfo;;
810 | netstats)
811 | case "$2$3" in
812 | "--wifi--cellular" | "--cellular--wifi")
813 | wifi_info
814 | cellular_info
815 | ;;
816 | "--wifi")
817 | wifi_info
818 | ;;
819 | "--cellular")
820 | cellular_info
821 | ;;
822 | "--help")
823 | netstat_help
824 | ;;
825 | *)
826 | if [ -z "$2" ] && [ -z "$3" ]; then
827 | netstats
828 | else
829 | netstat_help
830 |
831 | PRINT $RED $BOLD"Error:$RESET Unknown Option '$2$3'"
832 | fi
833 | esac
834 | break
835 | ;;
836 | speed) network_speed;;
837 | battery) battery;;
838 | sensor) get_sensor_info;;
839 | -h|--help) _help ;;
840 | *) _help
841 | PRINT $RED $BOLD"Error:$RESET Unknown Option '$1'"
842 | exit 1;;
843 | esac
844 | shift
845 | done
846 |
--------------------------------------------------------------------------------