Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A small Python package to hide or show the terminal cursor. Works on Linux and Windows, on both Python 2 and Python 3.
The code is almost entirely a copy of James Spencer's answer on StackOverflow.
The preferred way of installing cursor
is via pip
.
You can install pip
with your package manager:
sudo apt-get install python-pip
pip install --user cursor
git clone https://aur.archlinux.org/python-cursor.git
cd python-cursor
makepkg -si
import cursor
cursor.hide() ## Hides the cursor
cursor.show() ## Shows the cursor
Note that the cursor will stay hidden until you call cursor.show()
—
even after exiting your python script!
Because of that, pip
will install two scripts, which can be run
from the command line: cursor_hide
and cursor_show
.
An alternative is using the HiddenCursor()
class in conjunction
with Python's with
statement. This will make sure that the cursor
is shown again after running your code, even if exceptions are
raised:
import cursor
with cursor.HiddenCursor(): ## Cursor will stay hidden
import time ## while code is being executed;
for a in range(1,100): ## afterwards it will show up again
print(a)
time.sleep(0.05)
You could also use Python's atexit
module:
import cursor
import atexit
import time
atexit.register(cursor.show) ## Make sure cursor.show() is called
## when exiting
cursor.hide() ## Hides cursor
for a in range(1,100):
print(a)
time.sleep(0.05)
exit() ## Cursor will show again
Manraj Singh: allowed setting a customisable stream
Alexander Seiler: packaging for Arch
Patrik Kopkan: packaging for Fedora
cursor
halo
: beautiful
terminal spinners in Python
pipenv
: a tool that aims to bring the best of all packaging worlds to the Python world
FAQs
A small Python package to hide or show the terminal cursor
We found that cursor demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.