def run(self):
     while 1:
         debut = datetime.now()
         infos = []
         a = sniff(count = 1, )[0]
         isIP = self.returnIP(a)
     #---------------------------------------------
         #Récupération ipSource / ipDst
     #---------------------------------------------
         if isIP != 99:
             infos.append(a[IP].src)
             infos.append(a[IP].dst)
         else:
             infos.append(0)
             infos.append(0)
         if infos[0] == self.host or infos[1] == self.host or self.host == '-a':
     #---------------------------------------------
         #Récupération Raw
     #---------------------------------------------
             raw = self.returnRaw(a)
             #si c'est TCP
             if self.isTCP(a) != 99 and self.TCP == 1:
                 msg = '[\033[31mTCP\033[00m]\033[34m '
                 msg += infos[0] + '\033[00m:\033[35m' + str(a[TCP].sport) + '\033[00m -> \033[34m' + infos[1] + '\033[00m:\033[35m' + str(a[TCP].dport) + '\033[00m/ \033[31mflags\033[00m : \033[35m' + str(a[TCP].flags) + '\033[00m / \033[31mseq\033[00m = \033[35m' + str(a[TCP].seq) + '\033[00m\033[31m ack \033[00m= \033[35m' + str(a[TCP].ack) + '\033[00m'
                 if raw != 99:
                     msg += '/\033[31m Raw \033[00m:\033[01m ' + raw.load + '\033[00m'
                     print msg
         #si c'est UDP
             elif self.isUDP(a) != 99 and self.UDP == 1:
                 msg = '[\033[31mUDP\033[00m]\033[34m '
                 msg += infos[0] + '\033[00m:\033[35m' + str(a[UDP].sport) + '\033[00m -> \033[34m' + infos[1] + '\033[00m:\033[35m' + str(a[UDP].dport)
                 if raw != 99:
                     msg += '/\033[31m Raw \033[00m:\033[01m ' + raw.load + '\033[00m'
                     print msg
         #Si c'est ICMP
             elif self.isICMP(a) != 99 and self.ICMP == 1:
                 msg = '[\033[31mICMP\033[00m]\033[32m '
                 msg += infos[0] + ' -> ' + infos[1] + ' / '
                 msg += 'type = ' + self.getICMPType(a) + '\033[00m'
                 fin = datetime.now()
                 print fin-debut
                 print msg
         #Si c'est ARP
             elif self.isARP(a) != 99 and self.ARP == 1:
                 msg = '[\033[31mARP\033[00m] '
                 msg += '\033[34m' + a[ARP].psrc + '\033[00m (\033[35m' + a[Ether].src + '\033[00m) -> \033[34m' + a[ARP].pdst + '\033[00m (\033[35m' + a[Ether].dst + '\033[00m) / Op = \033[01m' + self.getARPop(a) + '\033[00m'
                 print msg
        elif t == 5:
            return 'Redirection'
        elif t == 8:
            return 'Echo-request'
        elif t == 11:
            return 'Timeout'
        elif t == 12:
            return 'Entête erronée'
        elif t == 13:
            return 'Demande d\'heure'
        elif t ==  14:
            return 'Reponse heure'
        elif t == 15:
            return 'Demande IP'
        elif t == 16:
            return 'Reponse IP'
        elif t == 17:
            return 'Demande masque de sous réseau'
        elif t == 18:
            return 'Reponse masque de sous réseau'
if __name__ == '__main__':
    if len(sys.argv) < 3:
        print 'Syntaxe : !/.py -filtre -host'
        print '-a = all'
        print 'filtres : tcp udp icmp arp'
        exit(0)
    filtre = sys.argv[1]
    host = sys.argv[2]
    print datetime.now()
    a = snifferBot(filtre,host)