Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Killable threads in Python!
The built-in threading.Thread
class offers no simple solution to terminate a running thread. kthread.KThread
inherits threading.Thread
and supplies methods named exit()
, kill()
, and terminate()
that serve the same purpose: attempt to stop a thread if it's running.
KThread leverages the CPython API to raise a SystemExit
exception on a given thread. Assuming that the thread is not blocked by an operating system call (such as sleep
, accept
, or recv
), the thread will forcefully quit.
TERMINATING THREADS MAY INTRODUCE INSTABILITY OR OTHER UNDESIRABLE EFFECTS IN YOUR PROGRAMS. THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY. THE MUNSHI GROUP CANNOT BE HELD LIABLE FOR ANY DAMAGES, LOSSES, OR EXPENSES INCURRED BY YOU OR YOUR ORGANIZATION WHILE USING THIS SOFTWARE.
To install this package, run the following command:
$ pip install kthread
>>> import time
>>> import kthread
>>> import sys
>>> def func():
>>> try:
>>> while True:
>>> time.sleep(0.2)
>>> finally:
>>> sys.stdout.write("Greetings from Vice City!\n")
>>> sys.stdout.flush()
>>>
>>> t = kthread.KThread(target = func, name = "KillableThread1")
>>> t.start()
>>> t.isAlive()
True
>>> t.terminate()
Greetings from Vice City!
>>> t.isAlive()
False
MIT
FAQs
Killable threads in Python!
We found that kthread 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.