Exemplo n.º 1
0
def setItOff(host="", port="", domain="", tld=""):
    name = multiprocessing.current_process().name
    setitpid = os.getpid()
    print name + " Started with pid %d" % setitpid

    vhf = VHostFinder(host)
    vhf.setPort(port)
    vhf.setDomain(domain)
    vhf.setTld(tld)
    vhf.setElements()
    bnds = vhost_finder_vars.getDepthBounds()
    vhf.setDepth(bnds[0],bnds[1])
    vhf.setTotalThreads(vhost_finder_vars.getVHostNumThreads())
    vhf.setBaseLine()
    vhf.probeVhosts()

    print "\n" + name + " Finished"
    finish = time.time()
    funcs.sec_to_time(sec=(finish - start))

    # kill tor sockets we spun up
    if anonimize:
        for dir,_,_ in os.walk(sc.getDataDir()):
            pidHandle = glob.glob(os.path.join(dir,'tor*.pid'))
            if pidHandle:
                funcs.killPid(ppid=int(open(pidHandle[0]).readline()))
        print
    # kill DDoS threads
    slow_ddos_tor.killThreads()
    print
Exemplo n.º 2
0
 def setBaseLine(self):
     ''' get a baseline for a bad request '''
     try:
         print "\nSetting baseline ...",
         """
             numbers are valid characters in a domain,
             assuming no one would set the below domain
             as a given vhost of a server (even though that
             would be interesting) ...
             therefore we assume this will produce a 
             "vhost does not exist on this server" response
             TODO: form a large random number to replace the static one below
         """
         http_data = funcs.constructRequest(verb="GET", target="314159265358979323846264338327950288." + self.domain + "." + self.tld, resource="/")
         c = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
         c.connect((self.ipAddress, self.port))
         c.send(http_data)
         data = c.recv(1024*5)
         c.close()
         if debug:
             print http_data
             print data
         
         self.baseline = funcs.stripheader(data,self.includeinbaseline)
         print self.baseline
     except:
         print "\nError connecting, cleaning up\n\n"
         # kill tor sockets we spun up
         if anonimize:
             '''
             for p in sc.getTorPids():
                 funcs.killPid(ppid=p)
             '''
             for dir,_,_ in os.walk(sc.getDataDir()):
                 pidHandle = glob.glob(os.path.join(dir,'tor*.pid'))
                 if pidHandle:
                     funcs.killPid(ppid=int(open(pidHandle[0]).readline()))
             print
         slow_ddos_tor.killThreads()
         print
         sys.exit(0)