Ejemplo n.º 1
0
    def unloadAgent(self):

        _privkey = getPrivateKey(self.nextip)
        _key = _privkey.decrypt(self.key)

        PADDING='{'
        encryptor = AES.new(_key, AES.MODE_CBC, self.agent[:16])

        self.agent = cPickle.loads(encryptor.decrypt(self.agent).strip(PADDING)[16:])
         
        if(isinstance(self.agent, DiskAgent)):
            return self.agent
        else:
            print "failed to get agent"
            print "(you are not meant to get this?)"
            return -1
Ejemplo n.º 2
0
        masterip = cp.get("master", "masterip")
        print "Masterip:", masterip
        hops = cp.getint("itinerary", "hops")
        while hops > 0:
            attrname = "node" + str(i)
            groute.append(cp.get("itinerary", attrname))
            hops = hops - 1
            i = i + 1
    else:
        print "Can not find required configuration file\n"
        sys.exit(1)


#### main program starts
mafinit("maf.conf")

#### create new agent
agentx = DiskAgent(masterip, groute)
#### Sign the agent

binstr = cPickle.dumps(agentx.compLocal, 1)
_privkey = getPrivateKey(masterip)
_pubkey = getPublicKey(masterip)
agentx.serverSignature = _privkey.sign(binstr, b"")[0]

#### display some information related to this agent
agentx.dispInfo()

#### migrate this agent
migrate(agentx)