ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-bugs: [Wireshark-bugs] [Bug 2845] New: lua data-text-lines issue

Date: Tue, 2 Sep 2008 04:28:39 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2845

           Summary: lua data-text-lines issue
           Product: Wireshark
           Version: 1.0.0
          Platform: PC
        OS/Version: Ubuntu
            Status: NEW
          Severity: Major
          Priority: High
         Component: TShark
        AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
        ReportedBy: riccardo.roasio@xxxxxxxxx


Build Information:
TShark 1.0.0

Copyright 1998-2008 Gerald Combs <gerald@xxxxxxxxxxxxx> and contributors.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Compiled with GLib 2.16.1, with libpcap 0.9.8, with libz 1.2.3.3, with POSIX
capabilities (Linux), with libpcre 7.4, without SMI, with ADNS, with Lua 5.1,
with GnuTLS 2.0.4, with Gcrypt 1.2.4, with MIT Kerberos.

Running on Linux 2.6.24-19-generic, with libpcap version 0.9.8.

Built using gcc 4.2.3 (Ubuntu 4.2.3-2ubuntu7).

--
Trying to execute this code using this tshark command:

 tshark -X lua_script:http.lua  -f "port 80" -q


-- http.lua

do
        ip_addr_extractor=Field.new("ip.addr")
        http_request_extractor=Field.new("http.request")
        http_response_extractor=Field.new("http.response")
        http_notification_extractor=Field.new("http.notification")
        tcp_port_extractor=Field.new("tcp.port")
        http_uri_extractor=Field.new("http.request.uri")
        http_method_extractor=Field.new("http.request.method")
        http_code_extractor=Field.new("http.response.code")
        http_host_extractor=Field.new("http.host")
        http_content_type_extractor=Field.new("http.content_type")
        http_user_agent_extractor=Field.new("http.user_agent")
        http_request_version_extractor=Field.new("http.request.version")
        http_response_data_extractor=Field.new("data-text-lines")
        http_connection_extractor=Field.new("http.connection")
        http_date_extractor=Field.new("http.date")
        http_server_extractor=Field.new("http.server")
        http_content_length_extractor=Field.new("http.content_length")
        http_last_modified_extractor=Field.new("http.last_modified")

        http=Listener.new()

        function http.packet(pinfo)

                print("")

                local ip_src,ip_dst=ip_addr_extractor()
                local tcp_src,tcp_dst=tcp_port_extractor()
                local http_request=http_request_extractor()
                local http_response=http_response_extractor()
                local http_method=http_method_extractor()
                local http_uri=http_uri_extractor()
                local http_code=http_code_extractor()
                local http_host=http_host_extractor()
                local http_content_type=http_content_type_extractor()
                local time=pinfo.abs_ts
                local http_user_agent=http_user_agent_extractor()
                local http_request_version=http_request_version_extractor()
                local http_response_data=http_response_data_extractor()
                local http_connection=http_connection_extractor()
                local http_date=http_date_extractor()
                local http_server=http_server_extractor()
                local http_content_length=http_content_length_extractor()
                local http_last_modified=http_last_modified_extractor()

               if http_request then
                        print("**********  REQUEST  **********")
                else
                        if http_response then
                                print("**********  RESPONSE  **********")
                       else
                                if http_notification then
                                        print("**********  NOTIFICATION 
**********")
                                end
                        end

                end


                if http_request then
                        print("TIME : ",time)
                        print("FROM : ",ip_src,"[",tcp_src,"]")
                        print("TO : ",ip_dst,"[",tcp_dst,"]")
                        print("METHOD : ",http_method)
                        print("URI : ",http_uri)
                        print("HOST : ",http_host)
                        print("UA : ",http_user_agent)
                        print("VERSION : ",http_request_version)

                else
                        if http_response then
                                print("TIME : ",time)
                                print("FROM : ",ip_src,"[",tcp_src,"]")
                                print("TO : ",ip_dst,"[",tcp_dst,"]")
                                print("RESPONSE : ",http_code)
                                print("CONNECTION : ",http_connection)
                                print("C.TYPE : ",http_content_type)
                                print("C.LENGTH : ",http_content_length)
                                print("DATA : ",http_response_data)
                                print("DATE : ",http_date)
                                print("LAST MODIFIED : ",http_last_modified)
                                print("SERVER : ",http_server)
                        end
                end

                print("")
        end

end


crash with the following error:


**
** ERROR:(ftype-tvbuff.c:133):val_repr_len: assertion failed: (rtype ==
FTREPR_DFILTER)
Aborted


-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.