CLInet 0.8

Configuration wizards, scanners, remote desktop, etc.
Message
Author
User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

CLInet 0.8

#1 Post by WarMocK »

Greetings everybody!

I've been working on the issue with connecting a PC to the internet on the commandline for quite some time, and now I've got a working prototype: CLInet.

What it does:
It is a dialog-based tool chain (total size of all files is approx 30 KB) that allows you to set up a connection with a cable connection, wireless LAN connection, and dial-up with a modem. The tools create an executable script running the dial-up tools with generated configs so you can even start a dial-up without the need for CLInet itself. Later versions are supposed to be able to edit the config files of the router scripts (and wxdial).
Since I have only very limited possibilities here when it comes to testing everything, any help would be VERY appreciated, especially with the modem part.

Please remember that this thing is VERY brittle right now and still is cramped with bugs. I'll try to fix'em as good as I can, but bash scripting is totally new for me (I usually program GUIs in tcl/tk), so I'd welcome any helping hand.

Update:
I forgot to mention what I've tested so far *note to myself: don't throw stuff out to the crowd at 1:30 in the morning :roll: *
The system proved to work with:
- LAN connection
- WLAN and WEP encryption
- WLAN and WPA encryption
- WLAN and WPA2 encryption

It should work with:
WLAN and no encryption (I managed to get a connection to a public AP but I didn't have the necessary login data at hand to actually dial into the net)

It probably works with (but hasn't been tested yet):
- Modem connection

I'd appreciate any feedback about wether the connection types mentioned above do work with others or not, so I can fix these things first (if necessary) before going for the editor part.


That said ... fire it up! :D

UPDATES!!!
v 0.2: I moved the generated scripts and temporary config files to a temp folder in the user's home directory to avoid conflicts (and security issues) in a multi-user environment. Also fixed a few bugs with the connect2modem script so you can actually abort the whole process if necessary.

v 0.3: now runs under the GUI as well. Thanks for the idea with XDialog, aragon. :D

v 0.4: Fixed some bugs that came up with Puppy 4.31. Also changes the layout of the dialogs a bit so they are more compatible with both dialog and xdialog

v 0.5: Edited the start script according to aragon's proposal (I seriously totally forgot about that one xD). But I used -z $DISPLAY instead for checking out if X is running or not. Also re-enabled Xdialog for all scripts again after fixing some layout problems and fixed a serious flaw in the design; I added t message box that warns the user if there's no access point available (the former versions tried to run the script anyway).

v 0.6: CLInet now always opens in dialog mode only (on X, it opens in rxvt) because XDialog tended to catch error messages and put them into the temporary variables, screwing up the entire process.
Added the promised edit functions for router connections. You may set the connection to ad-hoc (directly between two computers) or Standard (connection over a router), as well as the driver mode for normal and hidden router SSIDs.

v 0.7: Added cross-reference links to the pppoe wizardtools. CLInet may now be used to configure DLS connections over modems as well. Also changed the layout from the main dialog box to make it fit the new features properly.

v.0.8: Added a rescan function for the case that there were no access points in range. Also replaced the echo message with a dialog messagebox to tell if the system successfully established a connection or not.
Attachments
CLInet-0.8.pet
(11.95 KiB) Downloaded 1097 times
clishot.jpg
(43.32 KiB) Downloaded 1935 times
Last edited by WarMocK on Fri 06 Aug 2010, 19:56, edited 17 times in total.

amigo
Posts: 2629
Joined: Mon 02 Apr 2007, 06:52

#2 Post by amigo »

Nice idea! Since it's written using dialog, it will be trivial to make it also work with Xdialog. I'll try to make a chance to have a look at it -my first work ever with bash-scripting was to do some mods to a PPP modem setup tool, so I may have some old code which fits in there, if needed.

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#3 Post by WarMocK »

Sure! Go ahead!
I hope I added enough comments to the scripts so you don't get lost. Most of the stuff I used is heavily modified code from Puppy's modemwizard and the wireless LAN wizard. If you're familiar with that code, you'll feel like home. ;-)

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#4 Post by WarMocK »

Okay, first update!
See first post for the dotpet.
Last edited by WarMocK on Fri 19 Feb 2010, 18:42, edited 1 time in total.

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#5 Post by WarMocK »

Added version 0.3
See main post.

Thanks for the idea with XDialog, aragon. :D
Last edited by WarMocK on Fri 19 Feb 2010, 18:48, edited 2 times in total.

aragon
Posts: 1698
Joined: Mon 15 Oct 2007, 12:18
Location: Germany

#6 Post by aragon »

hi warmock,

i've now had time to test a little. Testbed: Dell Lattitude E6400, Puppy 4.31 (pfix=ram).

i've had some problems, so i couldn't test, if the connection would be set with success.

- /usr/sbin/clinet
as the combi of dialog/xdialog only makes sense if dialog is used on cli (no x) and xdialog within x - my opinion - this one is suboptimal, as it uses rxvt to launch, what would not work in cli.

please look at this one

Code: Select all

#!/bin/sh
#Lesser GPL licence v2 (http://www.fsf.org/licensing/licenses/lgpl.html). 2010 www.puppylinux.com

if [ "$(ps -eo comm | grep ^X)" = "X" ]
then 
exec rxvt -e /usr/local/CLInet/CLInet.sh 2> /dev/null &
else
exec /usr/local/CLInet/CLInet.sh 2> /dev/null &
fi
exit 0 
will report further testing.

aragon

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#7 Post by WarMocK »

@aragon:
For some reason, CLInet tends to crash on Puppy 4.31 at the moment (I wrote the tool on NOP 4.13). But I think I found the problem:
When breaking up the scan results from iwlist, CLInet now screws up because the option I used to determine the end of a cell (EXTRAS) now is on a different position, namely before the IE: list, therefore, the tool cuts the most important variable (namely the hardware encryption) away before it had been able to read it out.
The easiest - and ugliest - bugfix I came up with not was setting the ENDSEQ variable to a fixed value (I only have a few APs here, not enough to determine if value I chose value is accurate enough. I chose 24). The result is anything but pretty, but it does the job. I'm gonna do some tests and see what I can use to properly include all the EXTRAS and IE: values again instead of doing a shot in the blue.

UPDATE:
Looks like there are quite a few things I need to alter to get CLInet up and running under 4.31 now. :-(
I altered the script for the router connection and added a filter for iw list to remove all unknown IEs from the output, and put a static value for the DIFFERECE variable needed to separate the cells from each other. I also changed the names for the generated dial-up scripts, they now use the name of the selected router for both the script and the config file. Is it possible that there is a bug with cp now? I could now copy the WPA2 template into the hidden CLInet directory (which is also created if missing now, I thought I had added that routine to the main script). Looks like cp doesn't like MAC adresses as filenames anymore.
Gonna make another patched dotpet as soon as I created the newest barebones iso here, it should take too long.

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#8 Post by WarMocK »

Okay, this is odd.
I'm testing CLInet on a freshly woof-generated Puppy 4.31 Live-CD, and even net-setup.sh seems to work there. It used to work on NOP 4.31 and NOP 4.13. I hope I didn't strip out too much, but I definitely know that the last things I'd ever strip out would be any drivers. Is this a bug in one of the packages used by woof and puppy 4.31 or what?

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#9 Post by WarMocK »

Version 0.4 is out. See first post for details.

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#10 Post by WarMocK »

Say hello to version 0.5. Dotpet's in the first post.

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#11 Post by nooby »

I know I know nothing but got curious.

what is it for? what usage? You can do what?

apart from being fun in itself?
I use Google Search on Puppy Forum
not an ideal solution though

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#12 Post by WarMocK »

In a nutshell:
CLInet is a tool for the command line to generate dial-up scripts for wireless LAN connections, starts dhcp for both LAN and wireless connections once the connections are established, configures and launches the dial-up config for modem connection, and lets you edit dial-up scripts to make them suitable for ad-hoc and invisible wireless connections. Now it also works on a GUI by using XDialog.

Consider it a combination for the pupdial and the net-setup wizard, but for both the commandline and the GUI, and it's smaller than either of the other programs. :D

nooby
Posts: 10369
Joined: Sun 29 Jun 2008, 19:05
Location: SwedenEurope

#13 Post by nooby »

I guess it is less embarrassing if I just leave it at that.

I think I do understant almost all of that but on a very primitive level.

what I asked was more like this:

What does one do with it apart from what you just descrbed. I got that part. the tech side of it.

I mean do you chat with people. Browse internet. Set up a server? Do survelliance of neighborhood. Manage Networks at your work..

Listen to internet radio. I mean what can it do socially or entertaining or communicating with others or what? Connecting two networks or what?
doing Tunneling or what? I kind of get the tech side of it but what is it for?

Just drop it if I made a fool of myself.
I use Google Search on Puppy Forum
not an ideal solution though

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#14 Post by WarMocK »

I connects your computer to a local network or the internet. No more, no less. Things common network wizards do.

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#15 Post by WarMocK »

Version 0.6 is up. See main post. :D

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#16 Post by WarMocK »

Okay, version 0.7 is on the air. See main post again.

User avatar
RetroTechGuy
Posts: 2947
Joined: Tue 15 Dec 2009, 17:20
Location: USA

#17 Post by RetroTechGuy »

nooby wrote:I guess it is less embarrassing if I just leave it at that.

I think I do understant almost all of that but on a very primitive level.

what I asked was more like this:

What does one do with it apart from what you just descrbed. I got that part. the tech side of it.

I mean do you chat with people. Browse internet. Set up a server? Do survelliance of neighborhood. Manage Networks at your work..

Listen to internet radio. I mean what can it do socially or entertaining or communicating with others or what? Connecting two networks or what?
doing Tunneling or what? I kind of get the tech side of it but what is it for?

Just drop it if I made a fool of myself.
Actually, quite a cool idea. There are a great many things that can be done from the command line. I haven't tried the tool yet, but if it works one could conceivably run a CLI only computer. The GUI eats a lot of memory and horsepower. A CLI OS doesn't stress a computer too much (so the folks with REALLY old machines could pull them back out of the closet... ;) )

What could you do? There used to be graphical/semi-graphical browsers that would launch from the command line. There some of the video/audio players would launch and run from the command line (i.e. you didn't need to run X, in order to use them).

You could do email (e.g. using fetchmail, elm). Spool files via wget... And, of course, all the common stuff -- write text, program, play games...

This might be a fine tool if you wanted to set up a Puppy server, routing all traffic through the machine...

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#18 Post by WarMocK »

RetroTechGuy wrote:Actually, quite a cool idea. There are a great many things that can be done from the command line. I haven't tried the tool yet, but if it works one could conceivably run a CLI only computer. The GUI eats a lot of memory and horsepower. A CLI OS doesn't stress a computer too much (so the folks with REALLY old machines could pull them back out of the closet... ;) )

What could you do? There used to be graphical/semi-graphical browsers that would launch from the command line. There some of the video/audio players would launch and run from the command line (i.e. you didn't need to run X, in order to use them).

You could do email (e.g. using fetchmail, elm). Spool files via wget... And, of course, all the common stuff -- write text, program, play games...

This might be a fine tool if you wanted to set up a Puppy server, routing all traffic through the machine...
Heh, you just explained some of the features I added inot my K-9 puplet. ;-)
It has a nice little collection of CLI apps (like elinks2, mp, bashburn, mp3blaster, Midnight Commander, rhapsody, and CLInet of course). However, the apps I chose were mainly included to help you recover your system after X crashed for some reason. I already had to use them a few times after I accidently screwed up my Xorg.conf or changed some persmissions incorrectly, and it was pretty easy with the CLI tools to fix the problem. ;-)
Maybe I'll add afew extra CLI tools later on and get a fully functional CLI-based OS under the hood. That might be VERY useful if I needed to remotely access my system and don't want to stress the connection with VPN.

User avatar
WarMocK
Posts: 169
Joined: Thu 05 Jul 2007, 11:53

#19 Post by WarMocK »

Version 0.8 is available. See first post.

goingnuts
Posts: 932
Joined: Sun 07 Dec 2008, 13:33
Contact:

#20 Post by goingnuts »

WarMocK: I really appreciate your work on this - and it is getting better and better! Basically I think that all the set-up wizards should be able to work from the command line. I have spend a lot of time rewriting some of P412´s wizards (probably back) to use dialog - and the network wizard really is complicated...
Lately I have found myself rewriting those wizards down to work in shell alone - and I think a fundamental demand for a setup wizard might be that it must be able to run in a shell - without dialog or other GUIs wrapped around it. Another demand could be that it should be able to run without bash - using BusyBox ash only (apart from the necessary programs that BusyBox do not supply...).
I have attached a small demo of a function that could be used to achieve the switch between pure shell and dialog. Clumsy coding but its only a prototype. Could be expanded to include xdialog as a choice although dialog coding used by xdialog sometimes get ugly and generates errors...
Attachments
cliordialog.tar.gz
shellscript with function to set output to pure shell or to dialog
(911 Bytes) Downloaded 625 times

Post Reply