示例#1
0
文件: host.py 项目: Evnsan/MAC0448
class Host(object):
    def __init__(self, nome):
        super(Host, self).__init__()
        self.modoVerboso = False 

        self.nome = nome
        self.ip = ''
        self.ipRoteador = ''
        self.ipDnsServidor = ''
        self.sniffer = None
        self.enlace = None
        self.buff = []
        self.papel = ''
        self.comandos = []
        self.nomeAplicacao = None

        #### funcoes das camadas
        self.cmdaRedes = CamadaRedes(self)
        self.cmdaAplicacao = CamadaAplicacao()
        self.cmdaTransporte = CamadaTransporte( self.cmdaRedes, self.cmdaAplicacao)
        self.cmdaRedes.setCamadaTransporte(self.cmdaTransporte)
        self.cmdaAplicacao.setCamadaTransporte(self.cmdaTransporte)

    
    def __str__(self):
        return "HOST: " + str(self.nome) + " IP(" + str(self.ip) + ")"
    
    def __repr__(self):
        return "HOST " + str(self.nome) + " IP=" + str(self.ip)

    
    def setIp(self, args):
        if not isinstance(args, basestring):
            try:
                self.ipDnsServidor = args[2]
                self.ipRoteador = args[1]
                self.ip = args[0]
                self.cmdaRedes.setIp(self.ip)
            except IndexError, msg:
                print ("HOST(SETIP) - Hostname = " + self.nome 
                       + ": Argumentos Insuficientes.")
                print "    " + str(msg)
        else:
示例#2
0
文件: host.py 项目: Evnsan/MAC0448
    def __init__(self, nome):
        super(Host, self).__init__()
        self.modoVerboso = False 

        self.nome = nome
        self.ip = ''
        self.ipRoteador = ''
        self.ipDnsServidor = ''
        self.sniffer = None
        self.enlace = None
        self.buff = []
        self.papel = ''
        self.comandos = []
        self.nomeAplicacao = None

        #### funcoes das camadas
        self.cmdaRedes = CamadaRedes(self)
        self.cmdaAplicacao = CamadaAplicacao()
        self.cmdaTransporte = CamadaTransporte( self.cmdaRedes, self.cmdaAplicacao)
        self.cmdaRedes.setCamadaTransporte(self.cmdaTransporte)
        self.cmdaAplicacao.setCamadaTransporte(self.cmdaTransporte)