Re: c

From Forensic Cockroach, 5 Months ago, written in Plain Text, viewed 74 times. This paste is a reply to c from Scorching Wolf - go back
URL https://code.nat.moe/view/9651c72b/diff Embed
Viewing differences between c and Re: c
#!/usr/bin/env python3

import socket, argparse
from .common import drain

drain, wait

HEADER = 'POST http://{host}:{port}/mqipt HTTP/1.1\r\nHost: {host}:{port}\r\nUser-Agent: WebSphere-MQ-internet-pass-thru/2.1.0.4\r\nContent-Length: {len}\r\nAccept-Encoding: identity\r\nConnection: Keep-Alive\r\nContent-Type: application/octet-stream\r\nCookie: MQIPTSessionType=FullDuplex-S; MQIPTSessionId=test-{count}\r\nProxy-Connection: Keep-Alive\r\n\r\n'

parser = argparse.ArgumentParser()
parser.add_argument('--port', type = int, help = 'remote port', required = True)
parser.add_argument('--host', type = str, help = 'remote host', required = True)
parser.add_argument('--size', type = int, help = 'content length', required = True)
parser.add_argument('--count', type = int, help = 'number of posts', required = True)
ns = parser.parse_args()

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
    s.connect((ns.host, ns.port))
    count = 0
    while count < ns.count:
        s.sendall(bytes(HEADER.format(host = ns.host, port = ns.port, len = ns.size, count = count).encode('ascii')))
        s.sendall(bytes(0 for b in range(1, ns.size)))
        
        wait(s)
        drain(s)

        count += 1
        if count % 100 == 0:
            print('{} posts sent'.format(count))

Reply to "Re: c"

Here you can reply to the paste above

captcha