Re: low level networking in python



On Apr 3, 10:29 am, "Maxim Veksler" <hq4e...@xxxxxxxxx> wrote:
Hello,

I wish to do some low level network stuff using python.

I've googled somewhat and came up with pylibpcap[1], trouble is I
can't compile it on my Ubuntu 6.10 workstation. Can someone please
suggest a way to read some bits from random ports? I'm looking to
write a simple pen-testing tool that would try from one side
connecting to ports and from the other side sniff traffic to see on
what ports traffic is coming.

For pylibpcap I'm getting:

"""
hq4ever@lucky:~/development/personal/pylibpcap/pylibpcap-0.5.1$ python
setup.py build
running build
running build_ext
building '_pcapmodule' extension
swig -python -shadow -ISWIG -o pcap.c pcap.i
pcap.i:72: Warning(124): Specifying the language name in %typemap is
deprecated - use #ifdef SWIG<LANG> instead.
pcap.i:77: Warning(124): Specifying the language name in %typemap is
deprecated - use #ifdef SWIG<LANG> instead.
pcap.i:82: Warning(124): Specifying the language name in %typemap is
deprecated - use #ifdef SWIG<LANG> instead.
/usr/bin/python ./build-tools/docify.py pcap.c
/usr/bin/python ./build-tools/docify-shadow.py pcap.py
Traceback (most recent call last):
File "./build-tools/docify-shadow.py", line 30, in ?
raise 'source file doesn\'t look like swigged shadow class code'
source file doesn't look like swigged shadow class code
error: command '/usr/bin/python' failed with exit status 1
"""

[1]http://pylibpcap.sourceforge.net/
[2]http://py.vaults.ca/apyllo.py/126307487

--
Cheers,
Maxim Veksler

"Free as in Freedom" - Do u GNU ?

I would assume you could use the socket module. This post details
someone else who opened ports with Python:

http://www.thescripts.com/forum/thread44280.html

Here's another resource using some python servers:

http://docs.python.org/lib/socket-example.html

Finally, a Socket programming howto:
http://www.amk.ca/python/howto/sockets/

I'm also told that the Twisted framework is excellent for this sort of
thing.

Mike

.



Relevant Pages

  • Re: low level networking in python
    ... I wish to do some low level network stuff using python. ... connecting to ports and from the other side sniff traffic to see on ... pcap.i:72: Warning: Specifying the language name in %typemap is ... deprecated - use #ifdef SWIGinstead. ...
    (comp.lang.python)
  • Re: Dependencies
    ... > I seeing so many apps requiring python. ... of ports and most frequently a make make install in the considered port ... desinstallation, no fuss, and soft tested and working. ... entered a dependency hell and never seen the end. ...
    (comp.unix.bsd.freebsd.misc)
  • Re: Dependencies
    ... >> I seeing so many apps requiring python. ... > you need to recompile hundred of ports with no firm guarantee it will ... > they happily introduce such strict dependencies in the ports that it ...
    (comp.unix.bsd.freebsd.misc)
  • Re: portupgrade O(n^m)?
    ... -It's written in python. ... In our ports tree, you can even choice to create your own packages, install your own packages that was built by you, use FreeBSD packages or compile by via ports tree. ...
    (freebsd-hackers)
  • Re: gpp (conditional compilation)
    ... the same '#' character introduces Python comments and is used ... by default to introduce #ifdef etc. lines. ...
    (comp.lang.python)