Results 1 to 3 of 3

Thread: QTcpSocket Sniffer

  1. #1
    Join Date
    Oct 2015
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QTcpSocket Sniffer

    Hello Everyone,

    I have been tasked to write a TCP sniffer that can run off the command line and can be tuned to view/dissect specific TCP messages sent between a client and server. I know there are such tools out there that will sniff the packets for me (e.g. wireshark) but we need something that doesn't need to be installed onto a system.

    I chose to use Qt to write the program. As I have progressed through this I began wondering if Qt has a way for me to sniff TCP messages from a specific port without actually pulling the data off the port so that the actual consumer can consume the data it needs - I just want to display what has been sent. Do you know if the QTcpSocket::readData/readAll functions and the like will actually clear the port of any data or will it allow the specific consumer to still access the data?

    Hopefully this is clear!

    Thanks,

    Keith

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QTcpSocket Sniffer

    Wireshark has a portable version that does not require installation on Windows (it does require admin rights, as would your own tool). You could probably make a portable linux version that bundles some of the libraries or build a statically linked version. http://portablelinuxapps.org/ and https://www.wireshark.org/#download

    You need to open a raw network interface in promiscuous mode so that all traffic that interface sees can be read (udp, tcp, icmp, whatever). Qt does not expose anything that will do that for you. Alternate approaches depend strongly on what traffic you need to capture and what control you have over the target app/machine.

  3. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QTcpSocket Sniffer

    You might also want to look at pcap https://en.wikipedia.org/wiki/Pcap

    Cheers,
    _

Similar Threads

  1. Url sniffer like ngrep?
    By realdarkman71 in forum Newbie
    Replies: 0
    Last Post: 18th December 2011, 16:32
  2. Please help me...I want to do a Sniffer
    By Raymond in forum Qt Programming
    Replies: 0
    Last Post: 21st September 2009, 04:36
  3. QThread based Sniffer
    By hbtdtg in forum Qt Programming
    Replies: 1
    Last Post: 2nd August 2009, 12:23
  4. Qextserialport.. sniffer?
    By triperzonak in forum Qt Programming
    Replies: 3
    Last Post: 7th November 2008, 03:30
  5. QT4.2.2 and QTcpSocket
    By Nyphel in forum Qt Programming
    Replies: 13
    Last Post: 11th March 2007, 11:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.