예제 #1
0
파일: Maildb.py 프로젝트: hcit/Maildb
def do_upload():
	from core.common import cleanup
	cleanup().cleartmp(transferDir)
	data = request.files.data
	taskFile = request.forms.taskFile
	comment = request.forms.comment
	if data and comment:
		raw = data.file.read()
		filename = data.filename
		f = open(os.path.join(transferDir, filename), "wb")
		f.write(raw)
		f.close()
		from core.submit import emlSubmit
		context = {}
		# Is pcap or Not
        fileName, fileExtension = os.path.splitext(filename)
        if filename.startswith('http'):
        	newPath = emlSubmit().submithttp(filename, comment)
        if filename.startswith('Tasking'):
        	newPath = emlSubmit().submitTask(filename, comment)
        else:	
        	pcapExt = ".pcap"
        	txtExt = ".txt"
        	if str(fileExtension) == txtExt:
				newPath = emlSubmit().submit(comment)
				redir = "/browse"
        	elif str(fileExtension) == pcapExt:
				print "pcap Being Processed"
				emlSubmit().submitpcap(filename, comment)
	redirect("/browse")
예제 #2
0
파일: Maildb.py 프로젝트: hcit/Maildb
def imapFetch():
	from core.common import cleanup
	cleanup().cleartmp(transferDir)
	context = {}
	usr = request.forms.user
	pwd = request.forms.password
	server = request.forms.server
	inbox = request.forms.inbox
	protocol = request.forms.protocol
	from core.webMail import imapMail
	if protocol == 'imap':
		imapMail().getIMAP(usr, pwd, server, inbox)
	elif protocol == 'pop':
		imapMail().getPOP(usr, pwd, server)
	redirect("/browse")