Thread: constructing frames...

  1. #1
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768

    constructing frames...

    I know that with raw sockets I can go low as creatining my own ip packets, but what it i want to construct my own ethernet frames?


    thanks
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  2. #2
    Registered User crepincdotcom's Avatar
    Join Date
    Oct 2003
    Posts
    94
    while you're at it, you might as well physically turn on and off the little pins in the NIC.

    Sure, you could hack the kernal to allow you to do that, but unless you're seeking knowedge, it's pointless. If you want a challenge, use raw sockets to create a spoofed telnet, with arp spoofing to get the response. That'll keep you busy.
    -Jack C
    jack {at} crepinc.com
    http://www.crepinc.com

  3. #3
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    i'll take it as a no

    no lib no nothing? damn.


    oh well, thanks.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  4. #4
    Registered User crepincdotcom's Avatar
    Join Date
    Oct 2003
    Posts
    94
    "no"
    That's not entirly true. After I posted yesterday, I was working on a script I'm writing that spoofs connections with raw packets. While looking around, I actually did come across an API for writing to raw frames... it might have been in libnet???

    If I find it, I will let you know, but check libnet and The Oracle (google).

    Later,
    -Jack C
    jack {at} crepinc.com
    http://www.crepinc.com

  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    It is indeed possible:

    http://cboard.cprogramming.com/showthread.php?t=55430
    I used the following driver, whose C# interface I converted to C++:
    http://www.thecodeproject.com/csharp/SendRawPacket.asp

    It then possible to send any Ethernet frame by constructing a char[] buffer and passing it to the driver using WriteFile().
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #6
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    but is it possible to read frame as well?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  7. #7
    Registered User crepincdotcom's Avatar
    Join Date
    Oct 2003
    Posts
    94
    actually, thats not raw frames you're sending, Sang-drax . It's just raw packets. I looked ast your code.

    What he would like to do is send that actually tiny IP peices, not, for instance, and ARP Packet. It's even lower level than that.
    -Jack C
    jack {at} crepinc.com
    http://www.crepinc.com

  8. #8
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    i don't follow... how did he do arp request then?
    Last edited by Devil Panther; 08-06-2004 at 02:39 PM.
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  9. #9
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by crepincdotcom
    actually, thats not raw frames you're sending, Sang-drax . It's just raw packets. I looked ast your code.
    Oh, that's what I'm sending?

    I'm sending Ethernet frames, nothing else. The Ethernet packages/frames contain ARP, IP, IPX or something else. If you'd read sendARPResponse() in PacketLoop.cpp you'd have seen that I'm filling in the destination and source MAC address in the Ethernet frame.

    No reason for giving me bad reputation for that post. I know what I'm sending.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  10. #10
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by Devil Panther
    but is it possible to read frame as well?
    With that particular driver, use ReadFile() to read a frame from the adapter.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  11. #11
    Registered User crepincdotcom's Avatar
    Join Date
    Oct 2003
    Posts
    94
    lol i'm sorry for the bad reps

    I still stand by the packets though. Frames are different: you actually send individual peices, perhaps even individual fragments. You are making a packet: you simply fill in the struct regarding srcaddr, dst, checksum, type, all that. I'm saying, it's more low level.
    -Jack C
    jack {at} crepinc.com
    http://www.crepinc.com

  12. #12
    Registered User crepincdotcom's Avatar
    Join Date
    Oct 2003
    Posts
    94
    Quote Originally Posted by Sang-drax
    With that particular driver, use ReadFile() to read a frame from the adapter.
    Not to be dissing anyone, but just remember that it's windows code, a little different than *nix. But I don't know what OS you use.
    -Jack C
    jack {at} crepinc.com
    http://www.crepinc.com

  13. #13
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    Sang-drax, I can't run it on win9x?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  14. #14
    * Death to Visual Basic * Devil Panther's Avatar
    Join Date
    Aug 2001
    Posts
    768
    I still stand by the packets though. Frames are different: you actually send individual peices, perhaps even individual fragments. You are making a packet: you simply fill in the struct regarding srcaddr, dst, checksum, type, all that. I'm saying, it's more low level.
    but packets contain ethernet, but when you build a raw socket you only have control of ethernet's payload. And if you build a packet with full controll of the ethernet part, you have full control over the frame.



    Sang-drax, I don't see any CRC !?
    "I don't suffer from insanity but enjoy every minute of it" - Edgar Allen Poe

    http://www.Bloodware.net - Developing free software for the community.

  15. #15
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    Quote Originally Posted by Devil Panther
    Sang-drax, I don't see any CRC !?
    The Ethernet CRC is filled in automatically by the hardware. I don't know if NDIS-compatible network adapters support sending frames with custom CRCs.

    crepinc: What do you mean is the difference between packets and frames? Units of level one and two in the OSI stack are called frames, and level three and four are called packets.

    I'm not sure exactly what we're disagreeing on...

    I'd really like to see an example on how to send frames with custom CRC. I'm sure it is possible with some ethernet cards at least, but not with the driver I use.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. I don't get weak_ptr's?
    By cpjust in forum C++ Programming
    Replies: 13
    Last Post: 12-09-2008, 01:28 AM
  2. Jumbo Frames - sort of working
    By bj00 in forum Networking/Device Communication
    Replies: 1
    Last Post: 07-23-2007, 10:29 AM
  3. How to send Jumbo frames ?
    By thaipham in forum Networking/Device Communication
    Replies: 9
    Last Post: 06-21-2005, 10:36 AM
  4. A question about constructors...
    By Wolve in forum C++ Programming
    Replies: 9
    Last Post: 05-04-2005, 04:24 PM
  5. network programming in C, frames issue
    By n3tw0rk in forum C Programming
    Replies: 0
    Last Post: 06-07-2003, 08:36 AM