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.
notification-py
is a Python package that provides a simple and convenient way to send notifications to Discord, Slack, and Email. You can send notification to either of these using a single command.
Lately I noticed several critical errors poping up in my python backend, I thought of a simple way to get notified about these failues (be it Stripe webhooks or anything else). So I came up with this idea to create a simple notification package which can be imported and used when unexpected errors are thrown by code.
Using this package, developers can receive notifications through various combinations of Discord, Slack, and Email. The package supports sending notifications to all three platforms simultaneously, any two of them, or just one platform, depending on the provided credentials and configuration. This flexibility allows developers to customize their notification setup based on their specific requirements and preferences.
To install notification-py
using pip:
pip install notification-py
To use notification-py in your Python project, you can import the send_notification
function from the package. :
from notification_py.custom_types import (
DiscordCreds,
Message,
Creds,
EmailCreds,
MessageDetails,
SlackCreds,
)
Message
object is core to the functionality of the notification-py
package.
message = Message(
message_details=MessageDetails(
title="Test Title",
text="Test Text",
severity=2,
source="Test Source",
filename="Test Filename",
line_number=0,
time=datetime.now(),
),
creds=Creds(
discord=DiscordCreds(
token="your_discord_bot_token",
channel_id=your_discord_channel_id,
team_id=your_discord_team_id,
),
slack=SlackCreds(webhook_url="your_slack_webhook_url"),
email=EmailCreds(
email="your_email",
password="your_email_password",
smtp_server="your_smtp_server",
smtp_port=your_smtp_port,
target_email="target_email",
),
),
)
The Message object consists of two main parts:
message_details
: An instance of MessageDetails
that contains the details of the notification message, such as the title, text, severity, source, filename, line number, and timestamp.creds
: An instance of Creds
that holds the credentials for Discord, Slack, and email notifications.These creds are independent of each other and one can just send Discord notifications using this message object (same applies for other combinations of these):
message = Message(
message_details=MessageDetails(
title="Test Title",
text="Test Text",
severity=2,
source="Test Source",
filename="Test Filename",
line_number=0,
time=datetime.now(),
),
creds=Creds(
discord=DiscordCreds(
token="your_discord_bot_token",
channel_id=your_discord_channel_id,
team_id=your_discord_team_id,
),
slack=None,
email=None,
),
)
You can just call this async function notify
to send notification to all the services at a go.
from notification_py.main import send_notification
async def notify(message):
await send_notification(message)
Please note that only those services which have valid creds will be notified.
To send notifications to Discord, Slack, and email, you need to provide the necessary credentials. Here's how you can create the credential objects:
app password
email = "YOUR_ID@gmail.com"
password = "GENERATED_APP_PASSWORD"
smtp_server = "smtp.gmail.com"
smtp_port = "587"
target_email = "RECIPIENT_ID@gmail.com"
To raise any issues/requests you may refer the issue page here.
You may mail me here on my mail id.
Feel free to connect with me on my LinkedIn.
Please do check out my other projects on my GitHub here.
Also I have made many cool Firefox Add ons. They are pretty useful, you may want to check them out here.
If you like my work, you may want to buy me a book here.
FAQs
A simple package to send notifications on Discord, Slack and Email.
We found that notification-py 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.