Firewall status tray icon - firewallstate-2.1

Configuration wizards, scanners, remote desktop, etc.
Post Reply
Message
Author
User avatar
Billtoo
Posts: 3720
Joined: Tue 07 Apr 2009, 13:47
Location: Ontario Canada

Firewall status tray icon applet - firewallstate.0.6

#16 Post by Billtoo »

tasmod wrote:ver 0.6

Thanks to vovchik -

Should work in earlier versions. It checks for existence of DISTRO_SPECS if it is not found it defaults to '/etc/puppyversion' and returns that information.
I downloaded version 0.6 and installed the pet, I was in icewm at the time and your pet didn't work.I switched to jwm and it does work now but it says version 0.5.
I also tried it in fatdog64 and it wouldn't work in jwm so I removed the pet in ppm.

Hope this helps

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

#17 Post by tasmod »

Version 0.7 released with new icons and dependency.

Billtoo, apologies for the version info return, I forgot to update that line in the code.

Slaps back of own hands, naughty boy. :oops:

I don't use icewm so I can't test that, Micko said it worked in Lucid 212 in icewm.

I have made a few changes to the code right now, so try ver0.7 and please report back.

fatdog64 I've no idea what it looks like!

Does the icon appear in tray?
Does it show a blank?
If you right click either icon or blank does the menu come up.
If it does, does Version information work?

If you run it from a terminal does it show any error message?

I'm aware that in a fresh install of slaxerpup it complains of missing libgio.

Small plans for v0.8

Return your own IP, country in use, language and keyboard.

Just ideas at moment, not yet made any code.

Edit: keyboard info done.
Last edited by tasmod on Mon 19 Jul 2010, 09:42, edited 1 time in total.
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#18 Post by 01micko »

Still looks ok to me Rob in Icewm (oh and I fixed my Ice bug :wink: )

Cheers
Attachments
fw-state.png
(72.66 KiB) Downloaded 1809 times
Puppy Linux Blog - contact me for access

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#19 Post by vovchik »

Dear Rob,

Works fine in 3.x and 4.x. Thanks for the nice work....

With kind regards,
vovchik

PS. I think you could safely add a desktop file (/usr/share/applications) to the pet and have it appear under Network. I did that manually and used you "OK" icon.

User avatar
Billtoo
Posts: 3720
Joined: Tue 07 Apr 2009, 13:47
Location: Ontario Canada

Firewall status tray icon applet - firewallstate.0.7

#20 Post by Billtoo »

tasmod wrote:Version 0.7 released with new icons and dependency.

Billtoo, apologies for the version info return, I forgot to update that line in the code.

Slaps back of own hands, naughty boy. :oops:

I don't use icewm so I can't test that, Micko said it worked in Lucid 212 in icewm.

I have made a few changes to the code right now, so try ver0.7 and please report back.

fatdog64 I've no idea what it looks like.
I booted luci-213 with prefix=ram
I installed your pet and it worked.
I downloaded icewm from puppy package manager after I updated ppm.
When I clicked on the icewm pet a screen popped up and I have attached a screenshot (icewm.jpeg) of that.

In fatdog 64 I installed your pet and restarted xserver.
I noticed a greater distance between blinky and the clipboard icons in the lower right corner.
I right clicked (may have been left I forget) over the area where the firewall applet should be.
The attachment (firewall.jpg) is a screenshot of that.

thanks
Attachments
firewall.jpg
(101.31 KiB) Downloaded 1785 times
icewm.jpg
(70.18 KiB) Downloaded 1638 times

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

#21 Post by tasmod »

Version 0.8 released.

has added info to menu item 'Version information'

I'm working on an all C solution using curl for the IP reporting. Right now it runs a small script.


Billtoo,

Icewm
Yes, this report means libgio is missing.

Because I have so much installed on my machine it is hard to know what else is required for firewallstate to work for someone else.

You should be able to download it from package manager.

fatdog 64,
looks like a gtk version problem or tray is different
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#22 Post by vovchik »

Dear Rob,

Version 0.8 introduces three unnecessary dependencies:

libkrb5support
libgssapi_krb5
lincurl_gnutls

There are easier ways to get the external IP, e.g.:

wget -qO- whatismyip.org

I would revert to the v. 0.7 way of doing things and add the above line in a system call for simplicity's sake.

With kind regards,
vovchik

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

#23 Post by tasmod »

vovchik, that is how it's done.

it may be that because I listed libgio as a dependency it is asking for them.

I have a CURL routine that is not working correctly, it won't write to the file. So as a temporary fix i made a call to an external bash script.

Code: Select all

{  /* Get your IP address from tmp file */

   fp = (FILE *)popen("cat /tmp/ipis.txt |  awk '{print $1}'  " , "r" );

    fgets(ipis,sizeof ipis,fp);
    pclose(fp);
    
}
script

Code: Select all

#!/bin/bash

`wget -O /tmp/ipis.txt -q icanhazip.com`
echo "`cat /tmp/ipis.txt`"    #A test
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:

#24 Post by tasmod »

This is the CURL section that won't play ball, I'm sure I have something wrong in write_data

All this and two lines in bash does it :-

Code: Select all

/*//////////////////////////////////////////////////* For the CURL routine below */

static size_t write_data(void *ptr, size_t size, size_t nmemb, void *stream)
{
  int written = fwrite(ptr, size, nmemb, (FILE *)stream);
  return written;
}
 


///////////////////////////////////////////////////// Should run IP routine but doesn't write

*/
gboolean ISip(gpointer ptr);

gboolean ISip(gpointer ptr)   {      //Create file, write returned IP and then open file and read.
   
CURL *curl;
	 
curl = curl_easy_init();

if(curl) {
fp =(FILE *) fopen("/tmp/ip.txt","w");
curl_easy_setopt(curl, CURLOPT_URL, "http://www.icanhazip.com");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_data);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp);

curl_easy_cleanup(curl);

fclose(fp);
}

{

fp =(FILE *) fopen("/tmp/ip.txt","r");

 fgets(ipresult,sizeof ipresult,fp);

 fclose(fp);

}
}


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:

#25 Post by tasmod »

Arghhhh, just realised I left the #include <curl/curl.h> in the code and I may have another lib missing so the curl won't work anyway. :evil: :evil:

Thanks vovchik, I will remake the pet.
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:

#26 Post by tasmod »

Version 0.9 with removed lib call and added Network IP to reporting
Rob
-
The moment after you press "Post" is the moment you actually see the typso 8)

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#27 Post by vovchik »

Dear Rob,

Yep, you got rid of the curl dependencies nicely and it all works except of the local IP, which is wrong. In my case it shows 192.168.1.0 as the local network, when, in actual fact, it is 192.168.2.x. Look at the way I did it in ipinfo - which you scrapped because it's not in all puppies. I also did another checkip prog
http://www.murga-linux.com/puppy/viewto ... 02&t=56678 that checks the entire local network, but you probably don't want to use that because it takes 45 secs to get all live IPs on a LAN (ping takes over 4 minutes!). However, there is probably a routine in it that just grabs the local machine IP expenditiously. I can't remember.

Nice work.

With kind regards,
vovchik

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

#28 Post by tasmod »

Hi vovchik,

Yes, I removed the ipinfo as I wasn't sure if it would work with earlier puppys. I also didn't want to force on someone another app in the pet, rather just make a call to it from code.

Network IP is not the machines own ip but the base ip of the router.

Seems no-one wants that.

OK I believe there is a list of connected pcs in /etc/hosts. However I can only print one so far to the Version Information , I'm not sure yet how to make additional lines display, all calls stop at single line when newline is met in the array. i need to trap them out then re-insert during display.
I've been working on that one but for now was happy to just have a working app.

Micko reports that the report-video just flashes on briefly in the luci version. I can't get it to do that, it works for me.
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

#29 Post by big_bass »

vovchick you posted this on the other page I like that

Code: Select all

#!/bin/sh
myfile="$@"
gcc `pkg-config --cflags --libs gtk+-2.0` -o "$myfile" "$myfile".c
strip "$myfile"

I had some fun with it and added a little cream to your strawberry dessert :D
you can compile the c code in this thread with it

Code: Select all

#!/bin/sh

# drag N drop c compiler 
# gcc  compiler flags config by vovchick 
# file filters , Xdialog and gcc version checking by big_bass
# 7-19-2010 

MY_CFILE="$@"
DIR_N=`dirname "$@"`
MY_FILE=`basename "$@" .c`



#check gcc version 
gcc_version=`gcc -dumpversion`



Xdialog --title "gcc version" \
        	     --infobox "\ngcc version $gcc_version\n" 0 0 2000



if echo `basename "$@"` | grep -q '.c$'; then
Xdialog --wrap --title "COMPILE" \
        --yesno "Do you want to compile  $@  " 0 0

case $? in
  0)
    echo "Yes chosen."
	
  gcc `pkg-config --cflags --libs gtk+-2.0` -o  "$DIR_N"/"$MY_FILE" "$MY_CFILE"  
    strip "$DIR_N/$MYFILE"
	;;
  1)
    echo "No chosen."
    exit
	;;
  255)
    echo "Box closed."
    exit
	;;

esac

Xdialog --title "Complete" \
        	--infobox "\nConversion to $MY_FILE bin has finished.\n" 0 0 4000

else

 


Xdialog --title "ERROR MESSAGE  drag N drop" \
	    --msgbox "only C code allowed  " 0 0

case $? in
  0)
    echo "OK"
	exit
	;;
 
 255)
    echo "Box closed."
	exit
	;;
esac
 					  
fi				  
		
Attachments
c-compiler.tar.gz
(652 Bytes) Downloaded 1152 times

User avatar
vovchik
Posts: 1507
Joined: Tue 24 Oct 2006, 00:02
Location: Ukraine

#30 Post by vovchik »

Dear Joe,

Thanks....

I like that.

With kind regards,
vovchik

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

#31 Post by tasmod »

Version 1.0 and also Luci specific Version 0.4 released.
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

#32 Post by big_bass »

Hey tasmond
thanks for posting the C source because you did I was able to locate
an error I had
line 109 had a string compare for /etc/rc.d/rc.local
and since I had a comment I wrote in that file the compare failed


that was a unique problem to slaxer_pup and TXZ_pup that is now fixed
since I use TXZ formatted packages and slack-desc for my build this is the official "your official"
http://www.puppy2.org/slaxer/firewallst ... 3_SLXR.txz



easy fix I just cleaned the file back to the default

Code: Select all

echo '#this file called from rc.sysinit
#you can edit this file
#When firewall is installed, will append lines to this file...
#--------------------------------------------------------------'>/etc/rc.d/rc.local

and your latest Version 1.0 is confirmed to work now with that small patch

can we get the new state to refresh without restarting X ?
I tried a small app that I used many times called refresh X
but it doesnt update jwm I'll keep at that refreshing part till I figure out how

P.S firewallstate-1.0 you should put a "-" symbol in the package name to maintain the package standard

nice app 8)
Joe

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

#33 Post by tasmod »

Hi Joe,

I'm somewhat confused as to what is happening re X for you.

Are you saying any firewall state change is not reflected immediately by the icon?

It should be virtually instant to the user. The check routine runs every few milliseconds. I thought originally the routine would hog any processor but it doesn't go above 1% and it's probably less as that's the lowest figure htop can report.

I checked for the line in rc.local as that is appended / removed depending on the firewall install and if my original on/off pet is used.
(I wrote it a while ago to turn firewall on/off when testing)

I borked my Slaxerpup install and need to install it again to check -1's operation with it.

Sorry re the naming convention, it only takes one slip when making the pet and it's in there!

I'm working on 1.1 as I've realised I've only a wired connection here and a wireless connection is not catered for in network address report, it uses ifconfig. I need iwconfig checking as well.
I need my garage laptop back in to check the wireless setup, I use it in there on wireless when I'm playing with my car ecu.

I also need to add more file 'not exist' error checking. It's OK making it work on my machine but I have loads installed on here that can affect the running of firewallstate. What works for me may not for others.
I have the devx and other libraries loaded, so I'm now checking it all out on a fresh frugal install on another laptop.

My next learning step is separate c and h files with 'make' but I'm not sure where to go just yet. I don't know what can be hived off and what is needed left in the 'interval' routine. Or even how to deal with them in code as I'm still unsure of 'static' 'void' etc uses.

I'm looking for a good online primer, I have some which are good on some features of C and others that are good on different features.
It's tiring going back and forth between them and trying to understand.

I'm on the steep part of the learning curve right now and as computers are a lone hobby there's only the net to ask.
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

#34 Post by big_bass »

Hey Rob (tasmond)
Are you saying any firewall state change is not reflected immediately by the icon?
yes

X has to be restarted to show the change state from on to off

*side note : there was a problem with a mouse cursor program that trio wrote that
x refresh fixed instead of restart X its a small bin I made a pet a while ago



Joe

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#35 Post by 01micko »

Hi Rob

Using your luci version 0.4 in luci-213 I get this error in /tmp/xerrs.log

Code: Select all

rxvt: "report-video": malformed option.
rxvt-unicode (urxvt) v9.05 - released: 2008-06-15
options: xft,styles,combining,blink,encodings=eu+vn,transparent,tint,XIM,frills,
selectionscrolling,wheel,slipwheel,smart-resize,cursorBlink,pointerBlank,scrollbars=plain+rxvt
Usage: rxvt [-help] [--help]
 [-display string] [-tn string] [-geometry geometry] [-C] [-iconic]
 [-cd string] [-/+rv] [-/+ls] [-/+j] [-/+ss] [-/+ptab] [-/+sb] [-/+sr] [-/+st]
 [-sbt number] [-/+si] [-/+sk] [-/+sw] [-/+ip] [-/+tr] [-tint color]
 [-sh number] [-/+ut] [-/+vb] [-/+tcw] [-/+insecure] [-/+uc] [-/+bc] [-/+pb]
 [-bg color] [-fg color] [-hc color] [-cr color] [-pr color] [-pr2 color]
 [-bd color] [-fn fontname] [-fb fontname] [-fi fontname] [-fbi fontname]
 [-/+is] [-im name] [-pt style] [-imlocale string] [-imfont fontname]
 [-name string] [-title string] [-n string] [-sl number] [-embed windowid]
 [-depth number] [-/+override-redirect] [-pty-fd fileno] [-/+hold] [-w number]
 [-b number] [-/+bl] [-lsp number] [-/+sbg] [-mod modifier] [-/+ssc] [-/+ssr]
 [-e command arg ...]
If I use Icewm I get it twice! (this is because for icewm, it needs to be killed and restarted to display correctly in the tray, it's an ice thing :wink: )

"report-video" is working though.. I'm just wondering why it's trying to execute (as I understand it, could be wrong) at the initiation of firewallstate.

If the error is nothing, I can suppress it, however I believe it's harmless but not nothing.

Cheers

Mick
Puppy Linux Blog - contact me for access

Post Reply