Hello! Is wireshark able to decode ms sql queries? (sql 2005 server). With mysql - no problems:
But for SQl there is no smth like "tcp.port==1433,mssql" and "fields -e mssql.query". Or it doesn't work with TDS packets? I just need to extract clear SQL-queries from traffic... asked 23 Oct '17, 05:53 alex31337 |
One Answer:
The protocol used by MS SQL Server is TDS, so all filter fields are "tds.xxx" rather than "mssql" answered 23 Oct '17, 06:02 grahamb ♦ showing 5 of 14 show 9 more comments |
So, it will be: tshark -i lo -d tcp.port==1433,tds -T fields -e tds.query ???
You shouldn't need the
-d tcp.port==1433,tds
as the tds dissector already registers for that port.There is a
tds.query
field, but the comment next to it says "SQLBatch Stream", so it may or may not do what you want.And where can I find list of available fields? (their correct syntax)
https://www.wireshark.org/docs/dfref/t/tds.html
Or
tshark -G fields
, although that doesn't limit to a particular dissector, or show version ranges.But anyway, IT'S POSSIBLE to grab pure MS sql-queries (that clients send to server) via Tshark, is it right? (traffic not encrypted, only TDS)
Presumably, hence the inclusion of a TDS dissector.
WTF!?
Works for me (as in doesn't show an error). What version of tshark?
If I induce an error I get this kind of output:
TShark 1.12.1
I've updated to 2.4.2, now "-T fields -e tds.query" doesnt print error! But I see no SQL-instructions, but blank lines -( Can you see SELECT,INSERT, UPDATE etc after you print "tshark.exe -r capture.pcapng -T fields -e tds.query"?
That's EOL-ed over a year ago. Please find a way to upgrade.
Without seeing your actual file, it is just guessing, but could it be that you have also other than
tds
packets in the file? If so, add a display filter-Y tds.query
to your command line, so that other packets are not displayed. For packets which don't contain a required field, tshark prints a blank line.As I mentioned, the comment in the code next to tds.query mentions "SQL Batch Stream", so I'm not sure if the field shows all SQL query strings.
I don't have a tds capture to test. maybe you can share one with us to help out?