Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Sunday, November 18, 2012

pyicmp (ping in python)

I'm  writing program for my programming class this semester (more about it later) and I needed some means of doing ping and traceroute in pure python, because just parsing output of ping (traceroute) commands is not very reliable or cross-platform.

So I created library which uses raw sockets and Internet Control Message Protocol (ICMP) to do basically anything with ICMP allows, but I focused on ping and traceroute.

It's probably only IPv4 (IPv6 was not tested and it's not supported, however some messages may work, I didn't study ICMP6 to see which messages are the same). IPv6 support is planned.

Usage is very simple:

ping:
import pyicmp.ping
p = pyicmp.ping.Ping('1.2.3.4')
traceroute:
import pyicmp.traceroute
t = pyicmp.traceroute.TraceRoute('1.2.3.4')
Yeah, it's that simple.

See docstrings for each classes for more details.

Oh and there is one bad thing... It requires root (administrator for windows) permissions and it'll remain this way, it's not possible to bypass this problem.

You can clone from here: git://github.com/volftomas/pyicmp.git

Friday, August 3, 2012

Claws mail python plugin

I am using Thunderbird right now, but as I got new PC I will be installing Archlinux on it, so I ask myself if it's time to move to something lighter and more extendable by plugins.. as I like Python, using python as plugin language would be great.

I picked Claws-mail which is a great, capable and lightweight email client supporting both GPG encryption/signing and Python plugins..

But there is virtually no documentation on writing those plugins :'( So I just tried it, open console from claws-mail menu and tried it as described in demo.

But I got
Traceback (most recent call last):
  File "<string>", line 1, in <module>
NameError: name 'clawsmail' is not defined
When I tried accessing clawsmail modul. After a while, I found that all you need to do is first import clawsmail modul.
import clawsmail
Simple ^_^

I will probably make some kind of tutorial for this (python plugins in claws mail) so no one else have to do the "digging".