Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #84206

Socket ICMP V6 error

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.kamp.net!newsfeed.kamp.net!newsfeed.freenet.ag!takemy.news.telefonica.de!telefonica.de!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ermanolillo@hotmail.com>
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; 'subject:error': 0.03; '16,': 0.03; 'argument': 0.05; 'error:': 0.07; 'socket': 0.07; 'sys': 0.07; 'advance': 0.07; 'python': 0.11; 'archive': 0.14; '0))': 0.16; 'cmd': 0.16; 'context:': 0.16; 'modification': 0.16; 'command': 0.22; 'select': 0.22; 'import': 0.22; 'print': 0.22; "i've": 0.25; 'skip:" 30': 0.26; 'code:': 0.26; 'host': 0.29; 'skip:g 30': 0.30; 'struct': 0.31; 'file': 0.32; 'interface': 0.32; 'url:python': 0.33; 'could': 0.34; 'skip:s 30': 0.35; 'done': 0.36; 'next': 0.36; 'charset:us-ascii': 0.36; 'thanks': 0.36; 'list': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'mailing': 0.39; 'signal': 0.60; 'invalid': 0.68; 'listen:': 0.84
Date Thu, 22 Jan 2015 00:00:49 -0800 (PST)
From ermanolillo <ermanolillo@hotmail.com>
To python-list@python.org
Subject Socket ICMP V6 error
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.17958.1421913710.18130.python-list@python.org> (permalink)
Lines 62
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1421913710 news.xs4all.nl 2939 [2001:888:2000:d::a6]:54436
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:84206

Show key headers only | View raw



I've made a snniferr for a ICMP socket that works with IPv4. This is the
code:
	

import sys
import socket
import struct
import select
import time
import signal
import re

HOST = raw_input("Enter the interface to listen: ")

s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_ICMP)
s.bind((HOST, 0))
s.setsockopt(socket.IPPROTO_IP, socket.IP_HDRINCL, 1)

print "Server Started......"
for i in range(1,2000):

data = s.recvfrom(65565)
d1 = str(data[0])
data1 = re.search('@@(.*)', d1)

command = data1.group(0)
cmd = command[2:]
if i%2 == 0:
d = data[1]
d1 = str(d)
ip = d1[2:-5]

print cmd 
print ip

I have done a modification to adapt it to IPv6:

	

s = socket.socket(socket.AF_INET6, socket.SOCK_RAW, socket.IPPROTO_ICMPV6)

However I recive the next error:

	

File "server.py", line 16, in <module>
s.bind((HOST, 0))
File "/usr/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
socket.error: [Errno 22] Invalid argument

Could someone please help me?.

Thanks in advance



--
View this message in context: http://python.6.x6.nabble.com/Socket-ICMP-V6-error-tp5083962.html
Sent from the Python - python-list mailing list archive at Nabble.com.

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Socket ICMP V6 error ermanolillo <ermanolillo@hotmail.com> - 2015-01-22 00:00 -0800

csiph-web