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


Python utility.CtfUtil类代码示例

本文整理汇总了Python中utility.CtfUtil的典型用法代码示例。如果您正苦于以下问题:Python CtfUtil类的具体用法?Python CtfUtil怎么用?Python CtfUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: createUser

def createUser(mainpage,flag):
	try:
		userPage = mainpage.click("cgi-bin/createuser.php")
		userPage.parse()
            
		userForm = userPage.forms[0];
            
		userName = CtfUtil.getRandomString(random.randint(6,8))
		firstName = CtfUtil.getRandomString(random.randint(6,8))
		lastName = CtfUtil.getRandomString(random.randint(6,8))
		password = CtfUtil.getRandomAlphaNum(8)
		email = flag
            
		userForm.fields['username'] = userName
		userForm.fields['lastname'] = lastName
		userForm.fields['firstname']= firstName
		userForm.fields['password'] = password
		userForm.fields['email'] = email
            
		resultPage = userForm.click(None)
		successPtr = resultPage.page.find("User successfully created!")

		if successPtr != -1:
			return userName,password
		else:
			sys.exit(-1)
                
	except Exception, e:
		print "ERROR: got exception %s creating user" % (e)
		sys.exit(-1)
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:30,代码来源:EstoreServiceScript.py

示例2: score

def score(ip,flag,cookie):

	#get old flag  
	if cookie != None:
		try:
			name = cookie

			personality = browserpersonality.getRandomPersonality()
			mainpg = pybrowse.Browser("http://" + ip + "/~feedback/cgi-bin/candidates.php", personality)
			mainpg.open()
			mainpg.parse()

			candidate = random.randint(0,4)

			feedbackForm = mainpg.forms[candidate]
			feedbackForm.fields['name'] = name
			feedbackForm.fields['comment'] = CtfUtil.getRandomString(5) + " " + CtfUtil.getRandomString(random.randint(4,9)) + random.choice(['?','.','!'])

			resultPage = feedbackForm.click(None)

			successPtr = resultPage.page.find("About")
			if successPtr != -1:
				oldFlag = resultPage.page[successPtr+9:][:len(flag)]
				print "FLAG:",oldFlag

		except Exception, e:
			print "ERROR: got exception %s getting flag" % (e)
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:27,代码来源:FeedbackServiceScript.py

示例3: score

def score(ip,flag,cookie):
	try:
		#Login to ftp
		ftp = ftplib.FTP(ip)
		ftp.login() 
		ftp.cwd("/home/ftp/incoming")
        
		if cookie != None:
			ftp.retrlines("RETR "+cookie,flagCallback)
            
		#set new flag
		filename = CtfUtil.getRandomString(9)
            
		file = open(filename,'w')
		file.write(flag)
		file.close();
            
		file = open(filename,'r')
		ftp.storlines("stor "+filename,file)
		file.close()
		os.remove(filename)

		cookie = filename
		print "COOKIE:",cookie
                
	except Exception, e:
		print "ERROR: Failed to set new flag!"
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:27,代码来源:FtpServiceScript.py

示例4: score

def score(ip,flag,cookie):
	#get old flag  
	if cookie != None:
		try:
			userName,password = cookie.split(":")
                
			mainpage = pybrowse.Browser("http://" + ip + "/~estore/index.html")
			mainpage.open()
			mainpage.parse()
			loginMainPage = login(mainpage, userName, password)
			updatePage = loginMainPage.click("cgi-bin/update.php")
			updatePage.parse()
			updateForm = updatePage.forms[0]
			updateForm.fields['username'] = userName
			updateForm.fields['password'] = password
			updateForm.fields['email'] = CtfUtil.getRandomEmail() 
                
			resultPage = updateForm.click(None)
			successPtr = resultPage.page.find("address was:")

			if(successPtr != -1):
				oldFlag = resultPage.page[successPtr+13:][:len(flag)]
				print "FLAG:",oldFlag
 
			logout(loginMainPage)
                
		except Exception, e:
			print "ERROR: got exception %s getting flag" % (e)
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:28,代码来源:EstoreServiceScript.py

示例5: createAccount

def createAccount(name, passwd, role):
	global myHost
        
	mainpg = pybrowse.Browser("http://" + myHost + "/Therapy/createuser.do?role=" + role)
	mainpg.open()
	mainpg.parse()
        
	userform = mainpg.forms[0]
	userform.fields['firstname'] = CtfUtil.getRandomString(random.randint(4,10))
	userform.fields['lastname'] = CtfUtil.getRandomString(random.randint(5,10))
	userform.fields['email'] = CtfUtil.getRandomEmail()
	userform.fields['username'] = name
	userform.fields['password'] = passwd
	userform.fields['role'] = role
	resultPage = userform.click("submit")
	resultPage = resultPage.doRedirects()
	return resultPage
开发者ID:Steccas,项目名称:ctf-scorebot,代码行数:17,代码来源:TherapyServiceScript.py

示例6: score

def score(ip,flag,cookie):
	#get old flag
	if cookie != None:
		try:
			wwid = cookie
			vote = CtfUtil.getRandomString(random.randint(5,10))

			response = sendMessage(ip,encrypt("!"+wwid+" "+vote))
			successPtr = response.find("OK")
			if successPtr != -1:
				oldFlag = decrypt(response[successPtr+3:].strip())
				print "FLAG:",oldFlag

		except Exception, e:
			print "ERROR: got exception %s getting flag" % (e)
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:15,代码来源:VotecastServiceScript.py

示例7: score

def score(ip,flag,cookie):
	#get old flag  
	if cookie != None:
		try:
			user,email = cookie.split(":")
			resultPage = getNotePage(ip,user,email,CtfUtil.getRandomString(random.randint(5,10)))
                                
			successPtr = resultPage.page.find("NOTE:")

			if successPtr != -1:
				endPointer = resultPage.page[successPtr+6:].find("\n")
				oldFlagText = resultPage.page[successPtr+6:][:endPointer]
				oldFlag = urllib.unquote(oldFlagText)[:len(flag)]
				print "FLAG:",oldFlag
     
		except Exception, e:
			print "ERROR: got exception %s setting new flag" % (e)
			sys.exit(1)
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:18,代码来源:BassretardServiceScript.py

示例8: score

def score(ip,flag,cookie):
	#get old flag
	if cookie != None:
		try:
			sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
			sock.connect((ip, port))

			name = cookie
			topic = CtfUtil.getRandomAlphaNum(random.randint(3,8))
			msg = name+" " + topic + "\n" 

			response = initConversation(msg,sock)
			successPtr = response.find("Last time")

			if successPtr != -1:
				oldFlag = response[successPtr+32:][:len(flag)]
				print "FLAG:",oldFlag
			sock.close()

		except Exception, e:
			print "ERROR: got exception %s getting flag" % (e)
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:21,代码来源:DiscussitServiceScript.py

示例9: create_flag

def create_flag(s, flag):
	username = CtfUtil.getRandomString(6)
	password = random.choice(good_password)
	s.send('new %s %s\n'%(username,password))
        
	res = readline(s)

	if res[:3] != "200":
		return ""
        
	s.send("to: xxxx\n")
	res = readline(s)
        
	s.send("spam\n")
	res = readline(s)
	res = readline(s)
	res = readline(s)
        
	s.send("%s\n"%flag)
	s.send(".\n")
	res = readline(s)
        
	return username+":"+password
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:23,代码来源:SpammerServiceScript.py

示例10: FlagClient

#!/usr/bin/python -u

from utility import CtfUtil
from utility.flagclient import FlagClient

if __name__ == "__main__":
    flagClient = FlagClient(port=8082)
    CtfUtil.main(flagClient.score)
开发者ID:kudox,项目名称:ctf_scorebot5,代码行数:8,代码来源:valves.py

示例11: len

			successPtr = response.find("Last time")

			if successPtr != -1:
				oldFlag = response[successPtr+32:][:len(flag)]
				print "FLAG:",oldFlag
			sock.close()

		except Exception, e:
			print "ERROR: got exception %s getting flag" % (e)

	#set the new flag
	try:  
		sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
		sock.connect((ip, port))

		name = CtfUtil.getRandomString(random.randint(6,8))
		msg = name+" " + flag + "\n"    
		response = initConversation(msg,sock)

		successPtr = response.find("summoning operator")
		if successPtr == -1:
			print "ERROR: Could not set new flag"
			return

		for i in range(random.randint(1,3)):
			if len(askRandomQuestion(sock)) < 1:
				print "ERROR: Something doesnt look right"
				return

		sock.close()
		cookie = name
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:31,代码来源:DiscussitServiceScript.py

示例12: str

				oldFlag = resultingPage.page[successPtr+19:][:len(flag)]
				print "FLAG:",oldFlag

		except Exception, e:
			print "ERROR: got exception %s getting flag" % (e)

	#set the new flag
	try:
		personality = browserpersonality.getRandomPersonality()
		mainpg = pybrowse.Browser("http://" + ip + "/~register/register.html", personality)
		mainpg.open()
		mainpg.parse()

		registrationForm = mainpg.forms[0]

		password = CtfUtil.getRandomAlphaNum(8)
		wwid = flag

		registrationForm.fields['first'] = CtfUtil.getRandomString(random.randint(5,7))
		registrationForm.fields['last'] = CtfUtil.getRandomString(random.randint(6,9))
		registrationForm.fields['dob'] = str(random.choice(months))+" "+str(random.randint(1,29))+", "+str(random.randint(1900,2000))
		registrationForm.fields['email'] = CtfUtil.getRandomEmail()
		registrationForm.fields['password'] = password
		registrationForm.fields['wwid'] = wwid

		resultingPage = registrationForm.click(None)

		successPtr = resultingPage.page.find("Registration successful!")

		if successPtr == -1:
			print "ERROR: Could not set new flag"
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:31,代码来源:RegisterServiceScript.py

示例13:

		personality = browserpersonality.getRandomPersonality()
		mainpg = pybrowse.Browser("http://" + ip + "/Site/Would_you.html")
		mainpg.open()
		mainpg = pybrowse.Browser("http://" + ip + "/Site//Would_you_files/widget1_markup.html")
		mainpg.open()
		mainpg.parse()
            
		qForm = mainpg.forms[0]
		qForm.fields["q1"] = random.choice(("yes", "no")) 
		qForm.fields["q2"] = random.choice(("yes", "no")) 
		qForm.fields["q3"] = random.choice(("yes", "no")) 
		qForm.fields["q5"] = random.choice(("yes", "no")) 
		qForm.fields["q6"] = random.choice(("yes", "no")) 
		qForm.fields["q7"] = random.choice(("yes", "no")) 

		cookie = CtfUtil.getRandomString(random.randint(3,10))

		qForm.fields["steal"] =  flag
		qForm.fields["signature"] = cookie
		resultingPage = qForm.click(None)
		resultingPage = resultingPage.doRedirects()
   
		successPtr = resultingPage.page.find("was successfully saved.")
		if successPtr == -1:
			print "ERROR: cannot set flag"
    
		print "COOKIE:",cookie
        
	except Exception, e:
		print "ERROR: got exception %s getting flag" % (e)
        
开发者ID:RootFu,项目名称:ctf-scorebot,代码行数:30,代码来源:WouldYouServiceScript.py

示例14:

			print "ERROR: got exception [%s] getting flag" % (e)
			sys.exit(1)
                
        
	# set the new flag
	try:
		personality = browserpersonality.getRandomPersonality()
		mainpg = pybrowse.Browser("http://" + ip + "/Site/Sound_of_music.html")
		mainpg.open()
		mainpg = pybrowse.Browser("http://" + ip + "/Site/Sound_of_music_files/widget1_markup.html")
		mainpg.open()
		mainpg.parse()

		qForm = mainpg.forms[0]
		myfirst =flag 
		mylast = CtfUtil.getRandomString(random.randint(3,10))
		myemail = CtfUtil.getRandomEmail()
		mypassword = CtfUtil.getRandomString(random.randint(3,10))
            
		qForm.fields["first"] = myfirst
		qForm.fields["last"] = mylast
		qForm.fields["email"] = myemail
		qForm.fields["password"] = mypassword
            
		cookie = qForm.fields["email"] + ":" + qForm.fields["password"]
		resultingPage = qForm.click(None)
		resultingPage = resultingPage.doRedirects()
		successPtr = resultingPage.page.find("successfully created")

		if successPtr == -1:
			print "ERROR: Error setting new flag"
开发者ID:Steccas,项目名称:ctf-scorebot,代码行数:31,代码来源:CopyrightServiceScript.py

示例15: getRandomSentence

def getRandomSentence(len):
	ret = ""
	for i in range(len):
		ret += CtfUtil.getRandomString(random.randint(1,8)) + " "
	return ret
开发者ID:Steccas,项目名称:ctf-scorebot,代码行数:5,代码来源:CopyrightServiceScript.py


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