コード例 #1
0
def profileLinkCrawl(profileLink,cokie,sockObject):
		
	requestN=webs.reqGenCrawl(host,profileLink,userName,password,cokie)
	responseN=socks.handle_req(requestN,sockObject)
	[status,body,header_data]=webs.xtractInfo(responseN)
	while 1:
		if status=='500':
		
			sock1=socks.create_sock(host,port)
			requestN=webs.reqGenCrawl(host,profileLink,userName,password,cokie)
			responseN=socks.handle_req(requestN,sock1)
			[status2,body,header_data]=webs.xtractInfo(responseN)
			
			if status2=='200':
				sockObject=sock1
				break
			else:
				status=status2
				continue
				
		else:
			break	
		
	try:
		urlList=webs.xtractLinks(body)
		if "<h2 class='secret_flag' style=" in body:
			flagCheck=webs.findSecretFlag(body)
			flag_list.append(flagCheck)
		for profileLink2 in urlList:
			if profileLink2 not in url_unvisited and profileLink not in url_visited:
				url_unvisited.append(profileLink2)	
		
	except:
		sys.exit("Problem in profileLinkCrawl")
	
		
	
	return [status,body,header_data]
コード例 #2
0
def login(sockObject):
	request1=webs.reqGenGet(host,'/accounts/login/?next=/fakebook/')
	#print(request1)
	response1=socks.handle_req(request1,sockObject)
	
	# print(response1)
	[stat,body,header_data]=webs.xtractInfo(response1)
	
	#print(header_data)
	
	
	if stat=='200':
		try:
			cokie=webs.breakCookie(header_data)		
		except Exception as e:
			cokie=[]
			print(e)
			sys.exit("Cookie not available for login")
			
		request2=webs.reqGenPut(host,userName,password,cokie)
		response2=socks.handle_req(request2,sockObject)
		[stat,body,header_data]=webs.xtractInfo(response2)
		
		[csrf2,sessionId2]=webs.breakCookie(header_data)
		csrf1=cokie[0]
		cokie=[csrf1,sessionId2]
		path='/fakebook/'
		request21=webs.reqGenCrawl(host,path,userName,password,cokie)
		response21=socks.handle_req(request21,sockObject)
		[stat,body,header_data]=webs.xtractInfo(response21)
		
	# print(response3)
	else:
		sys.exit("Not able to login")
	
	return [response21,cokie]