May 30, 2008

try cnetworkmanager 0.3

cnetworkmanager is a command line interface for Network Manager. It is still lacking many features but I decided to announce it now, when it can:

  1. connect to WiFi networks
  2. read the configuration file of KNetworkManager

It is working for me on RC1 of openSUSE-11.0, which has NetworkManager-0.7.0.r3685-3. It is my first project in Python, so the code is somewhat cumbersome. Thanks to Mišo for getting me started (idea.o.o, abclinuxu.cz), and Bille for the API docs.

Regarding related projects, I have seen network-manager-cli, but it is for 0.6 only and the developers were only active last August, so I decided that I should first write some working code for 0.7.

I am interested in comments, bugs, feature requests, patches, any feedback.

Here are some screenshots ;-)

$ cnetworkmanager -h
cnetworkmanager 0.3 - Command Line Interface for NetworkManager
Options:
-d, --dev list devices
-c, --actcon list active connections
-s, --syscon list system connection settings
-u, --usrcon list user connection settings (can CRASH nm-applet)
-a, --ap list found access points
-n, --nets list found wireless networks
-C<net>, --connect=<net> connect to a wireless network (using knetworkmanagerrc)
-m, --monitor loop to show dbus signals

Listing the networks:

$ cnetworkmanager -n
cnetworkmanager 0.3 - Command Line Interface for NetworkManager
Wifi Networks:
49: onenet (54Mb, protected)
46: IT (54Mb, protected)
48: TiborBrunclik (11Mb, protected)
46: linksys (54Mb)
46: IT (54Mb, protected)
46: 23 (54Mb)

5 comments:

Anonymous said...

Martin, thanks for providing cnetworkmanager, alas while trying to make NM connect in run level 3 with

#cnetworkmanager -C keepout

cnetworkmanaged returns "No AP found with SSID" no matter what. Actually it does not accept _any_ ssid. What am I missing ?

Casual

Martin Vidner said...

There must be no space: "-Ckeepout". I will fix that once I learn more Python :-)

Niels Olson said...

martin, hi, I heard about this on the freenode #suse channel. I am not having much success. Here's what I'm typing:

$ python cnetworkmanager.py --connect=myssid

stdout then says

Connected: /org/freedesktop/NetworkManager/ActiveConnection/7
Getting secrets: /MyConnection/1

then wait a long time, get a command prompt and check . . .

$ ifconfig eth0

summary: still not connected

any suggestions?

Martin Vidner said...

Niels, I don't know. Look in /var/log/NetworkManager.

Anonymous said...

Thanks Martin..

i just want to know, is it possible to create new Connection Entry (like New Network Connection Broadband for USB HSDPA Modem) through cnetworkmanager purely through command line interfaces ...
not through nm-applet editor

best regards,