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.
pip install -U zdgram
from zdgram import Bot, types
API_TOKEN = "API_TOKEN_HERE"
bot = Bot(API_TOKEN, allowed_updates=["message"])
@bot.onUpdate
async def on_updates(bot: Bot, update: types.Update):
print(update)
@bot.onMessage()
async def on_message(bot: Bot, message: types.Message):
print(message)
@bot.onEditedMessage()
async def on_edited_message(bot: Bot, message: types.Message):
print(message)
# Custom filter
def filter_admin(message: types.Message):
admins = [123456789, 987654321]
return bool(message.from_user.id in admins)
@bot.onMessage(func=filter_admin)
@bot.onEditedMessage(func=filter_admin)
async def on_custom_filter(bot: Bot, message: types.Message):
print(message)
# Echo Bot
@bot.onMessage(func=lambda m: m.text)
async def echo(bot: Bot, message: types.Message):
return await bot.sendMessage(
message.chat.id,
message.text,
entities=message.entities
)
@bot.onCallbackQuery()
async def on_callback_query(bot: Bot, callback_query: types.CallbackQuery):
return await bot.sendMessage(
callback_query.message.chat.id,
callback_query.data
)
@bot.onInlineQuery()
async def on_inline_query(bot: Bot, inline_query: types.InlineQuery):
print(inline_query)
import logging
logging.basicConfig(level=logging.INFO)
bot.run()
import logging
from zdgram import run_multiple_bots, Bot, types, enums
logging.basicConfig(level=logging.INFO)
bot_1 = Bot("API_TOKEN_1")
bot_2 = Bot("API_TOKEN_2")
@bot_1.onMessage()
@bot_2.onMessage()
async def on_message(bot: Bot, message: types.Message):
return await bot.sendMessage(
message.chat.id,
(await bot.getMe()).mention.markdown,
parse_mode=enums.ParseMode.MARKDOWN
)
bot_1.run(run_multiple_bots([bot_1, bot_2]))
from zdgram import types, enums, Bot
bot = Bot(bot_token="")
def filter_text_and_private(m: types.Message):
return bool(m.text and m.chat.type == enums.ChatType.PRIVATE)
@bot.onMessage(func=filter_text_and_private)
async def on_message(bot: Bot, message: types.Message):
await bot.sendMessage(
message.chat.id,
"Send your name",
reply_to_message_id=message.id
)
msg = await bot.listen(filter_text_and_private)
return await bot.sendMessage(
message.chat.id,
"Your name is : " + msg.text
)
FAQs
Python module based on https://core.telegram.org/bots/api
We found that zdgram 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.