-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWebhookWriter.py
76 lines (62 loc) · 2.63 KB
/
WebhookWriter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import requests
from art import text2art
from colorama import init, Fore, Style
from datetime import datetime
init()
now = datetime.now()
current_date = now.strftime("%Y-%m-%d %H:%M:%S")
def send_webhook(webhook_url, content):
headers = {
'Content-Type': 'application/json'
}
data = {
'content': content
}
try:
response = requests.post(webhook_url, json=data, headers=headers)
response.raise_for_status()
print(f'{Fore.WHITE}{current_date} (1/1) {Fore.WHITE}>>>{Fore.YELLOW} Sent: "{content}"')
except requests.exceptions.RequestException as e:
print(f'{Fore.RED}Error: {e}')
def spam_webhook(webhook_url, content, pytanie):
headers = {
'Content-Type': 'application/json'
}
data = {
'content': content
}
try:
ilosc1 = int(pytanie)
except ValueError:
print(f'{Fore.RED}Error: Invalid number of repetitions.')
return
ilosc = ilosc1 + 1
uzyta = 0
for i in range(1, ilosc):
try:
uzyta = uzyta+1
response = requests.post(webhook_url, json=data, headers=headers)
response.raise_for_status()
print(f'{Fore.WHITE}{current_date} ({uzyta}/{ilosc}) {Fore.WHITE}>>>{Fore.YELLOW} Sent: "{content}"')
except requests.exceptions.RequestException as e:
print(f'{Fore.RED}Error: {e}')
break
def start():
naglowek = text2art("WEBHOOK WRITER")
print(f"{Fore.CYAN}{naglowek}\nGITHUB: https://github.com/stainowy/WebhookWriter\nAUTHOR: https://github.com/stainowy\n\n{Fore.WHITE}Our current webhook writer has the following features:\n{Fore.CYAN} [1] {Fore.WHITE}Webhook Send {Fore.CYAN}[2] {Fore.WHITE}Webhook Spam")
akcja = input(f"{Fore.WHITE}> ")
if akcja == "1":
webhook_url = input(f"{Fore.CYAN}Please enter the link to the webhook:\n{Fore.WHITE}> ")
content = input(f"\n{Fore.CYAN}Please enter your webhook content:\n{Fore.WHITE}> ")
send_webhook(webhook_url, content)
e = input("")
elif akcja == "2":
webhook_url = input(f"{Fore.CYAN}Please enter the link to the webhook:\n{Fore.WHITE}> ")
content = input(f"\n{Fore.CYAN}Please enter your webhook content:\n{Fore.WHITE}> ")
pytanie = input(f"\n{Fore.CYAN}How many times should the message be repeated?\n{Fore.WHITE}> ")
spam_webhook(webhook_url, content, pytanie)
e = input('')
else:
print(f"{Fore.RED}Invalid option. Please choose either 1 or 2.")
if __name__ == "__main__":
start()