I'm writing a C/C++ application under Linux that reads data from a raw socket (for ICMP packets). Question: is there a way to discard all data that is still queued on the socket?
The problem is that after sleeping for a while, there is data queued up on the socket which I'm not interested in; so it would be best to just tell the socket ...
Hi!
I'm trying to create an application to craft packets to be able to debug some gateways here, and to experiment with TCP DoS situations.
Nevertheless this should be very easy, I didn't find a way to implement this for a Windows application.
I started using Impacket from Core Security in Python on a Unix box, but I want to avoid thi...
I am writing an application to test a network driver for handling corrupted data. And I thought of sending this data using raw socket, so it will not be corrected by the sending machine's TCP-IP stack.
I am writing this application solely on Linux. I have code examples of using raw sockets in system-calls, but I would really like to kee...
I am sending SYN packets using raw sockets in Linux. The response(SYN+ACK) is being intercepted by the OS and it is responding with a RST. I would like to prevent the OS from intercepting this packet, and let it be handled by my application. How can I accomplish this?
...
How do I send data on a SOCK_PACKET socket without specifying which host it's bound for? I've constructed the IP header to show where it should go, but write() won't work.
...
I have a socket created with socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL)), and I've set it into promiscuous mode using
struct ifreq ifr;
strncpy((char*)ifr.ifr_name, interface, IF_NAMESIZE);
if(ioctl(sock, SIOCGIFINDEX, &ifr)<0) fail(2);
struct packet_mreq mr;
memset(&mr, 0, sizeof(mr));
mr.mr_ifindex = ifr.ifr_ifindex;
mr.mr_type = P...
i'm trying to create a raw sockets using ruby .... the problem is there isn't any thing called raw socket there ,and on the other hand the socket class itself is not fully documented .... do any body have some code samples for that kind of sockets in ruby ?? or maybe some kind of a documentation for that ???
By the way i already know ve...
Is there a python library which implements a standalone TCP stack?
I can't use the usual python socket library because I'm receiving a stream of packets over a socket (they are being tunneled to me over this socket). When I receive a TCP SYN packet addressed to a particular port, I'd like to accept the connection (send a syn-ack) and t...
Good time of day.
Ruby Code:
def hw_address(iface)
sock = Socket.new(Socket::AF_INET, Socket::SOCK_DGRAM,0)
buf = [iface,""].pack('a16h16')
sock.ioctl(SIOCGIFHWADDR, buf);
sock.close
return buf[18..24].to_etheraddr
end
puts hw_address('lo0')
What it do: gets mac-address of interface.
Works on Debian as expect...
I would like to simulate a small cluster of Android devices either on one laptop (worst-case), or on several machines on a private network. This is for testing communications and process migration on Android.
Is there a safe way to identify and launch a particular emulator from a given application under Eclipse? I have a recent Eclipse/...
I want to create a socket for accessing IPv4 packets from data link layer. From unix network programming V1,
socket(PF_PACKET, SOCK_DGRAM, htons(ETH_P_IP))
1)I am implementing a dhcp client, is this the correct way of doing that? (means without accessing data link layer, i cannot receive reply from dhcp server) or is there any other e...
I have created a raw socket which takes all IPv4 packets from data link layer (with data link layer header removed). And for reading the packets I use recvfrom.
My doubt is:
Suppose due to some scheduling done by OS, my process was asleep for 1 sec. When it woke up,it did recvfrom (with number of bytes to be received say 1000) on this r...
Hi everybody. I'm still struggling to get my sample code working on a 64 bit machine. My previous problem was solved because of missing/outdated headers/libraries.
I compile this code as follow: gcc -Wall -g -o server server.c and gcc -Wall -g -o client client.c
I run them on 2 linux machines(both 32bit) and it works fine. When I recom...
How to write byte by byte to socket in PHP?
For example how can I do something like:
socket_write($socket,$msg.14.56.255.11.7.89.152,strlen($msg)+7);
The pseudo code concatenated digits are actually bytes in dec. Hope you understand me.
...
i am using raw sockets to create my own socket. i need to set the tcp_checksum.
i have tried a lot of references but all are not working (i am using wireshark for testing).
could you help me please.
by the way, i read somewhere that if you set tcp_checksum=0. then the hardware will calculate the checksum automatically for you. is this tr...
Writing an asynchronous Ping using Raw Sockets in F#, to enable parallel requests using as few threads as possible. Not using "System.Net.NetworkInformation.Ping", because it appears to allocate one thread per request. Am also interested in using F# async workflows.
The synchronous version below correctly times out when the target hos...
I have a Linux application that talks TCP, and to help with analysis and statistics, I'd like to modify the data in some of the TCP packets that it sends out. I'd prefer to do this without hacking the Linux TCP stack.
The idea I have so far is to make a bridge which acts as a "TCP packet modifier". My idea is to connect to the applicati...
Hello
Is there a tutorial for migration from plain udp sockets (linux, C99/C++, recv syscall is used) to the raw sockets?
According to http://aschauf.landshut.org/fh/linux/udp_vs_raw/ch03s04.html
raw socket is much faster than udp.
Application is client-server. client is proprietary and must use exactly same procotol as it was with u...
I'm trying to build a simple echo server/client that works on ethernet level(using raw sockets).
The server side by itself works and shows all incoming packets on eth0.
The client works and sends ethernet packets on eth0 (I checked this with wireshark and can see the packets going out.)
I now want to make a filter to only look at the p...
I have the following code to open a raw socket and send over it. In the send function I have a trace statement showing me that the length of my packet is 21. However, when I view the packets on the receiving end using a packet sniffer, I see:
The actual packet length is 60.
The length (as given in the 802.3 header) is 256.
Neither of...