Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How can I prepare TCP Pckets and send them
Forum Updated to NodeBB v4.3 + New Features

How can I prepare TCP Pckets and send them

Scheduled Pinned Locked Moved General and Desktop
8 Posts 5 Posters 3.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    CuteKQ
    wrote on last edited by
    #1

    Hi all... Im trying to do such a exercise which in I need to prepare my own TCP packet and send it to target...
    I need some documentation how can I do that, and if there any existence classes in Qt libraries for this purpose.

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tobias.hunger
      wrote on last edited by
      #2

      I am not aware of a way to hand-craft TCP packets and send them in Qt. You will need platform APIs for that.

      You can of course get a QTcpSocket and send data through it. But that will create packages as it sees fit for you, splitting up your data as needed and sending out one or more packages with it to the other side. This approach does not allow to mess with the header data of course.

      What are you trying to do? You asked about man in the middle attacks before, now you want to meddle with TCP packets. Are you trying to hack people?

      1 Reply Last reply
      0
      • C Offline
        C Offline
        CuteKQ
        wrote on last edited by
        #3

        What I'm trying to do is perform an automated deep penetration testing, which indeed might look like hacking. What I need here is exactly how to invoke platform API's pertaining to the lower network layer. Does Qt provide an encapsulation or abstraction of these API's or am I wasting my time looking?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tobias.hunger
          wrote on last edited by
          #4

          Any you want to write that yourself? There are several tools out there, doing that. Why don't you use and extend one of them? They have lots of code ready to use and APIs optimized for the penetration tests.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            CuteKQ
            wrote on last edited by
            #5

            I mentioned before my friend, I'm doing some exercises for myself.

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DerManu
              wrote on last edited by
              #6

              [quote author="CuteKQ" date="1361007200"]I mentioned before my friend, I'm doing some exercises for myself.[/quote] Then why don't you see it as an exercise to find out things like this yourself via studying the documentation carefully? This skill is much more important for aspiring crackers than fiddling with packet headers, you see.

              1 Reply Last reply
              0
              • V Offline
                V Offline
                vidar
                wrote on last edited by
                #7

                The job is not simply done by "assembling a TCP Packet", you would need to implement a TCP Stack which is somehow compliant to the behavior of a real TCP/IP Stack, you will e.g. need to handle TCP Retransmissions, Acknowledgements (remember, TCP is a "reliable" protocol) etc. etc. etc.
                However, subclassing QAbstractSocket might help, in case you are really crazy enough to try this.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  MuldeR
                  wrote on last edited by
                  #8

                  The idea of TCP is that it provides a "byte stream" abstraction to the application. Sure, on the Network layer the data has to be encapsulated into IP packets. But the TCP implementation does that automatically for you, e.g. by using Nagle's algorithm! It also takes care of re-sending lost packets, ensuring the right order of packets that arrive out-of-order (sequence numbers) and many other things. There's even a rather complex congestion control mechanism implemented in TCP. The application doesn't "see" any of that. The application will simply write bytes into the TCP connection or read bytes from it. That is no different if you use the TCP implementation of the operating system directly. It's because of how the "service interface" of TCP is defined!

                  Consequently, if you want the control over individual network packets, you either have to use a "message oriented" transport protocol, such as UDP, instead of the "connection oriented" TCP or you have to work directly one the Network layer, i.e. work with "raw" IP packets and implement the Transport layer yourself.

                  My OpenSource software at: http://muldersoft.com/

                  Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                  Go visit the coop: http://youtu.be/Jay...

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved