c

From Scorching Wolf, 4 Months ago, written in Plain Text, viewed 59 times.
URL https://code.nat.moe/view/987e5e1d Embed
Download Paste or View Raw
  1. #!/usr/bin/env python3
  2.  
  3. import socket, argparse
  4. from .common import drain
  5.  
  6. 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'
  7.  
  8. parser = argparse.ArgumentParser()
  9. parser.add_argument('--port', type = int, help = 'remote port', required = True)
  10. parser.add_argument('--host', type = str, help = 'remote host', required = True)
  11. parser.add_argument('--size', type = int, help = 'content length', required = True)
  12. parser.add_argument('--count', type = int, help = 'number of posts', required = True)
  13. ns = parser.parse_args()
  14.  
  15. with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
  16.     s.connect((ns.host, ns.port))
  17.     count = 0
  18.     while count < ns.count:
  19.         s.sendall(bytes(HEADER.format(host = ns.host, port = ns.port, len = ns.size, count = count).encode('ascii')))
  20.         s.sendall(bytes(0 for b in range(1, ns.size)))
  21.        
  22.         drain(s)
  23.  
  24.         count += 1
  25.         if count % 100 == 0:
  26.             print('{} posts sent'.format(count))

Replies to c rss

Title Name Language When
Re: c Tacky Mockingjay text 4 Months ago.
Re: c Forensic Cockroach text 4 Months ago.

Reply to "c"

Here you can reply to the paste above

captcha