Thread: Injecting into a TCP stream?

  1. #1
    Registered User
    Join Date
    Jul 2003
    Posts
    110

    Injecting into a TCP stream?

    Im not sure if Im using the correct lingo but here I go.

    I have a program that connects to the server thru port 3459. Its just a chat program.

    What I want to do is write another program that sends information to the server and client. So it might look like this

    First the model without the program.


    Client ---- Server

    Now with my program called X
    X
    | |
    | |
    | |
    Client----Server

    So when I want I cant send packets to the client or server thru the same TCP stream?

    Is this possiable? Whats the lingo for this?

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    197
    Do you want the client to connect to program X, and through it then connect to the server? If so, that would be a proxy.
    If you want program X to put itself in the middle of an existing connection, that would be something I don't want to cover.
    If any part of my post is incorrect, please correct me.

    This post is not guarantied to be correct, and is not to be taken as a matter of fact, but of opinion or a guess, unless otherwise noted.

  3. #3
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    If you want program X to put itself in the middle of an existing connection, that would be something I don't want to cover.
    ...and something that is probably against the board guidelines to discuss.

  4. #4
    Registered User
    Join Date
    May 2005
    Posts
    4
    ok so I learned about this in a networking class as "session hijacking"

    i'm not sure what aspect of it you want to do...

    if you want to replace information from the client to the server, or visa-versa you need to first "listen" to hear the random TCP sequence numbers being exchanged on the 3-way handshake

    you can then create TCP packets with appropriate sequence numbers and ACK numbers to "hijack" the session.

    If you want to be a passive listener... look up "man in the middle"

    I don't believe this kind of discussion should be against board policy, after all, it is network security discussion... if no one ever talked about it, we wouldn't be able to make our programs so secure Keep your friends close... but your enemies closer

  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    If you are on the same network as one of the host: use ARP spoofing to place yourself in the middle between them. Then do some research about the TCP protocol and you should with some effort be able to insert data into the TCP stream

    It's easier if you can perform the ARP spoofing before the TCP connection is established.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #6
    Registered User
    Join Date
    Jul 2003
    Posts
    110
    Hmm ok, sorry had exams midterms what not. so Im back to this.

    This has nothing to do with hacking or what not.

    I have my game client called SpaceShooters its a side scroller online co op game that sends packets to a server and and reciveces packets from a server.

    I want to write a program that sits in the middle

    Things this would do.

    Watch the packets go from the server to client and visa versa.
    When needed send a packet to the client or server.

    The server is running on a diffrent box as this program and the client.

    The program and client are on the same box.

    My purpose for this is to know how and why this works. Thankyou.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. TCP Header problem (error)
    By nasim751 in forum C Programming
    Replies: 1
    Last Post: 04-25-2008, 07:30 AM
  2. Accessing TCP flags in TCP packets on Linux using C !!
    By vishamr in forum Linux Programming
    Replies: 2
    Last Post: 10-16-2006, 08:48 AM
  3. Help! About text stream and binary stream
    By Antigloss in forum C Programming
    Replies: 1
    Last Post: 09-01-2005, 08:40 AM
  4. TCP TIME_WAIT state
    By Engineer in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 12-27-2001, 08:50 AM
  5. TCP client/server problem.
    By WL in forum C Programming
    Replies: 0
    Last Post: 10-15-2001, 12:55 AM