-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsender.py
More file actions
116 lines (110 loc) · 3.35 KB
/
sender.py
File metadata and controls
116 lines (110 loc) · 3.35 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
import click
import requests
from colorama import Fore
import json
banner = r"""
.▄▄ · ▄▄▄ . ▐ ▄ ·▄▄▄▄ ▄▄▄ .▄▄▄ ▄▄▄· ▄· ▄▌
▐█ ▀. ▀▄.▀·•█▌▐███▪ ██ ▀▄.▀·▀▄ █· ▐█ ▄█▐█▪██▌
▄▀▀▀█▄▐▀▀▪▄▐█▐▐▌▐█· ▐█▌▐▀▀▪▄▐▀▀▄ ██▀·▐█▌▐█▪
▐█▄▪▐█▐█▄▄▌██▐█▌██. ██ ▐█▄▄▌▐█•█▌ ▐█▪·• ▐█▀·.
▀▀▀▀ ▀▀▀ ▀▀ █▪▀▀▀▀▀• ▀▀▀ .▀ ▀ ▀ .▀ ▀ •
"""
@click.group()
def cli():
print(Fore.WHITE + banner)
print(Fore.RED + "Welcome to Sender.py!")
print(Fore.GREEN + r"""
Usage:
python sender.py get --t example.com
With Bearer Token:
python sender.py getwithtoken --t example.com --auth 123456789
""")
print(Fore.BLUE + "Made", Fore.WHITE + "In", Fore.RED + "France")
print(Fore.WHITE + "https://github.com/Sender-py")
## GET
@cli.command()
@click.option('--t', help='Target')
def get(t):
if not t.startswith("http"):
t = "http://" + t
r = requests.get(t)
print(Fore.GREEN + "HTTP Code:", r.status_code)
print("Response:", r.text)
## POST
@cli.command()
@click.option('--t', help='Target')
@click.option('--data', help='JSON')
def post(t, data):
if not t.startswith("http"):
t = "http://" + t
r = requests.post(t, json=json.loads(data))
print(Fore.GREEN + "HTTP Code:", r.status_code)
## PUT
@cli.command()
@click.option('--t', help='Target')
@click.option('--data', help='JSON')
def put(t, data):
if not t.startswith("http"):
t = "http://" + t
r = requests.put(t, json=json.loads(data))
print(Fore.GREEN + "HTTP Code:", r.status_code)
## DELETE
@cli.command()
@click.option('--t', help='Target')
def delete(t):
if not t.startswith("http"):
t = "http://" + t
r = requests.delete(t)
print(Fore.GREEN + "HTTP Code:", r.status_code)
## GET
@cli.command()
@click.option('--t', help='Target')
@click.option('--auth', help='Bearer Token')
def getwithtoken(t, auth):
if not t.startswith("http"):
t = "http://" + t
r = requests.get(t, headers={
"Authorization": auth
})
print(Fore.GREEN + "HTTP Code:", r.status_code)
print("Response:", r.text)
## POST
@cli.command()
@click.option('--t', help='Target')
@click.option('--auth', help='Bearer Token')
@click.option('--data', help='JSON')
def posttwithtoken(t, auth, data):
if not t.startswith("http"):
t = "http://" + t
r = requests.post(t, headers={
"Authorization": auth
}, json=json.loads(data))
print(Fore.GREEN + "HTTP Code:", r.status_code)
print("Response:", r.text)
## PUT
@cli.command()
@click.option('--t', help='Target')
@click.option('--auth', help='Bearer Token')
@click.option('--data', help='JSON')
def putwithtoken(t, auth, data):
if not t.startswith("http"):
t = "http://" + t
r = requests.put(t, headers={
"Authorization": auth
}, json=json.loads(data))
print(Fore.GREEN + "HTTP Code:", r.status_code)
print("Response:", r.text)
## DELETE
@cli.command()
@click.option('--t', help='Target')
@click.option('--auth', help='Bearer Token')
def deletewithtoken(t, auth):
if not t.startswith("http"):
t = "http://" + t
r = requests.delete(t, headers={
"Authorization": auth
})
print(Fore.GREEN + "HTTP Code:", r.status_code)
print("Response:", r.text)
if __name__ == '__main__':
cli()