2019-12-02 10:21 AM
I'm working on a packet parser that I could use some Community help with.
Essentially I'm trying to find a token and then register that token as meta in an existing key. Additionally, if more than one token is found in the session - register the others as well.
Here's what I've done thus far - but it's not producing the expected results:
+++++++++++++++++++++++++
local lua_findme = nw.createParser("lua_findme", "Finding tokens")
lua_findme:setKeys({
nwlanguagekey.create("threat.desc")
})
function lua_findme:magic(token)
nw.createMeta(self.keys["threat.desc"], token)
end
lua_findme:setCallbacks({
["badPassword"] = lua_findme.magic,
["SupportedEncryption"] = lua_findme.magic,
["AccountType"] = lua_findme.magic,
})
+++++++++++++++++++++++++
Essentially I've got a list of tokens that I want to be on the look out for and I want the parser to register meta for each finding. Ex: the parser should create meta 'badPassword' under threat.desc && also register 'AccountType' under threat.desc if it is found in that session.
Thanks in advance!
2019-12-02 10:40 AM
The value passed to the meta-callback function (to the variable "token") will be an index in the table self.tokens. So to get the actual token use self.tokens[token], e.g.,
nw.createMeta(self.keys["threat.desc"], self.tokens[token])
2019-12-02 12:03 PM
Thanks Bill
So after implementing the suggested change you provided, I'm seeing meta displaying as '1' or '2' under threat.desc vs. the token value itself. Any idea what may be causing that?
2019-12-02 12:20 PM
That doesn't seem right. "1", "2", etc is the index - the actual value of "token", and the meta that would have been registered from your original parser above.
Can you post your entire current parser?
2019-12-10 09:42 AM
Thanks Bill - I figured out my issue. Thanks for your assistance with this.