Hello! I have no idea how to solve one problem:
And with the help of lua script I devide multi-chunk in separate strings Code of LUA script:
But the problem is that in one multi-chunk frame one field ( Somebody may be knows how to write listener in LUA to get NULL for the field even if this field does not exist in one of the protocol in multi-chunk frame? As the result a want to have from lua the following array for field “
But now a have only following:
asked 18 Aug ‘15, 04:17 domeno edited 18 Aug ‘15, 04:49 Hadriel |
2 Answers:
Try something like this - this doesn't do your whole thing, but should give you the idea:
answered 19 Aug ‘15, 20:19 Hadriel |
See the answer to question 43543 which is similar. answered 18 Aug '15, 05:12 Hadriel Hadriel, thanks for the reply. I am a little bit newbie in LUA and WireShark. That’s why I could not understand how to read every protocol in one frame successively. Here is the code of LUA script for my experiments: local logfile = "en_"..os.date("%Y%m%d%H%M%S")..".lua" io.output(logfile) local gsm_map_tbcd_digits = Field.new("gsm_map.tbcd_digits") local m3ua = Listener.new(nil,"m3ua") function m3ua.packet(pinfo,tvb) local Mas_gsm_map_tbcd_digits = {gsm_map_tbcd_digits()} io.write("imsi:" .. tostring( Mas_gsm_map_tbcd_digits[0]) .."\n") io.write("imsi:" .. tostring( Mas_gsm_map_tbcd_digits[1]) .."\n") io.write("imsi:" .. tostring( Mas_gsm_map_tbcd_digits[2]) .."\n") io.write("imsi:" .. tostring( Mas_gsm_map_tbcd_digits[3]) .."\n") io.write("imsi:" .. tostring( Mas_gsm_map_tbcd_digits[4]) .."\n") io.write("imsi:" .. tostring( Mas_gsm_map_tbcd_digits[5]) .."\n") io.write("imsi:" .. tostring( Mas_gsm_map_tbcd_digits[6]) .."\n") io.write("imsi:" .. tostring( Mas_gsm_map_tbcd_digits[7]) .."\n") End I run it by the command: Tshark –r /file.pcap –X lua_script:devide_imsi.lua As far as I can judge I get the whole array of all “gsm_map.tbcd_digits” write in the beginning of the function m3ua.packet. Would you be so kind and explain how to read every protocol in one frame successively? May be you some usefull examples?! Thanks for any help! (18 Aug '15, 06:43) domeno Oh yeah I keep forgetting the taps aren't invoked until after the whole packet's been dissected. Crap. Hmmm... the only way to do it might be to create a "proxy" Lua protocol, remove the " Can you share an example capture file for this problem? I might have some time later today to see if I can get the info you want using a Lua script. (18 Aug '15, 07:30) Hadriel Hadriel, thanks for the reply. Could you please give me an advise how can i share the pcap file with example for you? Is it possible to send you this file personally as this file has some private information? Thanks for any help! (19 Aug '15, 05:23) domeno Sure, my email is either [email protected], or [email protected] (19 Aug '15, 05:31) Hadriel Wiresharks export-pdu function can do SCTP dechunking if that's of any use, this patch in gerrit implements it for tshark but I think the work on it may have stalled https://code.wireshark.org/review/#/c/5890/ (19 Aug '15, 07:59) Anders ♦ |
Hadriel,
Could you please explain for what is calling “tcap_dissector” inside of “proxy.dissector” (artificial dissector for uor needs)?
Thanks for help!
If you look at the bottom of the script, you’ll see I’m getting the “sccp.ssn” dissector table, and then from within that I’m getting the dissector registered for SCCP SSN number 6, and I’m replacing it with this “proxy” protocol’s dissector. (in fact, I’m replacing the whole 6-9 range of SSNs) That dissector I’m replacing is the TCAP dissector - the one written in C-code built into wireshark.
So basically whenever SCCP goes to decode a message of SSN 6-9, instead of invoking TCAP like it would normally do, it invokes our proxy dissector instead. So within the proxy dissector I invoke the original TCAP dissector with the “
tcap_dissector:call(tvbuf,pinfo,root)
” line.The reason I’m doing all that is that I can see if the number of GSM MAP TBCD fields has changed. If it’s change, then we’ve got a new TBCD in the message to save; if it has not changed, then I add a “<none>” entry instead.
The reason I’m replacing the range 6-9 is that those are the GSM MAP SSN numbers, I think.