I put together a few scripts to enable Terminal functionality on P4wnP1.

For developing the script, I actually used a RaspberryPi Zero 2.  But it should work on RPi Zero W as well.

Testing to be done soon on Pi Zero W.

Files included:


What is TermWrap.py?

Entering text using joystick on OLED screen


Running the command (in this case, "sudo wifite")

What is wifi-pw-skiptest.py?

This script displays an "Enter command" screen on the SH1106 OLED display.

Then it waits for the user to press the joystick to change characters (using the Left and Right joystick buttons).

Pressing the "Center" joystick button adds the current character to the line.

KEY1 (font-awesome keyboard icon) switches keyboard layouts:

KEY2 ("X") is the backspace key.

KEY3 (">") is the GO button.

What is terminal.py?

Terminal.py is an adaptation of the terminal.py script found in luma.examples repo.

The terminal.py from luma.examples utilizes a LOOP to display "lines" of text on the OLED screen.

But the text it displays is static - it's generated by simple code (resulting in "Line 1, Line 2, Line 3..").


So I simply replaced that part of the code to display lines of text from a TEXT FILE.  This was way more interesting than just displaying lines being generated by code.

Now that we got the (excellent) terminal.py (from luma.examples) script to display dynamic content, we're ready to take the command input from the user and send it to terminal.py.



1.  Take terminal.py from luma.examples

2. Find the loop that displays "Line 1, Line 2, Line 3"

3.  Replace it with a loop to read lines from a text file


The result from changing this code was significant:

Since getting programs to output to text in Linux is pretty easy, we can now display pretty much any program's output on our OLED screen.


Local file locations:

The following list of files are required to run P4wn-Term.

These files are in the main working folder (~/BeBoXGui/)

Disk image file:



P4wnP1 OLED Terminal Crontab Entry

@reboot cd /home/pi/BeBoXGui/ && /usr/bin/python3 /home/pi/BeBoXGui/termwrap.py

Current working directory:

pi@raspberrypi:~/BeBoXGui $ python3 wifi-pw-skiptest.py



Need to get termwrap and terminal2.py working in the same folder

Then get terminal2.py to read from text file

Then use that as the command to run in the terminal


Other file locations:



Next steps:


Aliases to Add

Side project idea - PiPod Shuffle:

Use a quick alias to play MP3 files randomly to mimic and iPod shuffle.


mplayer -loop 0 -shuffle $(cat your_playlist.m3u)

alias music='mplayer --shuffle *

Find a File

I can never remember the syntax for this command.  So why not make an alias for it.


find /home -name *.jpg


Modify ping Behavior

I don't know why I'd do this, but I might:


# Stop after sending count ECHO_REQUEST packets #
alias ping='ping -c 5'
# Do not wait interval 1 second, go fast #
alias fastping='ping -c 100 -s.2'