PDA

View Full Version : ioActivity


esmandil
10-27-2004, 04:12 PM
This script shows list of most recently logged users (with login time and hostnames), recent logins of selected user (with login time and hostnames) and much more.

It stores information in SQL database, so it is very easy to customize output to one's taste.

The idea is based on ioACTIVE script... thanks, Fuscao :D

Sampe output:

command: site activity
200-username last login time host total logins
200----------- ------------------- ----------------------- ------------
200-esmandil2 2004-10-27 22:55:57 hostname1.net.se 10
200-esmandil 2004-10-27 22:01:49 hostname2.net.se 6
200-user1 2004-10-27 22:01:46 hostname3.net.se 6
200-user3 2004-10-27 19:55:47 hostname4.net.se 7
200-user2 2004-10-27 17:54:49 hostname5.net.se 4
200-user4 2004-10-27 17:43:19 hostname6.net.se 3
200-user5 2004-10-27 16:09:24 hostname7.net.se 1
200 Command successful.

command: site activity 2
200-username last login time host total logins
200----------- ------------------- ----------------------- ------------
200-esmandil2 2004-10-27 22:55:57 hostname1.net.se 10
200-esmandil 2004-10-27 22:01:49 hostname2.net.se 6
200 Command successful.

command: site useractiv esmandil
200-username login time host
200----------- ------------------- -------------------
200-esmandil 2004-10-27 22:01:49 hostname7.net.se
200-esmandil 2004-10-27 21:12:58 hostname7.net.se
200-esmandil 2004-10-27 01:45:30 hostname2.net.se
200-esmandil 2004-10-26 19:45:07 hostname2.net.se
200-esmandil 2004-10-26 19:45:04 hostname1.net.se
200 Command successful.

command: site myactivity
200-username login time host
200----------- ------------------- -----------------------
200-esmandil2 2004-10-27 22:55:57 hostname2.net.se
200-esmandil2 2004-10-27 22:40:01 hostname4.net.se
200-esmandil2 2004-10-27 21:12:35 hostname5.net.se
200-esmandil2 2004-10-27 20:52:39 hostname1.net.se
200-esmandil2 2004-10-27 01:45:39 hostname1.net.se
200 Command successful.

Download:
http://www.ioftpd.com/scripts/script.php?id=147

offline
10-27-2004, 11:37 PM
This script looks awsome.

But I have some problems when I install it. Is there anyone except me who got this one working? Need to know if am noob or what cuz I followed the readme, and still

site myactivity 5
550 Command failed.
site activity 5
550 Command failed.
site myactivity 5
550 Command failed.
site myactivity
550 Command failed.

:(

MaZza_Dj
10-28-2004, 03:40 AM
The same from me....

[R] site myactivity
[R] 550 Command failed.

[R] site activity
[R] 550 Command failed.

[R] site useractiv <user>
[R] 550 Command failed.

esmandil
10-28-2004, 03:45 AM
Oooops :o I have just noticed that I have included old version of Readme in the download. Sorry about that.

Lines to be added to ioFTPD.ini look like this:


[Events]
OnFtpLogIn = %EXEC ..\scripts\ioActivity\run.bat newlogin %[$user] %[$hostname]

[FTP_Custom_Commands]
activity = EXEC ..\scripts\ioActivity\run.bat activity
useractiv = EXEC ..\scripts\ioActivity\run.bat useractiv
myactivity = %EXEC ..\scripts\ioActivity\run.bat useractiv %[$user]

[FTP_SITE_Permissions]
activity = 1M
useractiv = 1M
myactivity = !A *


Hopefully, it will work better now :rolleyes:

Grendel
11-02-2004, 02:43 PM
works fine now... ;) THX !!! :D


my requests for future versions...

1) PURGEACTIVITY ALL
(for resetting the DB)

2) PURGEACTIVITY ALL FROM <DATE> [TO <DATE>]
(for deleting ALL older entries with time-range

3) PURGEACTIVITY <USERNAME>
(for deleting ALL entries for a user

4) PURGEACTIVITY <USERNAME> FROM <DATE> [TO <DATE>]
(for deleting older entries for a user with time-range



...this would be very nice and a good roundup :cool: :D

Devianced
11-03-2004, 03:08 PM
Yeah esmandil,
thanks for #1 script :-) works fine.

Gr€€tZ Deva :banana:

esmandil
11-04-2004, 09:18 AM
OK, purgeactivity option added. A bit simpler than what you suggested, Grendel, but I hope this will be enough. Let me know if there is anything more you need... and remember that it is *really* easy to customize things :D


site purgeactivity all
Remove all data more than 30 days old
site purgeactivity all 100
Remove all data more than 100 days old
site purgeactivity all 0
Remove all data
site purgeactivity ioFTPD
Remove all data for user ioFTPD that is more than 30 days old
site purgeactivity ioFTPD 0
Remove all data for user ioFTPD

Grendel
11-04-2004, 11:42 AM
Very good, esmandil

Great work :-)

Big THX for fast reaction.


:banana: :D :banana: :p :banana: ;)

odd
12-09-2004, 05:29 AM
Nice script I must say. Just one tiny thing that would make it perfect.

* Exclude user (exculed user to beeing logged or beeing showed)

Is this possible?

Grendel
12-09-2004, 02:26 PM
Yep, edit activity.sh


# usage: sh.exe activity.sh [limit]
# Prints recently logged-in users, including login time and host.

if [ $1 ]; then
LIMIT=$1
else
LIMIT=10
fi

./cat.exe << EOF | ./sqlite3.exe -header -column ./login.db
SELECT l.user AS username, l.time AS 'last login time', l.ip AS host, count(*) AS 'total logins'
FROM loginsLast l, loginsAll a
WHERE l.user=a.user
AND l.user!='aaa'
AND l.user!='ioFTPD' <<< INSERT USERS HERE >>>
GROUP BY a.user
ORDER by l.time desc
LIMIT $LIMIT;
EOF

esmandil
12-10-2004, 02:15 PM
Odd wrote:
* Exclude user (exculed user to beeing logged or beeing showed)

As Grendel wrote, edit activity.sh. But note it will only exclude user from being shown. I don't imagine why would you like to exclude him from being logged ;-) - but if you really want to, you can edit newlogin.sh and add some checks there.

MrJoshua
12-10-2004, 10:11 PM
Heya guys
Im reasonbly new to whole ioFTPD thing, but over the last month i have learned alot. I have installed ioActivity and made the necessary changes to the ioFTPD.ini
these are the changes i made

[Events]
;OnFtpLogIn = %EXEC ..\scripts\ioActivity\run.bat newlogin %[$user] %[$hostname]

[FTP_Custom_Commands]
activity = EXEC ..\scripts\ioActivity\run.bat activity
useractiv = EXEC ..\scripts\ioActivity\run.bat useractiv
myactivity = %EXEC ..\scripts\ioActivity\run.bat useractiv %[$user]

[FTP_SITE_Permissions]
activity = 1M
useractiv = 1M
myactivity = !A *


i unrared all the files contained in the ioActivity.zip into my script folder.

Now when i either send the command thru ioGui2 or via FFXP this is the output i get

1:12:34 PM > site activity
1:12:35 PM 200-username last login time host total logins
1:12:35 PM 200----------- ------------------- ---------- ------------
1:12:35 PM 200-aaa 2004-10-28 10:16:53 bbb 1
1:12:35 PM 200 Command successful.

thing is, there is no user named aaa on my ftp and the login date was months ago, and this is the only user that shows up.

I tried purging the users logfiles and this is the output i get

8:59:40 AM > site purgeactivity all
8:59:40 AM 500 SITE purgeactivity: Command not understood.
9:00:56 AM > site purgeactivity all 0
9:00:56 AM 500 SITE purgeactivity: Command not understood.


could someone point me in the right direction on how to fix this please? also thx for the great scripts.
cheers :) :)
EDIT: i noticed that after i posted this, all my backslashs \ have been removed?

Grendel
12-11-2004, 08:05 AM
yep, as you said....your path is incorrect in every line


and carefully read the activity.sh file....


# usage: sh.exe activity.sh [limit]
# Prints recently logged-in users, including login time and host.

if [ $1 ]; then
LIMIT=$1
else
LIMIT=10
fi

./cat.exe << EOF | ./sqlite3.exe -header -column ./login.db
SELECT l.user AS username, l.time AS 'last login time', l.ip AS host, count(*) AS 'total logins'
FROM loginsLast l, loginsAll a
WHERE l.user=a.user
/* AND l.user!='aaa' */ -- uncomment this to exclude user 'aaa'
GROUP BY a.user
ORDER by l.time desc
LIMIT $LIMIT;
EOF

esmandil
12-11-2004, 08:45 AM
Two things, MrJoshua:

1) Remove the ";" from the beginning of this line:
;OnFtpLogIn = %EXEC ..scriptsioActivityrun.bat newlogin %[$user] %[$hostname]
Basically, ";" makes io think it is a comment - so ioActivity is not executed when users log in... ergo, it cannot log those logins.

2) You are missing "purgeactivity" in "[FTP_Custom_Commands]" - thus, io doesn't understand this command. Add it (as described in the readme) and it should work.

MrJoshua
12-12-2004, 01:33 AM
Ahh yes my bad, thx for the replys, all fixed now :)
cheers :) :)

odd
12-12-2004, 09:26 AM
I just want to point out that site purgeactivity user 0 is deleteing the hole database. If its just me, let me know.

esmandil
12-12-2004, 04:33 PM
No, it's not you... it's a typo on my side :D Thanks for the report.

Fixed in just uploaded 0.96 version (I hope).