[tut+src C#] Packet Logger

Results 1 to 11 of 11
  1. #1
    Proficient Member Aurora is offline
    MemberRank
    Dec 2003 Join Date
    Justice HQLocation
    195Posts

    [tut+src C#] Packet Logger

    So, some people seems to be looking for a logger for the mmorpg servers out there ect, so i desided to make a small and fast one for you.

    First, here is the download link
    ----
    http://www.freeplay.dk/plogger.rar

    you are welcome to use this in any way you wish, written in VS2008 and contains everything you need to get startet.

    i also included my own text logging class that is awesome (if you ask my anyways) :)
    ----

    Okay, this should be fairly simple for you to understand.

    There is 2 places you need to chance some code for "your game" to work with this logger.

    Form1.cs :
    the line saying -> public string filter = "tcp port 80";

    you ofcourse need to change this to the filter that applies to you, see a list of filters here :
    http://www.winpcap.org/docs/docs_40_..._language.html

    second place of interrest is the code in the #region Packer Handler section of the code

    Code:
    private void device_PcapOnPacketArrival(object sender, Packet packet)
    {
    ...
    }
    Thats where all the packet data is handled, eg decoding, logging, and whatever else you wish to do with the data you get in.

    -------
    Note, the code default logs TCP packets on port 80 (for you to play with).
    The "demo" logger works like this:

    Start it
    Select the interface you wish to log on (netcard) from the list in box 1.
    Press ok to start logging, and open a couple of websites.
    Click stop, and check the "Logs" folder.

    You are ofcourse welcome to use this on your own interface ect, this is just a quick way to get startet.

    User input is welcome, questions aswell.

    PS : I know it isnt perfect written, but it works, i use this kinda code for all my loggers.


  2. #2
    Proficient Member Aurora is offline
    MemberRank
    Dec 2003 Join Date
    Justice HQLocation
    195Posts

    Re: [tut+src C#] Packet Logger

    For encryption (src + destination) you can do it like this to see if its a incomming packet or outgoing packet.

    Code:
            private void device_PcapOnPacketArrival(object sender, Packet packet)
            {
                if (packet is TCPPacket)
                {             
                    TCPPacket tcp = (TCPPacket)packet;
                    if (tcp.Data.Length <= 0) { return; }
    
                    // incomming packet server -> client
                    if (tcp.SourcePort.Equals(80))
                    {
                          // decrypt
                    }
                    // outgoing packet client -> server
                    else if (tcp.DestinationPort.Equals(80))
                    {
                          // decrypt
                    }
                }
            }
    for TCP packets, server port 80

  3. #3
    Extreme Coder - Delphi bounty-hunter is offline
    MemberRank
    Sep 2007 Join Date
    GunZone MansionLocation
    1,725Posts

    Re: [tut+src C#] Packet Logger

    o_O" what else can it be used for

  4. #4
    Proficient Member Aurora is offline
    MemberRank
    Dec 2003 Join Date
    Justice HQLocation
    195Posts

    Re: [tut+src C#] Packet Logger

    Anything that has to do with your network card(s) packets (in/out) (packet info, data, ect)

    http://www.winpcap.org/docs/docs_40_2/html/main.html contains total documentation for what its capable of.

    BUT! i wrote this mainly for packet capturing so :P

    in there own words : packet capture and network analysis

    Also note, this DOESNT decrypt any encrypted data (incase anyone thought that), if the data is encrypted, you will need to decrypt it (aka have the decryption/encryption schematic).

  5. #5
    Proficient Member Aurora is offline
    MemberRank
    Dec 2003 Join Date
    Justice HQLocation
    195Posts

    Re: [tut+src C#] Packet Logger

    So, anyone using this or was i wasting my time ? :)

    Also, if anyone found any bugs, or have comments of any kind im still very much interrested in hearing about it.

    Also, if you need help with anything in the code, just ask.

    If you need anything else, doesnt matter what, made in C# for tutorials, just give me a word, and ill try to make it.

  6. #6
    Arrogant Wizard DeathArt is offline
    MemberRank
    Mar 2007 Join Date
    StockholmLocation
    2,657Posts

    Re: [tut+src C#] Packet Logger

    There's not much tutorial over this. You don't explain anything of importance, and you show the most irrelevant part of the sourcecode.

  7. #7
    Proficient Member Aurora is offline
    MemberRank
    Dec 2003 Join Date
    Justice HQLocation
    195Posts

    Re: [tut+src C#] Packet Logger

    Okay i can work with that.

    1)
    This is the basic of packet capturing, wich is needed for every mmorpg you wish to create a mmorpg emulator for, im unsure how i could tutorialize this more then it is.

    2)
    Im showing the most important code needed to be changed, and this "package" contains everything beside encryption table (wich is different for each mmorpg).
    I dont see how that is in any way irrelevant, please explain what you think is more important code.

    Thanks for feedback.

    Og jeg regner med du ved hvordan man koder n

  8. #8
    Apprentice kinshi88 is offline
    MemberRank
    Aug 2008 Join Date
    14Posts

    Re: [tut+src C#] Packet Logger

    How would I be able to capture packets from Conquer Online 2.0?

  9. #9
    Proficient Member Aurora is offline
    MemberRank
    Dec 2003 Join Date
    Justice HQLocation
    195Posts

    Re: [tut+src C#] Packet Logger

    find out what port the game uses..

    Edit the source, where the line says

    public string filter = "tcp port 80";
    change the port number (80) to the port of the game.

    Compile and run the program, select your network card and start capturing..

  10. #10
    Apprentice abra12 is offline
    MemberRank
    Nov 2008 Join Date
    20Posts

    Re: [tut+src C#] Packet Logger

    I changed port 80, to 5816 its Conquer and i get "Invalid operation exception was unhandled" in "string tofind = m_Interfaces.FocusedItem.Text;"

  11. #11
    Enthusiast BLACKdeath is offline
    MemberRank
    Dec 2010 Join Date
    28Posts

    Re: [tut+src C#] Packet Logger

    I get a few "Cross-thread operation not valid:" when i debug..



Advertisement