def generate_deleteform(): db = database_connection() cursor = db.cursor() sql_role = "select a.role_id,a.role_name from roles a, mapping b where a.role_id = b.role_id and b.user_id = '%s'"%customer_id cursor.execute(sql_role) results=cursor.fetchall() #print header.printHeader() #print leftNav.printLeftNav() print header.printHeader() print '''<div class="left-side" style="width:745px;" >''' print '''<div class="formbox" align="center">''' print '''<form name="form_delete" action="delete_roles.py"><table border='1' class="formboxcontent"> <tr><td colspan="5"><b>Click on the respective Roles to Delete</b></td></tr> <tr><td colspan='1'> </td><td><b>Role Name</b></td></tr>''' for row in results: role_id = row[0] role_name = row[1] print '''<tr><td><input name="role_id" type="radio" value="%d" /></td><td>'''%role_id print role_name print'''</td>''' print '''<tr><td> </td><td align='right'> <input name="btn_delete" type="submit" value="Delete" /> <INPUT TYPE = hidden NAME = 'action' VALUE ='display'> </tr></td>''' print '''</table></form>'''
def generate_form(err): print '''<html>''' print header.printHeader() print '''<head> <link rel="stylesheet" type="text/css" href="/others/styles.css" /></link> </head> <title>SwiftMail::Insert Roles </title> <body> <table align='center' width='800' border='0' class='pagecontent'>''' if (err == 1): print "<tr><td> </td><td><font color='#FF0000'>Please Enter Role again,Roles already exists!</font></td></tr>" print '''<form name="form_role" action="insert_roles.py" onsubmit="return form_validation();"> <tr> <td colspan="2"><b>Insert Roles</b></td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td>Enter Role Name : </td> <td><input name="role_name" type="text" size="60"></td> </tr> <tr> <td>Enter Keyword for the role:(keywords seperated by semicolon)</td> <td> <textarea name="keyword" cols="50" rows="5">''' if(err == 1): try: print "%s"%(form["keyword"].value) except: print "" print '''</textarea> </td> </tr> <tr> <td>Enter Email Address for the role:(Email Address seperated by semicolon)</td> <td><textarea name="email" cols="50" rows="5">''' if(err == 1): try: print "%s"%(form["email"].value) except: print "" print '''</textarea></td> </tr> <tr> <td>Enter Name for the role:(Name seperated by semicolon)</td> <td><textarea name="name" cols="50" rows="5">''' if(err == 1): try: print "%s"%(form["name"].value) except: print "" print'''</textarea></td>
def delete_roledata(role_id): db = database_connection() cursor = db.cursor() sql_delete2 = 'DELETE FROM mapping WHERE role_id=%s'%(role_id) cursor.execute(sql_delete2) db.commit() sql_delete = 'DELETE FROM roles WHERE role_id=%s'%(role_id) cursor.execute(sql_delete) db.commit() print header.printHeader() #print leftNav.printLeftNav() print '''<div class="left-side" style="width:745px;" >''' print '''<div class="formbox" align="center">''' print '<p>Roles has been deleted Successfully<p>' print '<a href="display_roles.py">Go back to Display Roles</a>' print '''</div></div>'''
def display_roledata(role_id,role_name,keyword,email,name): db = database_connection() cursor = db.cursor() sql_mappingupdate = 'UPDATE mapping SET keywords="%s",emails="%s",names="%s" WHERE role_id="%s"'%(keyword,email,name,role_id) sql_role = 'UPDATE roles SET role_name = "%s" where role_id = "%s"' %(role_name,role_id) #print sql_dvdupdate cursor.execute(sql_mappingupdate) db.commit() cursor.execute(sql_role) db.commit() #print header.printHeader() #print leftNav.printLeftNav() print header.printHeader() print '''<div class="left-side" style="width:745px;" >''' print '''<div class="formbox" align="center">''' print '<p>Roles Info has been updated Successfully<p>' print '<a href="display_roles.py">Go back to Display Roles</a>' print '''</div></div>'''
def insert_roles(user_id,role_name,keyword,email,name): db = database_connection() cursor = db.cursor() sql_validate = 'select role_name from roles where role_name = "%s"' %(role_name) cursor.execute(sql_validate) results1=cursor.fetchall() if results1: generate_form(1) else: sql_role = 'INSERT INTO roles(role_name) VALUES("%s")'%(role_name) cursor.execute(sql_role) db.commit() role_id = cursor.lastrowid #keywords = keyword.strip().split(";") #print len(keywords) #for keyword in keywords: sql_mapping = 'INSERT INTO mapping(role_id,user_id,keywords,emails,names) VALUES("%s","%s","%s","%s","%s")'%(role_id,user_id,keyword,email,name) #print sql_mapping cursor.execute(sql_mapping) db.commit() print '''<HTML>''' print header.printHeader() print '''<TITLE>SwiftMail::Insert Roles </TITLE><body>''' #print leftNav.printLeftNav() print '''<div class="left-side" style="width:745px;" >''' print '''<table align="center" border='0'><tr><td> </td></tr></table>''' print 'Roles has been created successfully! ' print "<A HREF='home.py'> Go Back </A></div>" #print footer.printFooter() print '''</body></html>'''
def generate_roleform(): form = cgi.FieldStorage() role_id=form["role_id"].value sql_role = 'SELECT m.keywords,m.emails,m.names,r.role_name,r.role_id FROM mapping AS m,roles AS r WHERE m.role_id = r.role_id AND m.role_id=%s'%(role_id) #print sql_role cursor.execute(sql_role) results=cursor.fetchall() for row in results: keywords = row[0] emails = row[1] names = row[2] role_name = row[3] role_id = row[4] print '''<HTML><HEAD>''' print header.printHeader() print '''<TITLE> SwiftMail :: Update Roles </TITLE></HEAD> <body>''' #print header.printHeader() #print leftNav.printLeftNav() print '''<div class="left-side" style="width:745px;" >''' print '''<div class="formbox">''' print '''<form name='role_form' action='update_roles.py' onsubmit="return form_validation();"> <table width="745" border="0" class="formboxcontent"> <tr> <td colspan="2"><div align="left" class="formboxheader"><b>Update Fields</b></div></td> </tr> <tr> <td>Enter Role Name : </td> <td><input name="role_name" type="text" size="60" value='%s'/></td> </tr> <tr> <td>Enter Keyword for the role:(keywords seperated by semicolon)</td> <td><textarea name="keyword" cols="50" rows="5">%s</textarea> </td> </tr> <tr> <td>Enter Email Address for the role:(Email Address seperated by semicolon)</td> <td><textarea name="email" cols="50" rows="5">%s</textarea></td> </tr> <tr> <td>Enter Name for the role:(Name seperated by semicolon) </td> <td><textarea name="name" cols="50" rows="5">%s</textarea></td> </tr> <tr> <td><input name="submit" type="submit" value=" UPDATE " /> <INPUT TYPE = hidden NAME = 'action' VALUE ='display'> <INPUT TYPE =hidden NAME ='role_id' value='%s'> <INPUT TYPE=button VALUE = "Go Back" ONCLICK = 'window.history.back()'/> </td> <td> </td> </tr> <tr> <td> </td> <td> </td> </tr> </table></form> </div></div> '''%(role_name,keywords,emails,names,role_id) print '''</body></html>'''
#!c:/Python26/python.exe import cgi import header import utility import header import datetime import getdata import runner import insert_email #import cgitb #cgitb.enable() print "Content-type: text/html; charset=iso-8859-1\n\n" from db import database_connection username,password,local = getdata.getGmailAcct() runner.dumpData(username,password,local) insert_email.insert_data() print header.printHeader() print "Loading Your Data......" print '''<script language=javascript> window.location="http://localhost/video/Final_Project/home.py";</script> '''
#!/usr/bin/env python import requests import json import sys from time import sleep import urllib.parse as urllib from pprint import pprint from converter import converter from header import printHeader from colorama import Fore, Back, Style printHeader() def search(user, token, repo, dorklist): try: if dorklist: try: dorks = open(dorklist).read().splitlines() except: print('Error: Could not find the pointed dork list.') return else: dorks = open('./small_dorklist.txt').read().splitlines() for string in dorks: if token: if repo: parsed_response = requests.get(
import cfg import header import functions # CABEÇALHO header.printHeader() recordes = [] pontos = 0 rodadas = 0 jogador = input("Digite seu Nome:").upper() while (pontos < cfg.pontosNecessarios): print("PONTOS: {0} | RODADAS: {1}\n".format(pontos, rodadas)) print("Insira sua Jogada") escolha = input("PAPEL, PEDRA ou TESOURA?").upper() if (escolha == "PAPEL" or escolha == "PEDRA" or escolha == "TESOURA"): bot = functions.bot() duelo = functions.batalha(escolha, bot) if (duelo == 3): print("Você: {0}\nBot: {1}\nVocê ganhou\n\n\n".format( escolha, bot)) elif (duelo == 1): print("Você: {0}\nBot: {1}\nEmpate\n\n\n".format(escolha, bot)) else: print("Você: {0}\nBot: {1}\nVocê perdeu\n\n\n".format( escolha, bot)) pass pontos = pontos + duelo rodadas = rodadas + 1 else:
def run(): http_headers() customer_id = utility.getUserId(utility.getUserName()) #print 'id:%s'%customer_id print ''' <html>''' print header.printHeader() todo = datetime.date.today() print '''<head> <script type="text/javascript" src="/others/simpletreemenu.js"></script> <link rel="stylesheet" type="text/css" href="/others/jquery-ui-1.8.6.custom.css" /></link> <script type="text/javascript" src="/others/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="/others/jquery-ui-1.8.6.custom.min.js"></script> <link rel="stylesheet" type="text/css" href="/others/simpletree.css" /></link> <link rel="stylesheet" type="text/css" href="/others/styles.css" /></link> </head> <title>SwiftMail</title> <body> <table align='center' width='800' height='500' border='1' class='pagecontent'> <tr><td colspan="2"> <div style="height: 135px;width: 1000px;;overflow:auto;"> <table class='pagecontent' border='0' width='800' align='center'> <tr width = "100%"><td colspan='2' width = "100%">''' print '''<h3 class="ui-widget-header">This is the to-do list for '%s'</h3>'''%todo print '''</td></tr>''' print '''<tr><td><b>From</b></td> <td><b>Subject</b></td></tr>''' sql_todo = "select message_id,message,date_email,from_email,datasource,subject,attachment from email where user_id = %s and date_email >= current_date()"%customer_id cursor.execute(sql_todo) results_todo=cursor.fetchall() for row in results_todo: message_id = row[0] message = row[1] date_email = row[2] from_email = row[3] datasource = row[4] subject =row[5] attachment = row[6] print '<tr><td>%s</td> '%from_email print '<td><a href=home.py?message_id=%s>%s</a></td></tr>'%(message_id,subject) print '''</table> </div></td> </tr>''' print '''<tr valign="top"> <td rowspan='2'> <script> $(function() { $( "#resizable2" ).resizable(); }); </script> <div id="resizable2" class="ui-widget-content"> <a href="javascript:ddtreemenu.flatten('treemenu1', 'expand')">Expand All</a> | <a href="javascript:ddtreemenu.flatten('treemenu1', 'contact')">Contract All</a> <div style="height:500px;width:206px;" style='table-layout:fixed'> <ul id="treemenu1" class="treeview">''' for row_root in results_root: print '<li>' role_id = row_root[0] role_id1 = row_root[0] role_name= row_root[1] print '<a href="home.py?role_id=%d">%s</a>'%(role_id,role_name) print '<ul>' sql_subroot = "select message_id,subject,from_email,date_email,datasource,attachment,role_id from email where user_id =%s and role_id = %s"%(customer_id,role_id) cursor.execute(sql_subroot) results_subroot=cursor.fetchall() if results_subroot: for row in results_subroot: message_id = row[0] message_id1 = row[0] subject = row[1] print '<li>' print '<a href="home.py?message_id=%d&role_id=%s">%s</a>'%(message_id,role_id,subject) print '</li>' else: message_id1 = 0 print '</ul>' print '<li>' print '''</ul></div> <script type="text/javascript"> ddtreemenu.createTree("treemenu1", false) </script> ''' print ''' <script> $(function() { $( "#resizable" ).resizable(); }); </script>''' print '''</div> </td> <td> <div id="resizable" class="ui-widget-content"; style="overflow:auto;"> <h3 class="ui-widget-header">Inbox</h3> <table align="left" border='1' style='table-layout:fixed' class='pagecontent' width='100%'> <tr><td><b>From</b></td><td><b>Subject</b></td><td><b>Date</b></td><td><b>DataSource</b></td><td><b>Attachment</b></td></tr> ''' form = cgi.FieldStorage() try: role_id=form["role_id"].value except: #print "Select a appropriate folder" role_id = role_id1 #print "role_id:%s"%role_id sql_subroot = "select message_id,subject,from_email,date_email,datasource,attachment,role_id from email where user_id ='%s' and role_id = '%s'"%(customer_id,role_id) #print sql_subroot cursor.execute(sql_subroot) results_subroot=cursor.fetchall() for row in results_subroot: message_id = row[0] subject = row[1] from_email = row[2] date_email = row[3] datasource = row[4] attachment = row[5] role_id = row[6] print '<tr><td>%s</td>'%from_email print ' <td>' print '<a href="home.py?message_id=%d&role_id=%s">%s</a>'%(message_id,role_id,subject) print '</td>' print '<td>%s</td>'%date_email print '<td>%s</td>'%datasource print '<td>%s</td></tr>'%attachment print '<form><input type="hidden" name="role_id" value="%s"></form>'%role_id print'''</table> </div> </td> </tr> <tr> <td valign='top'> <script> $(function() { $( "#resizable1" ).resizable(); }); </script> <div id="resizable1" class="ui-widget-content"> <h3 class="ui-widget-header">Full Email</h3>''' print '''<table border='0' style='table-layout:fixed' class='pagecontent' width='100%'>''' form = cgi.FieldStorage() try: message_id=form["message_id"].value except: message_id = message_id1 sql_message = 'select message,from_email,subject from email where message_id = %s'%(message_id) cursor.execute(sql_message) results_message=cursor.fetchall() for row in results_message: print '''<tr><td>''' from_email = row[1] print 'From : %s'%from_email print '''</td></tr>''' print '''<tr><td>''' subject = row[2] print 'Subject : %s'%subject print '''</td></tr>''' print '''<tr><td>''' print ' ' print '''</td></tr>''' print '''<tr><td>''' message = row[0] print '%s'%message print '''</td></tr>''' print '''</table></div>