예제 #1
0
파일: Client.py 프로젝트: mgold/Packets
 def sendMail(self):
     mail = Packet(self.screen, self.pos[0], self.pos[1])
     mail.color = self.color
     mail.protocol = "SMTP"
     mail.source = self.IP
     mail.sender = self.name
     mail.destination = self.names[self.corespondent]
     self.link.send(mail, self)
예제 #2
0
파일: Client.py 프로젝트: mgold/Packets
 def update(self):
     if self.corespondent not in self.names:
         if self.timer == 0:
             request = Packet(self.screen, self.pos[0], self.pos[1])
             request.color = (191, 128, 128)
             request.protocol = "DNS Request"
             request.source = self.IP
             request.destination = DNSIP()
             request.request = self.corespondent
             self.link.send(request, self)
             self.timer = 250
         else:
             self.timer -= 1
예제 #3
0
파일: DNS.py 프로젝트: mgold/Packets
 def receive(self, packet):
     if packet.protocol == "OSPF":
         pass
     elif packet.protocol == "DNS Request":
         respacket = Packet(self.screen, self.pos[0], self.pos[1])
         respacket.protocol = "DNS Response"
         respacket.destination = packet.source
         respacket.color = self.packetColor
         respacket.source = self.IP
         try:
             respacket.response = packet.request, self.names[packet.request]
             respacket.code = 200
         except KeyError: #Yes, I'm using HTTP codes for DNS. Shh.
             respacket.response = None
             respacket.code = 404
         packet.link.send(respacket, self)
예제 #4
0
파일: DNS.py 프로젝트: mgold/Packets
 def update(self):
     if self.timer == 0:
         packet = Packet(self.screen, self.pos[0], self.pos[1])
         packet.color = (128, 255, 128)
         packet.payload = {}
         packet.protocol = "OSPF"
         for link in self.links:
             packetCopy = copy(packet)
             interface = self.interfaces[link]
             packetCopy.source = interface
             packetCopy.destination = interface.broadcast()
             packetCopy.payload[DNSIP()] = (0, link)
             link.send(packetCopy, self)
         self.timer = 250
     else:
         self.timer -= 1
예제 #5
0
파일: Router.py 프로젝트: mgold/Packets
 def update(self):
     if self.timer == 0:
         packet = Packet(self.screen, self.pos[0], self.pos[1])
         packet.color = self.packetColor
         packet.payload = {}
         packet.protocol = "OSPF"
         for link in self.links:
             packetCopy = copy(packet)
             for subnetIP in self.table:
                 if self.table[subnetIP][1] != link: #poisoned reverse
                     interface = self.interfaces[link]
                     packetCopy.source = interface
                     packetCopy.destination = interface.broadcast()
                     packetCopy.payload[subnetIP] = (self.table[subnetIP][0], link)
             link.send(packetCopy, self)
         self.timer = 250
     else:
         self.timer -= 1