Firewall status tray icon - firewallstate-2.1

Configuration wizards, scanners, remote desktop, etc.
Message
Author
Dogdaze
Posts: 12
Joined: Tue 03 Aug 2010, 07:12

firewallstate

#81 Post by Dogdaze »

Greetings Tasmon,
Sorry, I got side tracked with the kids. Had to rush off to Walmart to purchase a laptop for my youngest son. They had a fantastic sale on HP laptops and after all, it was his birthday, lucky kid! so.... I did not have time to try your Gmail app. So, I have no comment about it,sorry! I will try to check it out tonight. As per your post, ?? I am not sure that I understand your message properly. I guess, what ever you would like to do would be fine with me. If, by full version, you mean, your firewall app and incorporate "disconnect from Internet" in the right click menu ? Then for sure, that is what I would prefer. I am really happy that you have created the firewall status app, I use it all the time. Cheers! I think that it would be a good place to have this option. If,however, you do not want to add it to you right click menu, then a separate app will suffice. I would rather, if it could be added to your Firewall status app, since it is already in the taskbar and I feel that it would be a good place for that option IMO. It is, however, your choice. I mean, what ever you feel comfortable with, is fine by me. Thanks for your response and your time in regards to this request.

--------------------------------------------------------
$$Don't buy a new computer$$, Download a Puppy! :D

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#82 Post by tasmod »

Hi Dogdaze,

Well mixed success. I posted in programming forum a question but answered it myself after a few minutes.

I wrote a small bash script and gui to test network stop/start (disconnect internet) and it worked fine on my laptop with a new frugal install of lucid 508.

I then rewrote the C code to do the same thing, but it didn't work on my PC I use for coding.
This had me chasing my tail thinking the code was wrong. It wasn't it just couldn't work on this PC even though it's Lucid 508.

Seems the laptop was setup by another network setup from BK dated 2007 - probably the traditional one.

Seems my PC used Simple Network Setup by BK dated 2010.

There's a difference in code in the rc.network files. SNS will not let me stop/start it in the code, whereas the older rc.network will let me because the code is in it.

So it depends on which rc.network file you have as to whether it will work for you.

If you open /etc/rc.d/rc.network in Geany and look at second line it should say 'LPGL Barry Kauler 2006, 2007 www.puppylinux.com' if it does it will work for you and I will post the small script for you rather than alter the tray app.

Even though I've added about 50 lines of code to do it in the tray app, it takes two actual Bash script lines to do it.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#83 Post by jpeps »

Here's a simple CHEAP alternative (eliminates 13M of ram) that I placed on my tray.

Code: Select all

#! /bin/bash

VAR=`lsmod | grep iptable`
if [ -n "${VAR}" ]; then
   STATE="Firewall On"
  else
   STATE="Firewall Off"
fi


export ON='
<window title="">
<vbox>
  <text>
    <label>Firewall Turned ON</label>
  </text>
 <button cancel>
 </button>
</vbox>
</window>
'
export OFF='
<window title="">
<vbox>
  <text>
    <label>Firewall Turned Off</label>
  </text>
 <button cancel>
 </button>
</vbox>
</window>
'
export MAIN_DIALOG='
 <vbox>
   <text>
     <input>cat /etc/DISTRO_SPECS | grep DISTRO_NAME | cut -d= -f2</input>
   </text>
   <text>
     <input>cat /etc/DISTRO_SPECS | grep DISTRO_VERSION | cut -d_ -f2</input>
    </text>
    <text> 
       <label>Your external IP Address is:</label>
    </text>
    <text>
      <input>wget -qO - http://cfaj.freeshell.org/ipaddr.cgi</input> 
    </text>
    <text>
      <label>Your local IP Address is:</label>
    </text>
    <text>
      <input>ifconfig | grep addr: | grep -v 127\. | cut -d: -f2 | cut -d" " -f1 </input>
    </text>
    <text>
      <label>__________________</label>
    </text>
    <text>
      <label>'"$STATE"'</label>
    </text>
      <hbox>
          <button>
	    <label>Firewall Start</label>
	      <action>/etc/rc.d/rc.firewall start</action>  
	      <action type="launch">ON</action>
	  </button>
	  <button>
	    <label>Firewall Stop</label>
	    <action>/etc/rc.d/rc.firewall stop</action>
	    <action type="launch">OFF</action>
	  </button>
	  <button cancel>
	  </button>
      </hbox>	  
 </vbox>
'
gtkdialog3 --program=MAIN_DIALOG

Dogdaze
Posts: 12
Joined: Tue 03 Aug 2010, 07:12

Firewall Status

#84 Post by Dogdaze »

Greetings Tasmod,
Thanks a bunch for the quick response! I checked the rc.network file and yes it has the "LGPL Barry Kauler 2006, 2007 www.puppylinux.com" line. So, I guess I might find joy yet. I am using Lupu-507 right now, however, I have not checked if Lupu-508 uses the same rc.network file. I will do that next. It would be sad if that gets changed somewhere along the way to a final release. I hope not. I'll post back soon hopefully with good news.


---------------------------------------------------------------------
$$ Don't buy a new computer $$, download a Puppy! :D

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#85 Post by tasmod »

Let me know how you get on Dogdaze and I'll send you the program.

I'm moving on to something else.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

Dogdaze
Posts: 12
Joined: Tue 03 Aug 2010, 07:12

Firewall Status Tray App

#86 Post by Dogdaze »

Tasmod,
Just checked Lupu-508, running it now, and yep, it's all good. The rc.network file has the "LGPL Barry Kauler 2006, 2007 www.puppylinux.com" line. So, I guess I'm set. If you can find the time to post your script that would be great or if you already have it inserted in your tray app the latter would be really sweet. Either way I'm looking forward to trying it. :wink: Thanks so much for all the time and effort, it is greatly appreciated.


--------------------------------------------------------------------
$$ Don't buy a new computer $$, download a Puppy! :D

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#87 Post by tasmod »

Test this one, I haven't, quite tired just now.
Rob
Last edited by tasmod on Fri 06 Aug 2010, 08:15, edited 1 time in total.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

Jasper

#88 Post by Jasper »

Hi,

Thank you for your aplet which works perfectly with lupu 5.0.0.

It would be helpful to have the time checked / reset either on demand or automatically with an "official" clock. May I ask if there is already a PET for that or if you may have any thought of doing that sometime?

My regards

Added:

PS The Internet On / Off buttons do not seem to work.

Dogdaze
Posts: 12
Joined: Tue 03 Aug 2010, 07:12

firewallstate 1.5 dogdaze.pet

#89 Post by Dogdaze »

Hi Tasmod,
Like your previous post, some success. It is sort of funny. The applet loads into the taskbar and right click shows "Internet on/off" when clicked a dialog box pups up with the options "Internet ON or OFF". Clicking either of these buttons does nothing. Strange. However in /tmp/ xerrs.log it reports the following about 20 times.
ash: 9262: unknown operand
ash: 9262: unknown operand
/tmp/pup_event_sizefreem

While on my way to the tmp folder I noticed that the applet copied itself to / so being inquisitive I decided to click on the "netonoff script. Well well! When I clicked "Network Off" it did just that and "Network On "connected immediately. Kind of funny I think, I mean not from the taskbar but certainly works from the / folder. Now, please don't take this the wrong way, I do not mean to be rude, it's like I said earlier, I'm inquisitive. I noticed that in the applet popup the title option reads "Internet On/OFF" and in / the script is named "netonoff" is it possible that it is the names that might be the reason that the option from the tray app does not work? Maybe not linked ? Just a thought. Doesn't really matter to me where it works from just so long as I can disconnect and reconnect whenever I wish is really all I wanted. And you did just that! I'm very happy with the script you gave me. I can always link it to the desktop. The rest of the app works perfectly so no need to bother with the "Internet on/off" unless you want to, of course. Again, thanks so much for fulfilling my request. Wish I code :? Maybe some day...

-------------------------------------------------------------------
$$ Don't buy a new computer $$, download a Puppy! :D

Dogdaze
Posts: 12
Joined: Tue 03 Aug 2010, 07:12

Firewall Status Tray Applet

#90 Post by Dogdaze »

Hi again Tasmod,
Just had a quick look at "firewall1.5.dogdaze.c" noticed that it calls the /etc/rc.d/rc.network routine and does not call or link to the "netonoff" script. So, if you could please just ignore most of my last post I mean this part "Now, please don't take this the wrong way, I do not mean to be rude, it's like I said earlier, I'm inquisitive. I noticed that in the applet popup the title option reads "Internet On/OFF" and in / the script is named "netonoff" is it possible that it is the names that might be the reason that the option from the tray app does not work? Maybe not linked ? Just a thought." Well, if you could pretend that you did not see or read that, that would be just great. I feel rather foolish. Ha ha! Oh well! What's done is done, sorry about that. I also read "netonoff" script which also calls on the same rc.network routine. Has me curious as to why it won't work from the taskbar applet.

-------------------------------------------------------------------
$$ Don't buy a new computer $$, download a Puppy! :D

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#91 Post by tasmod »

OK i've removed the pet. Told you i was tired :lol:

Seems I packed everything in the pet. :oops:

I've looked at the code and i didn't complete the call. It doesn't use netonoff, that was a development item. The netonoff script will work on its own, it uses gtkdialog.

The other netonoff window is generated in the code as is the button press events, however i got the code syntax sent to rc.network incorrect. Just have to work out what it should be, probably a ` or a ' or somesuch.

I made a working hybrid tray app and now I'm drawing back in the external scripts and rewriting them in gtk. This keeps them in the binary when compiled and is what I was aiming for.

I'm not bothered about file size or memory constraints, it's a hobby development that if anyone finds useful then I'm happy.


I've come this far by hard graft and hand coding, it's all new territory and hard to learn at my age anyway. Scripting's fine but I wanted to move on a bit.

Yesterday I realised that what I was doing by hand now over hours, could be done in minutes in Glade Interface Designer. It makes my work seem trivial.

Still, I learned to clear bugs and how the program steps through. I still have Gmailtray with a few problems at the moment trying to encrypt/decrypt within the code to keep the password safe from prying eyes. That will keep me going.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#92 Post by tasmod »

Sir Jasper,

Psync does just that. It's a clever little app that syncs to a group of internet time servers and sets your clock accurately. (Within milliseconds)
It's in the Desktop portion of the main menu or it's in the firewallstate menu in later versions.

The group constantly changes but the program tracks them.

When you first use it, the time is set accurately and when the report appears there's an option button to set it to run at each boot up.

You must have your Timezone set correctly though or else your clock will sync to whichever region you choose.

It's worth reading the Help file by using the Help button, there's an interesting article on 'Time' in there.

I wrote the app in bash and used gtkdialog. It was my first "real" app after pwidgets widgets.

I'm not new to coding but it's many years since i actually did anything useful, until Puppy that is.
My last app was in the early 90's in Visual Basic for Windows and was a commercial piece, a credit card reader program. All hobby stuff.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

Jasper

#93 Post by Jasper »

Hi again Rob,

Thank you for psync. It comes with lupu 508, but it did not come with lupu 5.0.0 which I am using so I downloaded your PET.

It will be of great use to me as I'll be keeping my frugal hard dive installation of 5.0.0 as my principal OS (although I'll install 5.1 when it arrives).

My regards

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#94 Post by jpeps »

tasmod wrote:
I'm not bothered about file size or memory constraints, it's a hobby development that if anyone finds useful then I'm happy.


I've come this far by hard graft and hand coding, it's all new territory and hard to learn at my age anyway. Scripting's fine but I wanted to move on a bit.
It might be helpful to note the cost in RAM. It's easy to suddenly have 100M of processes going on for eye-candy or redundancy. Many users wouldn't know, since they don't use a terminal.

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#95 Post by tasmod »

All the tray apps are about the same amount more or less.

It's a choice thing. It does have a quit option.

You have to remember how this started out, as a first run tray app which was meant to be discarded after using the firewall wizard.

It has grown since then by user request. Earlier in thread I said I would be offering cutdown or fuller featured versions, I was aware of what was happening.

I'm reaching the point where I can't be bothered anymore, I've spent too many hours on this.

Gmailtray is going the same way, fun but now getting tedious, I've cleared many obstacles and almost have it perfect (for me).
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

jpeps
Posts: 3179
Joined: Sat 31 May 2008, 19:00

#96 Post by jpeps »

tasmod wrote:All the tray apps are about the same amount more or less.
Yeah....really adds up. Easily disabled by changing permissions in Startup menu. Links to programs and info files on the tray don't have to involve 13 M processes.

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#97 Post by tasmod »

--
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

big_bass
Posts: 1740
Joined: Mon 13 Aug 2007, 12:21

#98 Post by big_bass »

Hey tasmod

I hope you dont mind this is another topic
but I think you would put this to good use
and somehow add it to a tray app (thats my motive for posting it )


as is its ugly but works :lol:


I use this as reminder while checking how programs are running
I made very minor edits here is the source
http://colby.id.au/node/39
really I just added the launch script


you place this in /usr/sbin called cli_cpu_meter

Code: Select all

#!/bin/bash
# by Paul Colby (http://colby.id.au), no rights reserved ;)


PREV_TOTAL=0
PREV_IDLE=0

while true; do
  CPU=(`cat /proc/stat | grep '^cpu '`) # Get the total CPU statistics.
  unset CPU[0]                          # Discard the "cpu" prefix.
  IDLE=${CPU[4]}                        # Get the idle CPU time.

  # Calculate the total CPU time.
  TOTAL=0
  for VALUE in "${CPU[@]}"; do
    let "TOTAL=$TOTAL+$VALUE"
  done

  # Calculate the CPU usage since we last checked.
  let "DIFF_IDLE=$IDLE-$PREV_IDLE"
  let "DIFF_TOTAL=$TOTAL-$PREV_TOTAL"
  let "DIFF_USAGE=(1000*($DIFF_TOTAL-$DIFF_IDLE)/$DIFF_TOTAL+5)/10"

#### comment next line for use with deskicons
  echo -en "\rCPU: $DIFF_USAGE% "


  # Remember the total and idle CPU times for the next check.
  PREV_TOTAL="$TOTAL"
  PREV_IDLE="$IDLE"

  # Wait before checking again.
  sleep 2
  clear
done

then you run it with this script called mini_cpu_meter it is the launch script

Code: Select all

#!/bin/bash
#worlds smallest console cli app
xterm -geometry 10x1+10+1 -e sh  /usr/sbin/cli_cpu_meter

have fun with it
Joe

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#99 Post by tasmod »

Thanks Joe, looks interesting.

I'll look at that in more detail later today.

Right now I'm very close to completing my "poptray" pop3mail tray app.

It works OK and fetches mail count no problem, but, I have already created my "user details" files.

As a fresh install, first run it errors out and segfaults due to not having 'user details' and I'm now working out how to call the user detail entry window (done) and halt the program whilst the files are created (no success).

The other tray apps were no problem as control was mine, however for the thin mail client it is someone else's library, over which I have no control.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

User avatar
tasmod
Posts: 1460
Joined: Thu 04 Dec 2008, 13:53
Location: North Lincolnshire. UK
Contact:

#100 Post by tasmod »

Couldn't resist it just looked.

Neat little script.

Hmm, icon colour changes coupled with % value tooltip maybe?

Ah, just remembered where idea for thought came from, BKs freememapp does similar thing if memory gets low. Changes icon colour.

Could add this as a tooltip line to firewallstate tooltip?
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

Post Reply