Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!news.swapon.de!easy.in-chemnitz.de!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'python,': 0.02; 'socket': 0.05; '22,': 0.09; 'sockets': 0.09; 'subject:using': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'easier.': 0.16; 'expected,': 0.16; 'subject:raw': 0.16; 'wrote:': 0.17; 'library,': 0.17; 'jan': 0.18; 'tests': 0.18; 'code,': 0.18; 'do.': 0.21; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'cc:2**1': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'am,': 0.27; 'cc:addr:gmail.com': 0.27; 'done.': 0.27; 'raw': 0.27; 'actual': 0.28; 'environment': 0.29; 'restricted': 0.29; 'subject:Sending': 0.29; 'url:mailman': 0.29; 'code': 0.31; 'asking': 0.32; 'url:python': 0.32; 'running': 0.32; 'url:listinfo': 0.32; "can't": 0.34; 'received:google.com': 0.34; 'received:209.85': 0.35; 'really': 0.36; 'but': 0.36; 'url:org': 0.36; 'available.': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'little': 0.39; 'url:mail': 0.40; 'skip:u 10': 0.60; 'more': 0.63; 'reverse': 0.65; 'fact,': 0.69; '2013': 0.84; 'construct': 0.84; 'hard.': 0.84 X-Received: by 10.50.135.33 with SMTP id pp1mr4322907igb.14.1358877480105; Tue, 22 Jan 2013 09:58:00 -0800 (PST) Newsgroups: comp.lang.python Date: Tue, 22 Jan 2013 09:57:59 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=204.11.231.122; posting-account=U-VKXwoAAABBNTXwSeRIKs11KMikvPUN References: <0c2b3482-df46-4324-8bf9-2c45d3f6b516@googlegroups.com> <96947c45-f16b-4e97-b055-edc1241ee4a1@googlegroups.com> User-Agent: G2/1.0 X-Google-Web-Client: true X-Google-IP: 204.11.231.122 MIME-Version: 1.0 Subject: Re: Sending a broadcast message using raw sockets From: Peter Steele To: comp.lang.python@googlegroups.com Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: Peter Steele , 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: , Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1358878129 news.xs4all.nl 6940 [2001:888:2000:d::a6]:50152 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:37319 In fact, I have used scapy in the past, but I am working in a restricted en= vironment and don't have this package available. It provides tones more tha= n I really need anyway, and I figured a simple raw socket send/receive can'= t be *that* hard. I may have to reverse engineer some C code, such as dhcli= ent... On Tuesday, January 22, 2013 8:07:12 AM UTC-8, Corey LeBleu wrote: > If you don't *have* to use the actual socket library, you might want to h= ave a look at scapy.=A0 It's a packet manipulation program/library. It migh= t make things a little easier. >=20 > http://www.secdev.org/projects/scapy/ >=20 > =20 >=20 > On Jan 22, 2013 9:17 AM, "Peter Steele" wrote: >=20 > 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. Th= at's why I was asking about how to do raw sockets, since tools like dhclien= t use raw sockets to do what they do. It can clearly be duplicated in Pytho= n, I just need to find some code samples on how to construct a raw packet. >=20 >=20 >=20 >=20 > -- >=20 > http://mail.python.org/mailman/listinfo/python-list