Questions tagged [raw-sockets]

An internet socket that allows direct sending and receiving of raw network packets that contain all headers. They differ from protocols like TCP/IP or UDP.

Raw sockets differ from standard sockets where the payload is encapsulated according to the transport layer protocol (TCP, UDP, HTTP, ..). Raw sockets can be used to implement completely new transport-layer protocols or to send messages through some less common protocol like ICMP.

Most socket APIs, especially those based on Berkeley sockets, support raw sockets. Support under Windows XP is intentionally limited due security concerns.

490 questions
48
votes
8 answers

How Do I Use Raw Socket in Python?

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.…
Avihu Turzion
  • 3,284
  • 4
  • 25
  • 34
36
votes
3 answers

how to bind raw socket to specific interface

My application is running on CentOS 5.5. I'm using raw socket to send data: sd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); if (sd < 0) { // Error } const int opt_on = 1; rc = setsockopt(m_SocketDescriptor, IPPROTO_IP, IP_HDRINCL, &opt_on,…
Dima
  • 1,253
  • 3
  • 21
  • 31
21
votes
1 answer

Scapy on PlanetLab

Has anybody ever succeeded in using Scapy on a PlanetLab node (running Fedora 12)? I am aware of the safe raw socket restrictions, but it seems that I can send packets through Scapy by just setting conf.L3socket=L3RawSocket. As for the reception of…
Ricky Robinson
  • 21,798
  • 42
  • 129
  • 185
19
votes
5 answers

Accessing wireless interface (802.11) at MAC layer (Linux)

I spent the last days reading through man pages, documentations and anything else google brought up, but I suppose I'm even more confused now than I was at the beginning. Here is what I want to do: I want to send and receive data packets with my own…
15
votes
2 answers

Does libpcap use raw sockets underneath them?

I was getting a bit confused on using of raw sockets and libcap. Can, anyone in simple point out advantages of using both. I read few links, but, its making me confused.
Invictus
  • 2,653
  • 8
  • 31
  • 50
15
votes
3 answers

Using raw sockets with C#

I want to write a port scanner in C# and I can't use SocketType.Raw as raw sockets were taken out from desktop versions of windows. I can't use SharpPcap either or other wrapper for Winpcap as I use PPPoE for internet connection and Winpcap doesn't…
Mack
  • 783
  • 1
  • 8
  • 13
14
votes
3 answers

Creating raw socket in Python without root privileges

Is it possible to create a raw socket without root privileges? If not, can a script elevate its privileges itself? I wrote a Python script using a raw socket: #!/usr/bin/env python import socket rawSocket = socket.socket(socket.PF_PACKET,…
ρss
  • 5,115
  • 8
  • 43
  • 73
13
votes
0 answers

udp packet caught by tcpdump, but not received by socket

I wrote a rawudp program to send udp packet via raw socket, following the webpage http://www.tenouk.com/Module43a.html. Then I wrote a udp server to listen to udp packets on given port. The codes look like follows: ... sd = socket(AF_INET,…
Eric Lee
  • 131
  • 1
  • 1
  • 4
12
votes
3 answers

How to create Raw socket in Android?

Has anybody tried creating RawSocket in Android and have succeeded ?
Harish
11
votes
1 answer

Send a raw ethernet packet from inside a kernel module

I found out that I need to build a new sk_buff struct in the kernel module and pass it to my network device, but what I can't figure out is how to set the struct variables for a simple raw ethernet packet. This has to be easy, but I would really…
Kai
  • 2,205
  • 3
  • 32
  • 43
10
votes
3 answers

Purpose of sendto address for C raw socket?

I'm sending some ping packets via a raw socket in C, on my linux machine. int sock_fd = socket(AF_INET, SOCK_RAW, IPPROTO_RAW); This means that I specify the IP packet header when I write to the socket (IP_HDRINCL is implied). Writing to the socket…
William
  • 2,917
  • 5
  • 30
  • 47
10
votes
2 answers

Is raw socket on loopback interface possible?

We are trying to communicate with the server listening on Linux loopback interface via raw socket and it seems like the server does not get a single packet from us. The packets we send are visible in Wireshark. Is raw socket on loopback possible at…
jackhab
  • 17,128
  • 37
  • 99
  • 136
10
votes
1 answer

How to use Golang to compose raw TCP packet (using gopacket) and send it via raw socket

I would like to craft custome TCP packets using gopacket and then send them using raw sockets. Here is a short and readable example go program that demonstrates what I'd like to do: package main import ( "code.google.com/p/gopacket" …
David Stainton
  • 101
  • 1
  • 1
  • 3
10
votes
1 answer

Raw socket in java

I am pretty new to java socket programming. I had already gone thorugh that java only deals with Internet Domain Sockets and it will support UDP and TCP and Raw IP Protocols. I want to know that is java support Raw Sockets without using any third…
Nikhil
  • 2,857
  • 9
  • 34
  • 58
10
votes
4 answers

Timestamp outgoing packets

I'm trying to get accurate timestamps for outgoing packets (sent using raw sockets). According to Linux/Documentation/networking/timestamping.txt, "For send time stamps the outgoing packet is looped back to the socket's error queue with the send…
bruno nery
  • 2,022
  • 2
  • 20
  • 31
1
2 3
32 33