Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
75 lines (64 sloc) 2.36 KB
#!/usr/bin/env python
# The exploit is a part of Agora pack - use only under the license agreement
# specified in LICENSE.txt in your Agora distribution
import sys
import re
import os
import urllib2
sys.path.append("./core")
from Sploit import Sploit
from PortScannerMT import Scanner
from collections import OrderedDict
INFO={}
INFO['NAME']="port_scanner"
INFO['DESCRIPTION']="Search for open ports"
INFO['VENDOR']=""
INFO["CVE Name"]=""
INFO["NOTES"]=""" """
INFO['CHANGELOG']="31 August, 2015. Written by Gleg team."
INFO['PATH'] = "Utilities/"
# Must be in every module, to be set by framework
OPTIONS = OrderedDict()
OPTIONS["HOST"] = "127.0.0.1", dict(description="Target IP")
OPTIONS["FROM_PORT"] = 0, dict(description="Lower value of scanning ports range")
OPTIONS["TO_PORT"] = 1000, dict(description="Higher value of scanning ports range")
OPTIONS["THREADS"] = 200, dict(description="Count of threads used for scan")
OPTIONS["SEARCH"] = dict(options=["opened", "closed"], selected="opened"), dict(description="Search for opened or closed ports")
class exploit(Sploit):
def __init__(self,host="", from_port=0, to_port=1000, nthreads=200, logger=None):
Sploit.__init__(self,logger=logger)
self.host = host
self.from_port = from_port
self.to_port = to_port
self.nthreads = nthreads
self.name=INFO['NAME']
self.scanner = None
return
def args(self):
self.args = Sploit.args(self, OPTIONS)
self.host = self.args.get('HOST', self.host)
self.from_port = self.args.get('FROM_PORT', self.from_port)
self.to_port = self.args.get('TO_PORT', self.to_port)
self.nthreads = self.args.get('THREADS', self.nthreads)
self.type = self.args.get('SEARCH', 'opened')
self.scanner = Scanner(self.from_port, self.to_port, self.host)
return
def check(self):
self.args()
try:
self.scanner.scan(search_for=self.type, nthreads=self.nthreads, send_fn=self.log)
except:
return False
return True
def run(self):
if not self.check():
self.log("Error while executing")
self.finish(False)
return 0
self.log("Done.")
self.finish(True)
return 1
if __name__ == '__main__':
print ("Running exploit %s .. " % INFO['NAME'])
e = exploit("localhost")
e.run()