views:

164

answers:

2

Well, I know its possible, using external libraries and modules such as scapy. But how about without external modules? Without running the script as root? No external dependencies?

I've been doing a lot of googling, but haven't found much help. I'd like to be able to create my own packets, but without running as root, or installing extra dependencies.

Any suggestions?

+1  A: 

Many operating systems (Linux) do not allow raw sockets unless your effective user ID is 0 (aka root). This isn't a library issue. Some operating systems (non-server Windows post Windows XP SP2) do not allow crafting raw sockets period.

You can read more about raw sockets by man 7 raw on your system. Note that the socket options can all be passed using the Python socket module.

Yann Ramin
A: 

Here's how to code raw ICMP "ping" packets in Python:

http://www.g-loaded.eu/2009/10/30/python-ping/

shavenwarthog