Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'socket': 0.05; '22,': 0.09; 'sockets': 0.09; 'subject:using': 0.09; 'cc:addr:python-list': 0.10; 'easier.': 0.16; 'expected,': 0.16; 'subject:raw': 0.16; 'wrote:': 0.17; 'library,': 0.17; 'pfxlen:0': 0.17; 'jan': 0.18; 'tests': 0.18; 'code,': 0.18; 'email addr:gmail.com>': 0.20; 'do.': 0.21; 'cc:2**0': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'am,': 0.27; 'done.': 0.27; 'raw': 0.27; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'actual': 0.28; 'subject:Sending': 0.29; 'url:mailman': 0.29; 'skip:& 10': 0.29; 'code': 0.31; 'asking': 0.32; 'url:python': 0.32; 'running': 0.32; 'url:listinfo': 0.32; 'received:google.com': 0.34; 'received:209.85': 0.35; 'url:org': 0.36; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'little': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'skip:u 10': 0.60; '2013': 0.84; 'construct': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=duOmmwI75hgfvzCPOQ0NCFWVPR5S1ffKJlE4bx1MvZo=; b=UBjF2QqG70TX3H3Y1ZE9qDrz2mvt/JiVRWCT7ya0nBEtpnzYOy+u99qfH6OA5k8BPq 39+7u3UVlhYqrOXC/0BJQIUnYpAUC1g4T5KHUsGN5OfvQjigEGZjVU0MY+Q+7TaigSmr TJSw5Jw7/TKr4AqzKv7ApX89O5ezjTYuhT/uv9Sb+ycqwfPXrOU7qUdOWC7mEWZq4mIt GBZvH0D1UiMWwAUprn9kVUSuy6DrqyFodrB36gbOVZ6n+0Tiir/Yazkz2ck2mT2aRp4+ OEN9h1a8NUt83y5ggS5/w0Tk39cPFA3W0c8jxg4j7WKIkNPRDyRkyche9eBxaU3wtZck a6ag== MIME-Version: 1.0 X-Received: by 10.180.19.136 with SMTP id f8mr22424379wie.0.1358870832653; Tue, 22 Jan 2013 08:07:12 -0800 (PST) In-Reply-To: <96947c45-f16b-4e97-b055-edc1241ee4a1@googlegroups.com> References: <0c2b3482-df46-4324-8bf9-2c45d3f6b516@googlegroups.com> <96947c45-f16b-4e97-b055-edc1241ee4a1@googlegroups.com> Date: Tue, 22 Jan 2013 10:07:12 -0600 Subject: Re: Sending a broadcast message using raw sockets From: Corey LeBleu To: Peter Steele Content-Type: multipart/alternative; boundary=bcaec53d5aa346a4f204d3e2c58c Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 50 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358874138 news.xs4all.nl 6916 [2001:888:2000:d::a6]:35704 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37306 --bcaec53d5aa346a4f204d3e2c58c Content-Type: text/plain; charset=ISO-8859-1 If you don't *have* to use the actual socket library, you might want to have a look at scapy. It's a packet manipulation program/library. It might make things a little easier. http://www.secdev.org/projects/scapy/ On Jan 22, 2013 9:17 AM, "Peter Steele" wrote: > I just tried running you code, and the "sendto" call fails with "Network > is unreachable". That's what I expected, based on other tests I've done. > That's why I was asking about how to do raw sockets, since tools like > dhclient use raw sockets to do what they do. It can clearly be duplicated > in Python, I just need to find some code samples on how to construct a raw > packet. > > -- > http://mail.python.org/mailman/listinfo/python-list > --bcaec53d5aa346a4f204d3e2c58c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

If you don't *have* to use the actual socket library, you might want= to have a look at scapy.=A0 It's a packet manipulation program/library= . It might make things a little easier.

http://www.secdev.org/= projects/scapy/

On Jan 22, 2013 9:17 AM, "Peter Steele"= ; <pwsteele@gmail.com> wrot= e:
I just tried running you code, and the "sendto" call fails with &= quot;Network is unreachable". That's what I expected, based on oth= er tests I've done. That's why I was asking about how to do raw soc= kets, since tools like dhclient use raw sockets to do what they do. It can = clearly be duplicated in Python, I just need to find some code samples on h= ow to construct a raw packet.

--
http://mail.python.org/mailman/listinfo/python-list
--bcaec53d5aa346a4f204d3e2c58c--