![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Nov 2004
Posts: 47
Rep Power: 0
![]() |
Hi, There is a program out called Tripwire for linux users. It checks for File permissions and if its been edited etc.. I wanted to know if anyone has anyidea on make a simple program to replicate Tripwire...by making a pop up window that shows when a user logs in/out and when a file is edited
|
|
|
|
|
|
#2 |
|
Professional Programmer
Join Date: Nov 2004
Posts: 250
Rep Power: 4
![]() |
Checking file accesses and permissions is trivial:
#include <sys/stat.h>
time_t last = 0; /* Set to the previous modification */
int was_modified ( const char *path )
{
struct stat buf;
if ( stat ( path, &buf ) != -1 ) {
if ( last == 0 ) {
last = buf.st_mtime;
return 1;
}
else if ( last != buf.st_mtime )
return 1;
}
return 0;
}
int is_writable ( const char *path )
{
struct stat buf;
if ( stat ( path, &buf ) != -1 )
return ( buf.st_mode & ( S_IWUSR | S_IWGRP ) ) != 0;
return 0;
} |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Nov 2004
Posts: 47
Rep Power: 0
![]() |
I understand, would it be easier if another terminal window opened..Thanks for your reply
|
|
|
|
|
|
#4 |
|
Professional Programmer
Join Date: Nov 2004
Posts: 250
Rep Power: 4
![]() |
>would it be easier if another terminal window opened..
Is this a question or just poor word ordering? Yes, it would be easier because you wouldn't get bogged down in the details of creating and manipulating a window. You can simply use an existing program like xterm to do all of that for you, so that the end result is you simply write text to the standard output and everything will "just work". |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
Join Date: Oct 2004
Location: England, UK
Posts: 139
Rep Power: 0
![]() |
I think Eggbert is Dennis Ritchie in disguise!
__________________
Don't wound what you can't kill |
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() ![]() |
Eggbert is the resident wizard! Btw, Stewey kicks ass
![]()
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
|
#7 |
|
Expert Programmer
|
Resident Wizard? lol
And as a follow-up, yes Stewie does kick ass ![]()
__________________
Clifford Matthew Roche <geek@cliffordroche.com> Web Hosting: http://www.crd-hosting.com Consulting: http://www.crdev-consulting.com |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|