Rob
Rob

Reputation: 8101

Is it possible to craft your own packets with python?

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?

Upvotes: 3

Views: 6067

Answers (2)

johntellsall
johntellsall

Reputation: 15170

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

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

Upvotes: 2

Yann Ramin
Yann Ramin

Reputation: 33167

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.

Upvotes: 1

Related Questions