- Nice, we can almost extract the messages now.
This commit is contained in:
parent
cb62517cd9
commit
8dd9dfb901
@ -33,7 +33,7 @@ class Composed(Message):
|
|||||||
self.right = m2
|
self.right = m2
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return str(self.left) + str(self.right)
|
return "(" + str(self.left) + "," + str(self.right) + ")"
|
||||||
|
|
||||||
class PublicCrypt(Message):
|
class PublicCrypt(Message):
|
||||||
def __init__ (self,key,message):
|
def __init__ (self,key,message):
|
||||||
@ -85,19 +85,44 @@ class TimeFact(Fact):
|
|||||||
return "Time " + Fact.__repr__(self)
|
return "Time " + Fact.__repr__(self)
|
||||||
|
|
||||||
class MessageFact(Fact):
|
class MessageFact(Fact):
|
||||||
|
def __init__(self,t):
|
||||||
|
global firstone
|
||||||
|
|
||||||
|
self.step = t[0]
|
||||||
|
self.realsender = t[1]
|
||||||
|
self.claimsender = t[2]
|
||||||
|
self.recipient = t[3]
|
||||||
|
self.message = t[4]
|
||||||
|
self.session = t[5]
|
||||||
|
|
||||||
|
### TEST
|
||||||
|
if firstone:
|
||||||
|
print self.spdl()
|
||||||
|
#firstone = False
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
res = "Message Fact:"
|
res = "Message Fact:"
|
||||||
res += "\nStep " + str(self[0])
|
res += "\nStep " + str(self.step)
|
||||||
res += "\nRealSender " + str(self[1])
|
res += "\nRealSender " + str(self.realsender)
|
||||||
res += "\nClaimSender " + str(self[2])
|
res += "\nClaimSender " + str(self.claimsender)
|
||||||
res += "\nRecipient " + str(self[3])
|
res += "\nRecipient " + str(self.recipient)
|
||||||
res += "\nMessage " + str(self[4])
|
res += "\nMessage " + str(self.message)
|
||||||
res += "\nSession " + str(self[5])
|
res += "\nSession " + str(self.session)
|
||||||
return res + "\n"
|
return res + "\n"
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return str(self)
|
return str(self)
|
||||||
|
|
||||||
|
def spdl(self):
|
||||||
|
res = "send_" # TODO this might be a read!
|
||||||
|
res += str(self.step)
|
||||||
|
res += "(" + str(self.claimsender)
|
||||||
|
res += "," + str(self.recipient)
|
||||||
|
res += ", " + str(self.message)
|
||||||
|
res += " );\n"
|
||||||
|
return res
|
||||||
|
|
||||||
class State(list):
|
class State(list):
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "State<" + list.__repr__(self) + ">"
|
return "State<" + list.__repr__(self) + ">"
|
||||||
@ -144,14 +169,6 @@ class InitialRule(Rule):
|
|||||||
return "Initial " + Rule.__str__(self)
|
return "Initial " + Rule.__str__(self)
|
||||||
|
|
||||||
class MessageRule(Rule):
|
class MessageRule(Rule):
|
||||||
def __init__(self,l,r):
|
|
||||||
global firstone
|
|
||||||
|
|
||||||
Rule.__init__(self,l,r)
|
|
||||||
if firstone:
|
|
||||||
print str(self)
|
|
||||||
firstone = False
|
|
||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return "Message " + Rule.__str__(self)
|
return "Message " + Rule.__str__(self)
|
||||||
|
@ -94,8 +94,8 @@ def ruleParser ():
|
|||||||
Atomic = Or(TypedConstant, Variable)
|
Atomic = Or(TypedConstant, Variable)
|
||||||
|
|
||||||
### TEST
|
### TEST
|
||||||
print Atomic.parseString("mr(Cas)'")
|
#print Atomic.parseString("mr(Cas)'")
|
||||||
print Atomic.parseString("nonce(Koen)")
|
#print Atomic.parseString("nonce(Koen)")
|
||||||
|
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
# Messages
|
# Messages
|
||||||
|
Loading…
Reference in New Issue
Block a user