Old 10-27-2004, 04:12 PM   #1
esmandil
Senior Member
FlashFXP Registered User
ioFTPD Foundation User
 
Join Date: Oct 2004
Posts: 107
Default ioActivity

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

Sampe output:
PHP Code:
commandsite 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
.

commandsite 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
.

commandsite 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
.

commandsite 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
esmandil is offline   Reply With Quote
Old 10-27-2004, 11:37 PM   #2
offline
Junior Member
 
Join Date: Oct 2004
Posts: 7
Default

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.

offline is offline   Reply With Quote
Old 10-28-2004, 03:40 AM   #3
MaZza_Dj
Senior Member
ioFTPD Foundation User
 
Join Date: Oct 2003
Posts: 123
Default

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.
MaZza_Dj is offline   Reply With Quote
Old 10-28-2004, 03:45 AM   #4
esmandil
Senior Member
FlashFXP Registered User
ioFTPD Foundation User
 
Join Date: Oct 2004
Posts: 107
Default

Oooops 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:

PHP Code:
[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 
= !
Hopefully, it will work better now
esmandil is offline   Reply With Quote
Old 11-02-2004, 02:43 PM   #5
Grendel
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Grendel's Avatar
 
Join Date: Jul 2004
Posts: 187
Default

works fine now... THX !!!


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
__________________
- FlashFXP v4.0 BETA (v3.7.9 Build 1401) registered
- Windows 7 x64
- McAfee Antivirus Enterprise 8.7i Patch 2 + Antispyware 8.7i
Grendel is offline   Reply With Quote
Old 11-03-2004, 03:08 PM   #6
Devianced
Member
 
Join Date: Sep 2004
Posts: 37
Default

Yeah esmandil,
thanks for #1 script :-) works fine.

Gr€€tZ Deva :banana:
Devianced is offline   Reply With Quote
Old 11-04-2004, 09:18 AM   #7
esmandil
Senior Member
FlashFXP Registered User
ioFTPD Foundation User
 
Join Date: Oct 2004
Posts: 107
Default

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

PHP Code:
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 
esmandil is offline   Reply With Quote
Old 11-04-2004, 11:42 AM   #8
Grendel
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Grendel's Avatar
 
Join Date: Jul 2004
Posts: 187
Default

Very good, esmandil

Great work :-)

Big THX for fast reaction.


:banana: :banana: :banana:
__________________
- FlashFXP v4.0 BETA (v3.7.9 Build 1401) registered
- Windows 7 x64
- McAfee Antivirus Enterprise 8.7i Patch 2 + Antispyware 8.7i
Grendel is offline   Reply With Quote
Old 12-09-2004, 05:29 AM   #9
odd
Senior Member
ioFTPD Registered User
 
Join Date: Sep 2003
Posts: 273
Default

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?
odd is offline   Reply With Quote
Old 12-09-2004, 02:26 PM   #10
Grendel
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Grendel's Avatar
 
Join Date: Jul 2004
Posts: 187
Default

Yep, edit activity.sh

Code:
# 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
__________________
- FlashFXP v4.0 BETA (v3.7.9 Build 1401) registered
- Windows 7 x64
- McAfee Antivirus Enterprise 8.7i Patch 2 + Antispyware 8.7i
Grendel is offline   Reply With Quote
Old 12-10-2004, 02:15 PM   #11
esmandil
Senior Member
FlashFXP Registered User
ioFTPD Foundation User
 
Join Date: Oct 2004
Posts: 107
Default

Odd wrote:
Quote:
* 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.
esmandil is offline   Reply With Quote
Old 12-10-2004, 10:11 PM   #12
MrJoshua
Junior Member
 
Join Date: Dec 2004
Posts: 2
Default

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
PHP Code:
[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 
= !
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
PHP Code:
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
PHP Code:
8:59:40 AM site purgeactivity all
8
:59:40 AM 500 SITE purgeactivityCommand not understood.
9:00:56 AM site purgeactivity all 0
9
:00:56 AM 500 SITE purgeactivityCommand 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?
MrJoshua is offline   Reply With Quote
Old 12-11-2004, 08:05 AM   #13
Grendel
Senior Member
FlashFXP Beta Tester
ioFTPD Scripter
 
Grendel's Avatar
 
Join Date: Jul 2004
Posts: 187
Default

yep, as you said....your path is incorrect in every line


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

Code:
# 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
__________________
- FlashFXP v4.0 BETA (v3.7.9 Build 1401) registered
- Windows 7 x64
- McAfee Antivirus Enterprise 8.7i Patch 2 + Antispyware 8.7i
Grendel is offline   Reply With Quote
Old 12-11-2004, 08:45 AM   #14
esmandil
Senior Member
FlashFXP Registered User
ioFTPD Foundation User
 
Join Date: Oct 2004
Posts: 107
Default

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.
esmandil is offline   Reply With Quote
Old 12-12-2004, 01:33 AM   #15
MrJoshua
Junior Member
 
Join Date: Dec 2004
Posts: 2
Default

Ahh yes my bad, thx for the replys, all fixed now
cheers
MrJoshua is offline   Reply With Quote
Reply

Tags
200-esmandil, 200-esmandil2, 2004-10-27, command, download

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:35 PM.

Parts of this site powered by vBulletin Mods & Addons from DragonByte Technologies Ltd. (Details)