Customize Termux Using Python: Hi, if you want to make your Termux application look so amazing like a pro hacker, then this blog is just for you. But before we start anything, let me give you a brief introduction of Termux. Termux is basically a terminal emulator, that we can use it as a terminal for our android devices. The terminal we see on any linux machine such as Kali Linux, Ubuntu, Arch Linux etc. With this terminal, we can also perform cyber attacks as well as computer programing related tasks. It is command line interface that actually helps us very very much to make our job faster and easier like a computer device, just on our android.
So in this article I am going to talk about this Terminal Emulator for Android. But looking at the heading of this article, I think you have guessed what things are going to be covered in this post. If yes, then you are right.
Customize Termux Using Python Like A Pro
Anyway! to customize our termux terminal, we need to do a number of things.Its not like that the ideas I am showing you on this post are the only available ideas to customize your termux. After analyzing my ideas such as the codes or programs I am going to share, you can modify them as your requirements. And also you can look for some alternative ideas .
So, let me describe the methods or the things about which I am talking about.
First, We need to create some python files or you can say some python programs. You can also make your own programs. And the programs will be about a hacker login screen, here the name is “hacker login screen” but it is actually a simple login screen .
Then our next motive will be creating a system components loading screen using python. Again this is also going to be a simple python program.
And after this, we will create a progress bar or loading bar using python.
And once we complete above these, we have to create another python program that shows a anonymous hacker mask or ASCII banner on our screen.
You can use any type of mask or banner, you can find those on a website, I will also mention the website down below this post.
And all set! after this, we are ready to customize our “bash.bashrc” file of our termux.
Don’t know anything about “bash.bashrc” file of termux?
Its a bash file, and this is the main script that controls the settings and the looks of you command line interface, that is termux. Now let’s do this.
Commands To Customize Termux
Down below, I am adding the python programs one by one, so open your termux application, go to home directory, you can check your current directory by using
pwd
If you are in the home directory, the output will be like:
/data/data/com.termux/files/home
And the first one is about creating the login screen. So Create a new python file, using
nano login.py
and paste the following code on it.
Creating A Login Screen Using Python on Termux:
import curses import time def animate_login_screen(stdscr): # Clear the screen stdscr.clear() # Get screen dimensions height, width = stdscr.getmaxyx() # Set up text login_text = "Termux Login" username_text = "Username: " password_text = "Password: " # Predefined username and password username = "termux" password = "" # Calculate the positions of text elements login_x = width // 2 - len(login_text) // 2 username_x = width // 2 - len(username_text) // 2 password_x = width // 2 - len(password_text) // 2 text_y = height // 2 # Animation loop while True: # Clear the screen stdscr.clear() # Print login text stdscr.addstr(text_y - 2, login_x, login_text) # Print username input stdscr.addstr(text_y, username_x, username_text + username) # Print password input stdscr.addstr(text_y + 1, password_x, password_text + "*" * len(password)) # Refresh the screen stdscr.refresh() # Wait for user input key = stdscr.getch() # Check if Enter key is pressed if key == ord('\n'): # Clear the screen stdscr.clear() # Print login success message success_message = "Login successful!" success_x = width // 2 - len(success_message) // 2 stdscr.addstr(text_y, success_x, success_message) # Refresh the screen stdscr.refresh() # Pause for a short duration time.sleep(2) break # Check if backspace key is pressed elif key == curses.KEY_BACKSPACE or key == 127: password = password[:-1] # Remove the last character else: password += chr(key) # Append the typed character to the password # Initialize curses and run the animation curses.wrapper(animate_login_screen)
In the above program, there is a need of some modules to be installed on your termux, by default it comes preinstalled, but in some case if it is not there, you can install them by using $ pip install time and $ pip install curses
Now let’s check the 2nd python program.
Creating a System Loading Screen Using Python on Termux
So Create a new python file, using
nano sysload.py
and paste the following code on it.
import time def boot_system(): print("Starting system boot...") time.sleep(0.3) print("Analyzing processor speed...") time.sleep(0.3) print("Checking memory modules...") time.sleep(0.3) print("Loading system resources...") time.sleep(0.3) print("Initializing peripherals...") time.sleep(0.3) print("Establishing network connection...") time.sleep(0.3) print("Booting operating system...") time.sleep(0.3) print("Configuring system settings...") time.sleep(0.3) print("Performing system diagnostics...") time.sleep(0.3) print("Running startup scripts...") time.sleep(0.3) print("Checking disk drives...") time.sleep(0.3) print("Initializing graphics subsystem...") time.sleep(0.3) print("Loading user profiles...") time.sleep(0.3) print("Mounting file systems...") time.sleep(0.3) print("Starting system services...") time.sleep(0.3) print("Launching user interface...") time.sleep(0.3) print("System boot complete!") # Call the function to start the system boot boot_system()
You can add your own lines to appear on the screen. And also you can modify it to the next level
Creating a System Loading Screen Using Python on Termux:
So Create a new python file, using
nano bar.py
and paste the following code on it.
from tqdm import tqdm import time for i in tqdm (range (101), desc="Loading…", ascii=False, ncols=75): time.sleep(0.01) print("Complete.")
In this program, we need to take help of an external module, which does not come preinstalled, so install it by using $ pip install tqdm
Creating a ASCII Mask or Banner Using Python on Termux
So Create a new python file, using
nano mask.py
And paste the following code on it.
import time mask = r''' ⠀⠀⠀⠀⠀⠀⠀⣀⣤⣶⣶⣿⣿⣿⣶⣶⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣿⣿⣿⣿⣿⣷⣶⣦⣄⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⣰⣾⣿⣿⣿⣿⣿⣿⣿⣯⣭⣙⡛⠻⠷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣴⠾⠟⢛⣋⣭⣽⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀ ⠀⠀⠀⢀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀ ⠀⠀⢀⡾⠿⠟⠛⠛⠛⠛⠛⠛⠿⢿⣿⣿⣿⣿⣿⣿⣿⣷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠛⠛⠛⠛⠛⠛⠛⠿⠿⣷⡀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⣿⣿⣿⣿⣿⣿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⣿⣿⣿⣿⣿⡿⠟⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⠿⣿⣿⣿⡟⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢻⣿⣿⣿⠟⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⡀⠀⠀⠀⠀⠀⠈⠻⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣿⣿⠟⠁⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣾⠿⠿⠛⠃⠀⠻⠷⢶⣤⣄⡀⠙⢿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣼⡿⠁⢀⣤⣶⣶⠿⠟⠀⠘⠛⠛⠿⢷⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⢤⠀⠀⠀⠀⢀⣾⢟⣩⣶⣾⣿⣿⣿⣿⣿⣿⣷⣮⣿⣿⣦⠀⠙⠀⡆⠀⠀⠀⠀⠀⠀⢰⠀⠋⢀⣼⣿⣫⣵⣾⣿⣿⣿⣿⣿⣿⣷⣦⣌⠻⣷⡀⠀⠀⠀⠀⡄⠀ ⠀⠈⢳⣤⣤⣶⣿⣇⠻⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⡇⠀⠀⠀⠀⠀⠀⣸⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠷⣹⣿⣦⣤⣴⡞⠀⠀ ⢀⢴⡫⠿⠿⠟⠻⠿⣷⣶⣦⣤⣭⣭⡍⠉⣭⣭⣽⣷⡾⠟⠋⠀⠀⢰⣿⠀⠀⠀⠀⠀⠀⣿⡆⠀⠀⠙⠿⣷⣾⣯⣭⣭⠉⢛⣯⣭⣭⣥⣶⣾⠿⠿⠿⠿⠿⣟⡦⡀ ⠔⠋⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⠛⠛⠃⠀⠉⠉⠉⠀⠀⠀⠀⠀⠀⣼⣿⠀⠀⠀⠀⠀⠀⣿⣧⠀⠀⠀⠀⠀⠈⠉⠉⠉⠀⠘⠛⠛⠛⠋⠉⠀⠀⠀⠀⠀⠀⠀⠙⠢ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⠀⠀⠀⠀⠀⠀⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⡏⠀⠀⠀⠀⠀⠀⢻⣿⣿⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⣿⢿⣿⡇⠀⠀⠀⠀⠀⠀⢸⣿⠿⣿⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⠟⠁⢸⣿⡇⠀⠀⠀⠀⠀⠀⢸⣿⡆⠈⠻⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣴⣾⡆⢠⡟⠁⠀⠀⢸⣿⠃⠀⠀⠀⠀⠀⠀⢸⣿⡇⠀⠀⠈⢻⡄⠰⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀ ⠀⢹⣷⣤⣀⡀⠀⠀⢀⣀⣀⣤⣴⣶⡿⠿⠛⠉⠀⢸⡀⠀⠀⠀⢸⣿⠀⠀⠀⠀⠀⠀⠀⠘⣿⡇⠀⠀⠀⢀⡇⠀⠈⠛⠿⢿⣶⣤⣄⣀⣀⡀⢀⣀⣀⣠⣴⣾⠃⠀ ⠀⠀⢿⣿⣿⠛⣿⣿⣿⡛⠛⠉⠉⠀⠀⠀⠀⠀⠀⠀⠁⠀⢰⣦⣌⠻⣷⣤⣀⣀⣀⣠⣤⣾⠟⣠⣴⡆⠀⠈⠀⠀⠀⠀⠀⠀⠀⠉⠉⠛⢛⣿⣿⣿⠛⣿⣿⡟⠀⠀ ⠀⠀⠈⢿⣿⣧⠈⢿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⣤⣤⣍⣉⡛⢛⣋⣩⣥⣤⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⣿⡿⠁⣼⣿⣿⠁⠀⠀ ⠀⠀⠀⠈⣿⣿⣆⠀⢻⣿⣿⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣾⣿⣿⡟⠁⣸⣿⣿⠃⠀⠀⠀ ⠀⠀⠀⠀⠈⢿⣿⣦⠀⠹⣿⣿⣿⣦⣀⣀⣀⣀⣀⣠⣤⣴⣾⣿⣿⣿⣿⣿⠟⠁⠈⠻⣿⣿⣿⣿⣿⣷⣦⣤⣤⣄⣀⣀⣀⣀⣴⣿⣿⣿⠏⠀⣴⣿⡿⠃⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠈⢿⣿⣷⡀⠈⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⠀⠀⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠃⢀⣼⣿⡿⠁⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠻⣿⣿⣦⡀⠉⠛⠛⠛⠛⠛⠛⠛⠛⠛⣛⣿⣿⣟⣀⣀⣀⣀⣀⣀⣀⣈⣻⣿⣿⣛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠉⢀⡴⣿⣿⠟⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠙⣿⣧⠙⠢⣄⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠉⠉⠙⠛⠛⠛⠛⠛⠛⠋⠉⠉⠉⠁⠀⠀⠀⠀⠀⠀⠀⢀⣠⠖⠋⣼⣿⠋⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢿⣧⡀⠈⠉⠒⠦⠤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠤⠖⠚⠉⠀⢀⣼⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣤⣤⣤⣤⣤⣤⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠻⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⣿⣿⣿⣿⡟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⠟⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠳⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⣿⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⣿⠏⠀⠀⠀⠀ ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ''' lines = mask.strip().split('\n') for line in lines: print(line) time.sleep(0.09) # Adjust the delay (in seconds) to control the speed
Here, the Anonymous mask may not show properly due to the orientation of the page, so I advise you to check this website ASCII Art and copy the required mask, and then paste it inside the mask variable of the program, like this…
mask = r”’ paste here ”’
Now everything is all set.
Customize Termux Using Python Like a Pro Hacker
Customizing “bash.bashrc” File in Termux:
To edit or customize this file, we need to go the directory where this file is located. And this file is located in the /data/data/com.termux/files/usr/etc folder. So let’s go there.
I am assuming you are in the home directory now.
cd ..
Now we need to go to files/usr/etc
cd usr/etc
Great! we have successfully arrived the destination!
So now let’s open the file and start our editing.
type:
nano bash.bashrc
Here, below the PS1 variable, add the following line
export PS1="\[\e[1;32m\]╭─\u@\h \[\e[1;34m\]\w \[\e[1;31m\]\$(if [[ \$? == 0 ]]; then echo \" \"; else echo \"✘ \"; fi)\[\e[1;37m\]\n╰─\[\e[0m\] "
And then, scroll down to the end of the file,
Here add the following command as it is:
clear python login.py clear python sysload.py python bar.py clear python mask.py
Conclusion
Customizing termux appearance using programming language, is very easy. But time consuming, you need to put efforts to achieve the look. And in this article I have tried to show you just a demo on customizing or designing the termux terminal using Python, but using other programming languages like C, C++, Bash, you can make even more better than this. So I hope more tutorials will be available in this website on this topic with various programming language. So stay tuned.