- Starting to get better, almost got terms out of initial knowledge.
This commit is contained in:
parent
65920fb7fc
commit
b436d4923a
@ -8,7 +8,7 @@ def unfold(arg):
|
|||||||
|
|
||||||
def intruderKnowledge(x):
|
def intruderKnowledge(x):
|
||||||
print "Intruder knowledge"
|
print "Intruder knowledge"
|
||||||
unfold(x)
|
print x[0], str(x[1])
|
||||||
|
|
||||||
def scenario(x):
|
def scenario(x):
|
||||||
print "Scenario",x,"ignoring for now"
|
print "Scenario",x,"ignoring for now"
|
||||||
|
@ -46,14 +46,32 @@ def ifParse (str):
|
|||||||
Basic = MatchFirst([ Variable, Constant, Number ])
|
Basic = MatchFirst([ Variable, Constant, Number ])
|
||||||
|
|
||||||
Message = Forward()
|
Message = Forward()
|
||||||
|
|
||||||
|
def parseType(s,l,t):
|
||||||
|
term = t[0][1]
|
||||||
|
term.setType(t[0][0])
|
||||||
|
return [term]
|
||||||
|
|
||||||
TypeInfo = oneOf ("mr nonce pk sk fu table").setParseAction(lambda s,l,t: [ Term.TermConstant(t[0]) ])
|
TypeInfo = oneOf ("mr nonce pk sk fu table").setParseAction(lambda s,l,t: [ Term.TermConstant(t[0]) ])
|
||||||
TypeMsg = Group(TypeInfo + lbr + Message + rbr).setParseAction(lambda s,l,t: [ t[3].setType(t[1]) ])
|
TypeMsg = Group(TypeInfo + lbr + Message + rbr).setParseAction(parseType)
|
||||||
|
|
||||||
|
def parseCrypt(s,l,t):
|
||||||
|
# Crypto types are ignored for now
|
||||||
|
return [Term.TermEncrypt(t[0][2],t[0][1])]
|
||||||
|
|
||||||
CryptOp = oneOf ("crypt scrypt c funct rcrypt tb")
|
CryptOp = oneOf ("crypt scrypt c funct rcrypt tb")
|
||||||
CryptMsg = Group(CryptOp + lbr + Message + com + Message + rbr).setName("crypt")
|
CryptMsg = Group(CryptOp + lbr + Message + com + Message + rbr).setParseAction(parseCrypt)
|
||||||
|
|
||||||
|
def parseSMsg(s,l,t):
|
||||||
|
return [Term.TermEncrypt(t[0][1],Term.Termconstant("succ") )]
|
||||||
|
|
||||||
SMsg = Group(Literal("s") + lbr + Message + rbr)
|
SMsg = Group(Literal("s") + lbr + Message + rbr)
|
||||||
Message << Group(Or ([TypeMsg, CryptMsg, SMsg, Basic]) +
|
|
||||||
Optional(Literal("'")) )
|
def parsePrime(s,l,t):
|
||||||
|
# for now, we simply ignore the prime (')
|
||||||
|
return [t[0][0]]
|
||||||
|
|
||||||
|
Message << Group(Or ([TypeMsg, CryptMsg, SMsg, Basic]) + Optional(Literal("'"))).setParseAction(parsePrime)
|
||||||
|
|
||||||
# Fact section
|
# Fact section
|
||||||
Request = Group("request" + btup(4))
|
Request = Group("request" + btup(4))
|
||||||
|
Loading…
Reference in New Issue
Block a user