예제 #1
0
class Spaghetti(object):
	bn = banner.Banner()
	pr = output.Output()
	pa = urlparser
	ma = manager
	nw = ("")
	def main(self,argv):
		agent = ragent.RAgent()
		redir = True
		time  = None
		proxy = None
		cookie = None 
		if len(sys.argv) < 2:
			self.bn.usage(True)
		try:
			opts,arg = getopt.getopt(
				argv,'u:s:',['url=','scan=','crawler','agent=','random-agent','redirect=',
				'timeout=','cookie=','proxy=','verbose','version','help']
				)
		except getopt.error,e:
			self.bn.usage(True)
		for o,a in opts:
			if o in ('-u','--url'):
				  self.url = self.target(a)
			if o in ('-s','--scan'):
				self.scan = a
			if o in ('--crawler'):pass
			if o in ('--agent'):
				agent = str(a)
			if o in ('--random-agent'):pass
			if o in ('--redirect'):
				redir = a
			if o in ('--timeout'):
				time = a
			if o in ('--cookie'):
				cookie = a 
			if o in ('--proxy'):
				proxy = a
			#if o in ("--headers"):pass
			if o in ('--verbose'):pass
			if o in ('--version'):
				self.bn.version(True)
			if o in ('--help'):
				self.bn.usage(True)
		# starting 
		self.bn.banner()
		self.strftime()
		if not hasattr(self,'scan'):
			self.scan = str(0)
			self.pr.info('Scan argument is not defined, setting to default value %s'%(self.scan))
		if self.scan == "6":
			pass
		else:
			self.ma.fingerprints(agent,proxy,redir,time,self.url,cookie)
		# crawler 
		if self.scan == '0' or self.scan == '3':
			print self.nw
			urls = self.ma.crawling(
				agent,proxy,redir,time,self.url,cookie)
			if urls==[]:urls.append(self.url)
		# scan options
		if self.scan == '0':
			self.ma.bruteforce(
				agent,proxy,redir,time,self.url,cookie)
			self.ma.disc(
				agent,proxy,redir,time,self.url,cookie)
			self.ma.attacks(
				agent,proxy,redir,time,urls,cookie)
			self.ma.others(
				agent,proxy,redir,time,self.url,cookie)
			self.ma.vuln(
				agent,proxy,redir,time,self.url,cookie)
		if self.scan == '1':
			self.ma.bruteforce(
				agent,proxy,redir,time,self.url,cookie)
		if self.scan == '2':
			self.ma.disc(
				agent,proxy,redir,time,self.url,cookie)
		if self.scan == '3':
			self.ma.attacks(
				agent,proxy,redir,time,urls,cookie)
		if self.scan == '4':
			self.ma.others(
				agent,proxy,redir,time,self.url,cookie)
		if self.scan == '5':
			self.ma.vuln(
				agent,proxy,redir,time,self.url,cookie)
		if self.scan == '6':
			self.ma.fingerprints(
				agent,proxy,redir,time,self.url,cookie)
			print self.nw
예제 #2
0
class Spaghetti(object):

	ban    = banner.Banner()
	output = output.Output()

	def main(self,kwargs):
		agent = "Mozilla/5.0 (Windows NT 6.2; WOW64; rv:30.0) Gecko/20100101 Firefox/30.0"
		redirect = True
		timeout = None
		cookie = None
		proxy = None
		default_scan = "5"
		# args...
		if len(sys.argv) < 2:
			self.ban.usage(True)
		try:
			opts,args = getopt.getopt(kwargs,'u:s:',['url=','scan=','agent=','random-agent',
				'redirect=','timeout=','cookie=','proxy=','verbose','version','help'])
		except getopt.error,e:
			self.ban.usage(True)
		for o,a in opts:
			if o in ('-u','--url'):
				self.url = utils.Parser(a).host_path()
				if not self.url:
					self.output.less('Try with target url!')
					sys.exit(0)
			if o in ('-s','--scan'):
				self.scan = a
				if self.scan not in ('0','1','2','3','4','5'):
					self.output.less('Check scan option and try!')
					sys.exit(0)
			if o in ('--agent'):
				agent = a 
			if o in ('--random-agent'):
				pass
			if o in ('--redirect'):
				redirect = a 
			if o in ('--timeout'):
				timeout = a 
			if o in ('--cookie'):
				cookie = a 
			if o in ('--proxy'):
				proxy = a 
			if o in ('--verbose'):
				pass
			if o in ('--version'):
				self.ban.version(True)
			if o in ('--help'):
				self.ban.usage(True)
		
		self.fingerprints(
			agent,proxy,redirect,timeout,self.url,cookie
			)
		urls = self.crawler(
			agent,proxy,redirect,timeout,self.url,cookie)
		#
		if urls == None or urls == []: urls == []; urls.append(self.url)
		#

		#Check if --scan is set or else set default value
		if not hasattr(self, "scan"):
			self.scan = default_scan
			self.output.info('Argument --scan is not defined. Setting to default value %s'%default_scan)

		if self.scan == "0":
			self.broken(
				agent,proxy,redirect,timeout,self.url,cookie
				)
			self.disclosure(
				agent,proxy,redirect,timeout,self.url,cookie
				)
			self.injection(
				agent,proxy,redirect,timeout,urls,cookie
				)
			self.other(
				agent,proxy,redirect,timeout,self.url,cookie
				)
			self.vulns(
				agent,proxy,redirect,timeout,self.url,cookie
				)
		elif self.scan == "1":
			self.broken(
				agent,proxy,redirect,timeout,self.url,cookie
				)
		elif self.scan == "2":
			self.disclosure(
				agent,proxy,redirect,timeout,self.url,cookie
				)
		elif self.scan == "3":
			self.injection(
				agent,proxy,redirect,timeout,urls,cookie
				)
		elif self.scan == "4":
			self.other(
				agent,proxy,redirect,timeout,self.url,cookie
				)
		elif self.scan == "5":
			self.vulns(
				agent,proxy,redirect,timeout,self.url,cookie
				)