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.
Another simple class wrapper for interacting with Discord webhooks.
dhooks-lite is a library with a set of classes for interacting with Discord webhooks written in Python 3.
This library aims to differentiate itself from similar libraries with the following properties:
This library provides following functionality:
Here are some examples on how to use dhooks-lite in your Python scripts.
Note that you also find the source code of all examples in the /examples
folder of this repo.
Minimal example for posting a message.
from dhooks_lite import Webhook
hook = Webhook(DISCORD_WEBHOOK_URL)
hook.execute('Hello, World!')
In this example we are setting username and avatar.
from dhooks_lite import Webhook
hook = Webhook(
DISCORD_WEBHOOK_URL,
username='Bruce Wayne',
avatar_url='https://i.imgur.com/thK8erv.png'
)
hook.execute('I am Batman!')
Finally, here is an example for posting a message with two embeds and using all available features (shortened):
import datetime
from dhooks_lite import Webhook, Embed, Footer, Image, Thumbnail, Author, Field
hook = Webhook(DISCORD_WEBHOOK_URL)
e1 = Embed(
description='Only a few years ago, scientists stumbled upon an electrical current of cosmic proportions.(...)',
title='Universe\'s highest electric current found',
url='https://www.newscientist.com/article/mg21028174-900-universes-highest-electric-current-found/',
timestamp=datetime.datetime.utcnow(),
color=0x5CDBF0,
footer=Footer(
'Science Department',
'https://i.imgur.com/Bgsv04h.png'
),
image=Image('https://i.imgur.com/eis1Y0P.jpg'),
thumbnail=Thumbnail('https://i.imgur.com/2A4k28x.jpg'),
author=Author(
'John Scientist',
url='https://en.wikipedia.org/wiki/Albert_Einstein',
icon_url='https://i.imgur.com/1JoHDw1.png'
),
fields=[
Field('1st Measurement', 'Failed'),
Field('2nd Measurement', 'Succeeded')
]
)
e2 = Embed(description="TOP SECRET - Do not distribute!")
hook.execute(
'Checkout this new report from the science department:',
username='Bruce Wayne',
avatar_url='https://i.imgur.com/thK8erv.png',
embeds=[e1, e2],
wait_for_response=True
)
You can install this library directly from PyPI:
pip install dhooks-lite
For a full documentation of all classes please see the official docs here.
We welcome any contribution!
If you found a bug or have a feature request please raise an issue.
If you want to help further improve this library please feel free to issue a merge request. Please adhere to the following requirements in your change:
FAQs
Another simple class wrapper for interacting with Discord webhooks.
We found that dhooks-lite 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.