当前位置: 首页>>代码示例>>Python>>正文


Python ThreadPool.pushArgs方法代码示例

本文整理汇总了Python中threadpool.ThreadPool.pushArgs方法的典型用法代码示例。如果您正苦于以下问题:Python ThreadPool.pushArgs方法的具体用法?Python ThreadPool.pushArgs怎么用?Python ThreadPool.pushArgs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在threadpool.ThreadPool的用法示例。


在下文中一共展示了ThreadPool.pushArgs方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from threadpool import ThreadPool [as 别名]
# 或者: from threadpool.ThreadPool import pushArgs [as 别名]
class Scanner:
	def __init__( self, kb, cfg, targets, edispatcher ):
		self.kb      = kb
		self.cfg     = cfg
		self.targets = targets
		self.pool	 = ThreadPool( window_size = self.cfg.Threads, prototype = ScannerThread, async = False )
		self.ed		 = edispatcher
		
	def start( self ):
		for target in self.targets:
			for kbitem in self.kb.items:
				self.pool.pushArgs( kbitem, target, self.ed )
				
		self.pool.start()
		
	def stop( self ):
		self.pool.stop()
		
	def running( self ):
		return self.pool.active
开发者ID:evilsocket,项目名称:altair,代码行数:22,代码来源:scanner.py

示例2: run

# 需要导入模块: from threadpool import ThreadPool [as 别名]
# 或者: from threadpool.ThreadPool import pushArgs [as 别名]
	def run( self ):
			if self.kbitem.id in ( 'files', 'dirs' ):
				resp404 = None 
				try:
					non_existent_url      = target.url.copy()
					non_existent_url.path =  "/%s" % self.__genRandom()
					non_existent          = GetRequest(non_existent_url)
					resp404				  = non_existent.fetch()
				except:
					pass
				
				pool = ThreadPool( window_size = 20, prototype = HttpVerifierThread )
				for payload in self.kbitem.payloads:
					pool.pushArgs( self.kbitem, payload, self.target, self.ed, resp404 )
					
				pool.start()
			else:
				for payload in self.kbitem.payloads:
					try:
						random = self.__genRandom()
						if (payload.scope == '*' or payload.scope.lower() == 'get') and isinstance( self.target, GetRequest ):
							for param in self.target.url.params.keys():
								target = self.target.copy()
								target.__class__ = GetRequest
								p 	   = payload.copy()
								if "@RANDOM" in p.data:
									p.data = p.data.replace( "@RANDOM", random )
									
								target.setParam( param, p.data )
								
								response = target.fetch()
								
								for m in self.kbitem.matches:
									m = m.copy()
									if "@PAYLOAD" in m.data:
										m.data = m.data.replace( "@PAYLOAD", p.data )
									if "@RANDOM" in m.data:
										m.data = m.data.replace( "@RANDOM", random )
									if m.match(response):
										self.ed.vulnerability( target, self.kbitem, param )
										return
						elif (payload.scope == '*' or payload.scope.lower() == 'post') and isinstance( self.target, PostRequest ):
							for field in self.target.fields.keys():
								target = self.target.copy()
								target.__class__ = PostRequest
								p 	   = payload.copy()
								if "@RANDOM" in p.data:
									p.data = p.data.replace( "@RANDOM", random )
									
								target.setField( field, p.data )
								
								response = target.fetch()
								
								for m in self.kbitem.matches:
									m = m.copy()
									if "@PAYLOAD" in m.data:
										m.data = m.data.replace( "@PAYLOAD", p.data )
									if "@RANDOM" in m.data:
										m.data = m.data.replace( "@RANDOM", random )
									if m.match(response):
										self.ed.vulnerability( target, self.kbitem, field )
										return
							for param in self.target.url.params.keys():
								target = self.target.copy()
								target.__class__ = PostRequest
								p 	   = payload.copy()
								if "@RANDOM" in p.data:
									p.data = p.data.replace( "@RANDOM", random )
									
								target.setParam( param, p.data )
								
								response = target.fetch()
								
								for m in self.kbitem.matches:
									m = m.copy()
									if "@PAYLOAD" in m.data:
										m.data = m.data.replace( "@PAYLOAD", p.data )
									if "@RANDOM" in m.data:
										m.data = m.data.replace( "@RANDOM", random )
									if m.match(response):
										self.ed.vulnerability( target, self.kbitem, param )
										return
						elif payload.scope.lower() == 'header':
							target 	   = self.target.copy()
							connection = httplib.HTTPConnection( target.url.netloc )
							connection.request( "HEAD", "/" )
							response = connection.getresponse()
							headers  = response.getheaders()
							for header in headers:
								for m in self.kbitem.matches:
									if m.match(header[1]):
										self.ed.vulnerability( target, self.kbitem, None )
										return
					# except HTTPError as e:
					#	self.ed.warning(e)
					except:
						pass
开发者ID:evilsocket,项目名称:altair,代码行数:99,代码来源:scanner.py


注:本文中的threadpool.ThreadPool.pushArgs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。