def httpsenum(ip, puerto, folder): # Variables para guardar procesos creados para la ip jobs = [] path = folder + "/https" logger.info("Iniciando enumeración HTTPS para la IP %s:%s" % (ip, puerto)) # Creamos directorios de las carpetas oper.createFolder(path) # dirbScan p = mp.Process(target=scn.dirbScan, name="dirbScanHTTPS_" + ip, args=(ip, puerto, "https", path)) jobs.append(p) p.start() # nikto p = mp.Process(target=scn.niktoScan, name="niktoScanHTTPS_" + ip, args=(ip, puerto, "https", path)) jobs.append(p) p.start() # sslScan p = mp.Process(target=scn.sslScan, name="sslScan_" + ip, args=(ip, puerto, path)) jobs.append(p) p.start() #nmapHTTP_process = multiprocessing.Process(target=nmapScanHTTP, args=(ip,puerto,path,"HTTP")) #nmapHTTP_process.start() timerElapsed = 0 while len(jobs) > 0: for job in jobs: job.join(5) timerElapsed += 5 if not job.exitcode is None: logger.info("Proceso httpsenum de IP %s %s ha acabado!" % (ip, job.name)) jobs.remove(job) logger.debug("Quedan %s procesos httpsenum de IP %s" % (len(jobs), ip)) else: # Cada 30 Segundos mostramos lo que lleva la tarea if (timerElapsed % 30) == 0: logger.debug( "httpsenum de IP %s lleva %s minutos" % (ip, time.strftime("%M:%S", time.gmtime(timerElapsed)))) line = "" for job in jobs: line += job.name + " " logger.info("Procesos pendientes: %s" % (line)) logger.info( "Fin httpsenum para la IP %s:%s (%s)" % (ip, puerto, time.strftime("%M:%S", time.gmtime(timerElapsed)))) return
def smbEnum(ip, puerto, folder): # Variables para guardar procesos creados para la ip jobs = [] path = folder + "/smb" logger.info("Iniciando smbEnum para la IP %s:%s" % (ip, puerto)) # Creamos directorios de las carpetas oper.createFolder(path) # smbNmap p = mp.Process(target=scn.smbNmapScan, name="smbNmapScan_" + ip, args=(ip, puerto, path)) jobs.append(p) p.start() # enum4linux p = mp.Process(target=scn.enum4linuxScan, name="enum4linuxScan_" + ip, args=(ip, puerto, path)) jobs.append(p) p.start() timerElapsed = 0 while len(jobs) > 0: for job in jobs: job.join(5) timerElapsed += 5 if not job.exitcode is None: logger.info("Proceso smbEnum de IP %s %s ha acabado!" % (ip, job.name)) jobs.remove(job) logger.debug("Quedan %s procesos smbEnum de IP %s" % (len(jobs), ip)) else: # Cada 30 Segundos mostramos lo que lleva la tarea if (timerElapsed % 30) == 0: logger.debug( "smbEnum de IP %s lleva %s minutos" % (ip, time.strftime("%M:%S", time.gmtime(timerElapsed)))) line = "" for job in jobs: line += job.name + " " logger.info("Procesos pendientes: %s" % (line)) logger.info( "Fin smbEnum para la IP %s:%s (%s)" % (ip, puerto, time.strftime("%M:%S", time.gmtime(timerElapsed)))) return