コード例 #1
0
ファイル: DNS_UI.py プロジェクト: algby/DNS-NG
 def __init__(self):
     QtGui.QDialog.__init__(self)
     self.setupUi(self)
     self.setLayout(self.verticalLayout)
     
     self.timer = QtCore.QTimer()
     self.timer.setInterval(1000)
     
     #Signal handler connections
     self.connect(self.cmdClose, QtCore.SIGNAL("clicked()"), QtGui.qApp, QtCore.SLOT("quit()"))
     
     self.connect(self.cmdRefresh, QtCore.SIGNAL("clicked()"), self.reloadRedirects)
     self.connect(self.cmdRefresh, QtCore.SIGNAL("clicked()"), self.updateServerStatusUI)
     
     self.connect(self.cmdToggleServer, QtCore.SIGNAL("clicked()"), self.toggleServerStatus)
     
     self.connect(self.rdoOn, QtCore.SIGNAL("clicked()"), self.toggleRequestsView)
     self.connect(self.rdoOff, QtCore.SIGNAL("clicked()"), self.toggleRequestsView)
     
     self.connect(self.cmdAdd, QtCore.SIGNAL("clicked()"), self.addRecord)
     self.connect(self.cmdSave, QtCore.SIGNAL("clicked()"), self.saveRecords)
     self.connect(self.cmdDelete, QtCore.SIGNAL("clicked()"), self.deleteRecord)
     
     self.connect(self.timer, QtCore.SIGNAL("timeout()"), self.getDNSRequests)
     
     self.objDB = get_db_session()
     
     
     self.txtDNSRequests.setText("Incoming DNS Queries")
     self.lastRequestID = self.getLastRequestID()
     
     # Check server status and update user interface accordingly
     self.updateServerStatusUI()
     
     
     if '' != self.serverPID:
         self.timer.start()
     
     
     self.reloadRedirects()
コード例 #2
0
ファイル: history.py プロジェクト: SaraQamar/FYP
    def __init__(self):
        e = Env()
        count = 0
        self.dbsession = get_db_session()
        V = self.dbsession.query(Person).count()         
        rname = raw_input("Enter person name : ")
	date = raw_input("Enter starting date(yyyy-mm-dd) : ")
        date2 = raw_input("Enter finish date(yyyy-mm-dd)  : ")
        center = e.center(rname, count)
        cntct_num = self.dbsession.query(Person).filter(Person.name == rname )
        for i in cntct_num :
	  cntct_num = i.phone_no
        calls = []
        msg = []
        email = []
        d=0
        calls = self.dbsession.query(Call).filter(Call.e_from == cntct_num ).all()
        msg = self.dbsession.query(Msg).filter(Msg.e_from == cntct_num ).all()
        email = self.dbsession.query(Email).filter(Email.e_from ==  cntct_num ).all()
        d = 1
                        #rmv_cal_dub_in = []
	calls_in_list = e.separate_in(calls)
	#rmv_cal_dub_in = e.durations(calls_in_list)
                       #..................
        calls_out_list = e.separate_out(calls)
        #rmv_cal_dub_out = e.durations(calls_out_list)
                        #.................
        msg_in_list = e.separate_in(msg)
        #rem_msg_dub_in = e.durations(msg_in_list)
                    #.................
        msg_out_list = e.separate_out(msg)
        #rem_msg_dub_out = e.durations(msg_out_list) 
                        #...................
        mail_in_list = e.separate_in(email)
        #rem_mail_dub_in = e.durations(mail_in_list)
                
                            #.......................
        mail_out_list = e.separate_out(email)
        #rem_mail_dub_out = e.durations(mail_out_list)
                            #.....merge all incomming_outgoing..set duration
        in_list = []
        in_list.append(calls_in_list)
        in_list.append(msg_in_list)
        in_list.append(mail_in_list)
                 
        
	in_list = e.m(in_list)
                 
                 
                        #......................
        out_list = []
        out_list.append(calls_out_list)
        out_list.append(msg_out_list)
        out_list.append(mail_out_list)
       
        out_list = e.m(out_list)
     
     
                      #..........represent incoming outgoing both.............
                
        r =[]
        g = []
        for item in in_list:
	  for o in out_list:
                if ((cmp(int(item.e_from), int(o.e_from))) == 0)  and item.name== o.name:
		  DATE = str(datetime.date(item.datetime))
		  TIME = str(datetime.time(item.datetime))
		  history = DATE + '  ' +TIME
		  if((DATE >= (date)) and (DATE <= (date2))):
		  
		     r = item 
                     g = o
		     NUM = item.name
		     pos= e.addball(NUM, DATE)  
                     k = item.e_key
                     colour1 = e.colours(k)
                     len = len + 1
                       
                     if item.duration <= 10:
                           d = 0.1
                     if item.duration > 10:
                           d = item.duration
                           d = d/10
                           d = d*(0.1)
                           e.drawLine(center,pos,colour1,d)
                                       #....................................
                   
                      #      if o['duration'] <= 10:
                       #         m = 0.1
                        #    if o['duration'] > 10:
                         #       m = o['duration']
                          #      m = m/10
                           #     m = m*(0.1)
                            #e.drawLine(center,pos,colourr2,m)
                            #..................................
                     in_list.remove(r)
                     out_list.remove(g)
   
                 
                 #......for incoming use any other line seg........................
                 
        for i in in_list:
	  DATE = str(datetime.date(i.datetime))
	  TIME = str(datetime.time(i.datetime))
	  history = DATE + '  ' + TIME

	  if((DATE >= (date)) and (DATE <= (date2))):
            NUM = i.name
            pos= e.addball(NUM, history)  
            k = i.key
            if i.duration <= 10:
                    d = 0.1
            if i.duration > 10:
                    d = i.duration
                    d = d/10
                    d = d*(0.1)
                   
            colour2 = e.colours(k)
            e.drawLine(center,pos,colour2,d)
            
          #else if((DATE >= (date)) and (DATE <= (date2))): 
   
                 
                 #..........Use different style of line to draw outgoing
        for l in out_list:
	  DATE = str(datetime.date(i.datetime))
	  TIME = str(datetime.time(i.datetime))
	  history = DATE + '  ' + TIME
	  if((DATE >= (date)) and (DATE <= (date2))):#2012-05-17
	      NUM = l.name
	      pos= e.addball(NUM, history)  
	      k = l.key
 	      if l.duration <= 10:
		 d = 0.8
 	      if l.duration > 10:
                 d = l.duration
                 d = d/10
                 d = d*(0.8)
                   
	      colour3 = e.colours(k)
	      e.drawLine(center,pos,colour3,d)

     
     


        if d ==0 :
            print("contact name does not exists")
コード例 #3
0
ファイル: history.py プロジェクト: SaraQamar/FYP
from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import *
from direct.showbase.ShowBase import ShowBase
from direct.showbase.DirectObject import DirectObject
from panda3d.core import Vec3
from direct.gui.OnscreenText import OnscreenText
from pandac.PandaModules import TextNode
import random
from panda3d.core import *
from pandac.PandaModules import *
from direct.gui.OnscreenText import *
from direct.gui.DirectGui import *
from direct.interval.IntervalGlobal import *
from direct.showbase.ShowBase import ShowBase
from datetime import *
dbsession = get_db_session()
cx = 1
class Env(ShowBase):
    def __init__(self):
        self.n = 0
        cmnd = ""
        self.commandBox = ""
        self.store = ["","","",""]
        ShowBase.__init__(self)
        base.setFrameRateMeter(True)
        base.setBackgroundColor(0,0,0)
        self.centr = (1, 1, 1)
        self.cam.setPos(15, -30, 22)
        light = PointLight('light')
        self.render.setLight(self.cam.attachNewNode(light))
        self.cam.lookAt(0, 0, 0)
コード例 #4
0
    def __init__(self):
        e = Env()
        count = 0
        self.dbsession = get_db_session()
        V = self.dbsession.query(Person).count()         
        e.cx = (V/10) + 4
       # e.cube.setScale(e.cx, 3, 1)
        #if rname == 'ALL' :
        for v in self.dbsession.query(Person).all():
                  count = count + 1
                  name1 = v.name
                  center = e.center(name1, count)
                  cntct_num = self.dbsession.query(Person).filter(Person.name == v.name )
		  for i in cntct_num :
		    cntct_num = i.phone_no
                  d=0
                  calls = self.dbsession.query(Call).filter(Call.e_from == cntct_num ).all()
                  msg = self.dbsession.query(Msg).filter(Msg.e_from == cntct_num ).all()
                  email = self.dbsession.query(Email).filter(Email.e_from ==  cntct_num ).all()
                  d = 1
                        #rmv_cal_dub_in = []
		  calls_in_list = e.separate_in(calls)
		  rmv_cal_dub_in = e.durations(calls_in_list)
                       #..................
                  calls_out_list = e.separate_out(calls)
                  rmv_cal_dub_out = e.durations(calls_out_list)
                        #.................
                  msg_in_list = e.separate_in(msg)
                  rem_msg_dub_in = e.durations(msg_in_list)
                    #.................
                  msg_out_list = e.separate_out(msg)
                  rem_msg_dub_out = e.durations(msg_out_list) 
                        #...................
                  mail_in_list = e.separate_in(email)
                  rem_mail_dub_in = e.durations(mail_in_list)
                
                            #.......................
                  mail_out_list = e.separate_out(email)
                  rem_mail_dub_out = e.durations(mail_out_list)
                            #.....merge all incomming_outgoing..set duration
                  in_list = []
                  in_list.append(rmv_cal_dub_in)
                  in_list.append(rem_msg_dub_in)
                  in_list.append(rem_mail_dub_in)
                 
                  in_merge = in_list
                  in_merge = e.merge(in_list)
                 
                 
                        #......................
                  out_list = []
                  out_list.append(rmv_cal_dub_out)
                  out_list.append(rem_msg_dub_out)
                  out_list.append(rem_mail_dub_out)
                  z = out_list
                  outt = e.merge_out(z)
     
     
                      #..........represent incoming outgoing both.............
                
                  r =[]
                  g = []
                  for item in in_merge:
                      for o in outt:
                         if ((cmp(int(item.e_from), int(o.e_from))) == 0)  and item.name== o.name :
                                        r = item 
                                        g = o
                                        NUM = item.name
                                     
                                        pos= e.addball(NUM)  
                                        k = item.e_key
                                        colour1 = e.colours(k)
                                        len = len + 1
                       
                                        if item.duration <= 10:
                                            d = 0.1
                                        if item.duration > 10:
                                            d = item.duration
                                            d = d/10
                                            d = d*(0.1)
                                        e.drawLine(center,pos,colour1,d)
                                        #....................................
                    
                           # if o['duration'] <= 10:
                            #    m = 0.1
                            #if o['duration'] > 10:
                             #   m = o['duration']
                              #  m = m/10
                               # m = m*(0.1)
                            #e.drawLine(center,pos,colourr2,m)
                            #..................................
                                        in_merge.remove(r)
                                        outt.remove(g)
    
                 
                 #......for incoming use any other line seg........................
                  for i in in_merge:
                       
                        NUM = i.name
                        pos= e.addball(NUM)  
                        k = i.key
                        if i.duration <= 10:
                            d = 0.1
                        if i.duration > 10:
                            d = i.duration
                            d = d/10
                            d = d*(0.1)
                    
                        colour2 = e.colours(k)
                        e.drawLine(center,pos,colour2,d)
    
                 
                 #..........Use different style of line to draw outgoing
                  for l in outt:
                  
                    NUM = l.name
                    pos= e.addball(NUM)  
                    k = l.key
                    if l.duration <= 10:
                        d = 0.8
                    if l.duration > 10:
                        d = l.duration
                        d = d/10
                        d = d*(0.8)
                    
                    colour3 = e.colours(k)
                    e.drawLine(center,pos,colour3,d)

     
     


                  if d ==0 :
                        print("contact name does not exists")
コード例 #5
0
ファイル: setup.py プロジェクト: SaraQamar/FYP
import db_code
from models import *
from datetime import *

db_code.setup_db()
db_session = db_code.get_db_session()


def p_db(name, num, email_id, phone_no):
      S = Person()
      S.id_number = num
      S.name = name
      S.email_id = email_id
      S.phone_no = phone_no
      db_session.add(S)
      db_session.commit()
      
r = db_session.query(Person).count() 
if (not r):
    (p_db('PersonA', 1, 'azx', '0989877123'))  
    (p_db('PersonB', 2, 'zxc', '03331233454'))
    (p_db('PersonC', 3, 'sdf', '03331233494'))
    (p_db('PersonD', 4, 'poi', '03331233474'))
    (p_db('PersonE', 5, 'rty', '03331233451'))
    (p_db('PersonF', 6, 'qwe', '03337233452'))
    (p_db('PersonG', 7, 'dfg', '03335213456'))
    (p_db('PersonH', 8, 'kjh', '03335933458'))
    (p_db('PersonI', 9, 'kjh', '03338233459'))
    (p_db('PersonJ', 10, 'lpo', '03337233452'))
    (p_db('PersonK', 11, 'kli', '03337233456'))
    (p_db('PersonL', 12, 'mnb', '03337233466'))
コード例 #6
0
ファイル: redirect_manager.py プロジェクト: algby/DNS-NG
 def __init__(self):
     "Create a RedirectManager object"
     
     self.objDB = get_db_session()
     self.load_redirects()
コード例 #7
0
ファイル: conectn_depth.py プロジェクト: SaraQamar/FYP
  def display (self, name_l):
     
   self.dbsession = get_db_session()
   V = self.dbsession.query(Person).count()          
   calls =[]
   msg = []
   email = []
   d=0
   for i in name_l:
     for k in i :
	#for v in contacts:
         #for c in v:
	  #if v['name'] == k :
		 #calls = v['calls'],
                 #msg = v['messges'],
                 #email = v['emails'],
      
      cntct_num = self.dbsession.query(Person).filter(Person.name == k )
      for i in cntct_num :
	  cntct_num = i.phone_no
      calls = self.dbsession.query(Call).filter( Call.e_from == cntct_num ).all()
      msg = self.dbsession.query(Msg).filter( Msg.e_from == cntct_num ).all()
      email = self.dbsession.query(Email).filter(Email.e_from ==  cntct_num ).all()
      d = 1 
   
      calls_in_list = self.separate_in(calls)
      rmv_cal_dub_in = self.durations(calls_in_list)
                            #..................
      calls_out_list = self.separate_out(calls)
      rmv_cal_dub_out = self.durations(calls_out_list)
                        #.................
      msg_in_list = self.separate_in(msg)
      rem_msg_dub_in = self.durations(msg_in_list)
                            #.................
      msg_out_list = self.separate_out(msg)
      rem_msg_dub_out = self.durations(msg_out_list) 
                        #...................
                        
      mail_in_list = self.separate_in(email)
      rem_mail_dub_in = self.durations(mail_in_list)
                            #.......................
      mail_out_list = self.separate_out(email)
      rem_mail_dub_out = self.durations(mail_out_list)
                            #.....merge all incomming_outgoing..set duration
                            
      in_list = []
      in_list.append(rmv_cal_dub_in)
      in_list.append(rem_msg_dub_in)
      in_list.append(rem_mail_dub_in)
      in_merge = in_list
      in_merge = self.merge(in_list)
                 
                 
                        #......................
      out_list = []
      out_list.append(rmv_cal_dub_out)    
      out_list.append(rem_msg_dub_out)
      out_list.append(rem_mail_dub_out)
      z = out_list
      outt = self.merge_out(z)     
     
                      #..........represent incoming outgoing both.............
      r =[]
      g = []
      D = []
      P = []
      K = 1
      for item in in_merge:
	    for o in outt:
		if ((cmp(int(item.e_from), int(o.e_from))) == 0)  and item.name== o.name :
                        r = item
                        g = o
                        NUM = item.name
                        ps= self.addball(NUM, K)#.............................................................................................
                        K = K + 1
                        k = item.key
                        colour1 = self.colours(k)
                       
                        if item.duration <= 10:
                            d = 0.1
                        if item.duration > 10:
                            d = item.duration
                            d = d/10
                            d = d*(0.1)
                        self.drawLine(self.centr,ps,colour2,d) 
                        D.append(r)
                        P.append(ps)
                        # if o['duration'] <= 10:
                            #    m = 0.1
                            #if o['duration'] > 10:
                             #   m = o['duration']
                              #  m = m/10
                               # m = m*(0.1)
                            #e.drawLine(center,pos,colourr2,m)
                        in_merge.remove(r)
                        outt.remove(g)
               
               
      for i in in_merge:
         
         NUM = i.name
         ps= self.addball(NUM, K)
         K = K + 1
	 k = i.key
         if i.duration <= 10:
             d = 0.1
         if i.duration > 10:
             d = i.duration
             d = d/10
             d = d*(0.1)
         r = i.name          
         colour2 = self.colours(k)
         self.drawLine(self.centr,ps,colour2,d)
         D.append(r)
         P.append(ps)
         
      for l in outt:
         
         NUM = l.name
         ps = self.addball(NUM, K)
         K = K + 1
         k = l.key
         if l.duration <= 10:
             d = 0.8
         if l.duration > 10:
             d = l.duration
             d = d/10
             d = d*(0.8)
         r = l.name
         D.append(r)
         colour3 = self.colours(k)
         self.drawLine(self.centr,ps,colour3,d)
         P.append(ps)
      dictionary = dict(zip(D, P))
      return dictionary 
                      
      if d == 0 :
         print("contact name does not exists")
コード例 #8
0
ファイル: filter1.py プロジェクト: Shazia/FYP
    def filter(self, enteredName):
        e = self.e
        name1 = enteredName
        #e.Remove
        self.dbsession = get_db_session()
        V = self.dbsession.query(Person).count()
        self.e.cx = (V/10) + 4
        for v in self.dbsession.query(Person).all():
            calls = []
            msg = []
            email = []
            d=0
            #for c in v:
        #........person name............
            if v.name == name1:
                    e.center(name1)
                    d = 1
                    calls = self.dbsession.query(Call).filter(Person.name == name1 ).all()
                    msg = self.dbsession.query(Msg).filter(Person.name == name1).all()
                    email = self.dbsession.query(Email).filter(Person.name ==  name1).all()

                        #rmv_cal_dub_in = []
                    calls_in_list = e.separate_in(calls)
                    rmv_cal_dub_in = e.durations(calls_in_list)
                            #..................
                    calls_out_list = e.separate_out(calls)
                    rmv_cal_dub_out = e.durations(calls_out_list)
                        #.................
                    msg_in_list = e.separate_in(msg)
                    rem_msg_dub_in = e. durations(msg_in_list)
                            #.................
                    msg_out_list = e.separate_out(msg)
                    rem_msg_dub_out = e.durations(msg_out_list)
                  #...................
                    mail_in_list = e.separate_in(email)
                    rem_mail_dub_in = e.durations(mail_in_list)
                            #.......................
                    mail_out_list = e.separate_out(email)
                    rem_mail_dub_out = e.durations(mail_out_list)
                            #.....merge all incomming_outgoing..set duration
                    in_list = []
                    in_list.append(rmv_cal_dub_in)
                    in_list.append(rem_msg_dub_in)
                    in_list.append(rem_mail_dub_in)
                    in_merge = in_list
                    in_merge = e.merge(in_list)


                        #......................
                    out_list = []
                    out_list.append(rmv_cal_dub_out)
                    out_list.append(rem_msg_dub_out)
                    out_list.append(rem_mail_dub_out)
                    z = out_list
                    outt = e.merge_out(z)
            #..........represent incoming outgoing both.............
                    r =[]
                    g = []
                    for item in in_merge:
                     for o in outt:
                         if (cmp(int(item['from']), int(o['from']))) == 0:
                            r = item
                            g = o
                            NUM = item['from']
                            center= (1,1,1)
                            pos= e.addball(NUM)
                            k = item['key']
                            colour1 = e.colours(k)
                                #print colour1
                                #print colour1
                                #k = o['key']
                                #colourr2 = e.colours(k)
                            if item['duration'] <= 10:
                                d = 0.1
                            if item['duration'] > 10:
                                d = item['duration']
                                d = d/10
                                d = d*(0.1)
                            e.drawLine(center,pos,colour1,d)

                           # if o['duration'] <= 10:
                            # m = 0.1
                            #if o['duration'] > 10:
                             # m = o['duration']
                              # m = m/10
                               # m = m*(0.1)
                            #e.drawLine(center,pos,colourr2,m)
                            in_merge.remove(r)
                            outt.remove(g)


                 #......for incoming use any other line seg........................
                    for i in in_merge:
                        center= (1,1,1)
                        NUM = i['from']
                        pos= e.addball(NUM)
                        k = i['key']
                        if i['duration'] <= 10:
                            d = 0.1
                        if i['duration'] > 10:
                            d = i['duration']
                            d = d/10
                            d = d*(0.1)

                        colour2 = e.colours(k)
                        e.drawLine(center,pos,colour2,d)


                 #..........Use different style of line to draw outgoing
                    for l in outt:
                        center= (1,1,1)
                        NUM = l['from']
                        pos= e.addball(NUM)
                        k = l['key']
                        if l['duration'] <= 10:
                            d = 0.8
                        if l['duration'] > 10:
                            d = l['duration']
                            d = d/10
                            d = d*(0.8)

                        colour3 = e.colours(k)
                        e.drawLine(center,pos,colour3,d)
        e.model = True
        e.text = True
        e.link = True
        e.person = True
        if d== 0:
            e.person = False