[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
So /g/ how do i create packets by hand? I can use TCP and UDP
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 22
Thread images: 2
File: Screenshot_2016-05-17_00-39-43.png (43 KB, 1572x346) Image search: [Google]
Screenshot_2016-05-17_00-39-43.png
43 KB, 1572x346
So /g/ how do i create packets by hand?
I can use TCP and UDP to transfer data and what not, but how do i manually create, send and receive packets, including filling out all the info like receivers address, senders address, etc. manually?

I use C and debian btw if thats relevant
>>
File: Ethernet-Frame-Explained.png (101 KB, 697x558) Image search: [Google]
Ethernet-Frame-Explained.png
101 KB, 697x558
You could capture a TCP packet in Wireshark and could view it as zeros and ones (that would be pretty much the physical level of how the packet travels on the cable) but i am not sure how could you define it entirely.

One of the problems would be that your network card and/or drivers would try to encapsulate your completed packets again i think which would fuck them up. (i am not sure about this one but it seems plausible)

What i mean is that you define an ethernet-->ip-->tcp-->http packet in software then your networking hardware would encapsulate it again like ethernet-->ip-->ethernet-->ip-->tcp-->http
>>
>>54583262
>So /g/ how do i create packets by hand?
a packet is usually defined with a Struct in C

specifically, one with the packet's data itself at the very end, so it can hang off without affecting alignment.

Implement/copy a packet struct and fill it up with your headers and data.
>>
>>54584271
Can you even go below the level of TCP/UDP packets from software? Wouldn't the IP and ethernet header stuff happen in drivers and/or hardware?
>>
>>54584236
>TCP packet
>PACKET

packet is the PDU for the Internet layer. What you are referring to is a TCP SEGMENT. Yes, you actually can put ANY payload in an IP packet, not only TCP, UDP or ICMP. However most firewalls will drop this traffic as garbage.
>>
>>54584354
It depends on how much layers are in control by the card.
Usually normal consumer cards provide layers 1 and 2, meaning that from 3 onwards is all done by kernel and software.
Some cards can offload TCP off the CPU (TOE) and the card itself will be in charge of layers 3 and 4 too, which means your kernel/application has to do very little (but can also see very little of what happens).
>>
>>54583262
http://beej.us/guide/bgnet/
Now fuck off
>>
>>54584507
But if i don't want to get my shit dropped as garbage then what is the deepest i can go? Writing the data field of a TCP segment/UDP datagram?
>>
>>54584522
Would it be possible to capture a packet in wireshark to see how a valid packet looks like then get a microcontroller to send that sequence of ones and zeros into a UTP cable? Just to see how this stuff goes.
>>
>>54584546
tfw i put some of those code examples into Dev-C++ and while they all compiled fine the command line disappeared immediately
>>
>>54584746
This is correct, because the program is terminated when you leave the main function or call exit( int ).
>>
>>54584746
Do you even know how to program?
>>
>>54584695
You can see the binary representation of all PDUs in Wireshark. But why do you even want to send IP packets with arbitrary payloads? The network driver on the destination host can't assign the packet content to any application and will silently drop it.
>>
Try scapy.
>>
>>54584695
Wireshark can only see down to OSI layer 2. The physical layer is done by the network card and absolutely transparent to the system, this includes channel coding, error detection, electrical modulation, multiplexing, collision detection and avoiding and other stuff.
>>
>>54584915
It would be a lie to say yes but when i do something trivial like printf-ing bullshit then the command line window stays.
>>
>>54585154
Maybe you have a getchar() in your program.
>>
>>54585154
Why do you even open a new command shell window? Just use a proper IDE like Eclipse and start your program from the inbuilt shell. Does your example program even write to the standard output?
>>
>>54585195
>>54585269
>>54585154
>windows users learn how to program
>>
You could use a non-autistic language
>>
nemesis or scapy. i like scapy because it uses libpcap whereas nemesis uses libnet. some people like perl and cpan, but why.
>>
>>54584546
It teaches TCP and UDP you faggot, where else do you think I learned those from?
Thread replies: 22
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.