Advertisement
lucasolsi

client.py

Apr 26th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.67 KB | None | 0 0
  1. import os
  2. import sys
  3. import random
  4. import time
  5.  
  6. if len(sys.argv) < 4:
  7.     print "Usage: python client.py <CLIENT_PORTS_RANGE> <PROXY_PORT> <END_SERVER_PORT>"
  8.     print "Example: python client.py 20001-20010 20000 19990-19999"
  9.     raise SystemExit
  10.  
  11. CLIENT_PORT = sys.argv[1]
  12. PROXY_PORT = sys.argv[2]
  13. SERVER_PORT = sys.argv[3]
  14.  
  15. D = {0: "GET", 1:"POST"}
  16. time.sleep(int(random.random()%10) + 1)
  17. while True:
  18.     filename = "%d.data" % (int(random.random()*9)+1)
  19.     METHOD = D[int(random.random()*len(D))]
  20.     os.system("curl --request %s --proxy 127.0.0.1:%s --local-port %s 127.0.0.1:%s/%s" % (METHOD, PROXY_PORT, CLIENT_PORT, SERVER_PORT, filename))
  21.     time.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement