Send complete TCP or UDP packs programmatically
According to OSI Model, data packets will be completed in several layers. Is it possible to send complete TCP or UDP packets (including headers and etc) programmatically.
For example a packet whit custom MAC ADD. and a fake IP for sender (requester)?
Yes. You can put any TCP or UDP packet header if you are sending it using RAW sockets , for which you must have a root access to the system:
sock = socket(PF_INET, SOCK_RAW, IPPROTO_UDP);
Or you can also bypass linux TCP stack and write() and read() with the ethernet card directly.
The problem is, if you use fake ip with TCP, you won't get a response from SYN request because the real ip will reject it or it simply won't be routed back. You can research on this if you query for "ip spoofing" keywords.