View Single Post
Old 10-05-2003, 06:06 PM  
FTPServerTools
Senior Member
 
Join Date: Sep 2002
Posts: 543
Talking ioFTPD SiteKill for ioFTPD 5.x

Ok after intense testing I am happy to release version 2.0.1 of my SiteKill tool.
Be aware for those that used the version for 4.9.x, some minor changes have been made.
A quick repeat of the docs:
Code:
Parameters are any combination of
The following needs a string to compare and uses =, ==, !=, <> to compare, the string may have wildcards * and ?
When the string itself has a space in it you need to surround the comparison with double quotes
user=username                   - kick on user
ip=ipnr                         - kick on ip
ident=ident@ipnr                - kick on ident@ip
host=hostname                   - kick on hostname
path=somepath                   - kick on virtual path
vpath=somepath                  - kick on virtual path
rpath=somepath                  - kick on real path
file=somepath                   - kick on virtual filepath
vfile=somepath                  - kick on virtual filepath
rfile=somepath                  - kick on real filepath
service=name of service         - kick on servicename
group=groupname                 - kick on main group
groups=groupname                - kick on groups
admingroups=groupname           - kick on admingroups
action=lastaction               - kick on last FTP command
transfer=idle|up|down|list      - kick on transferstate
flags=userflags                 - kick on userflags
tagline=tagline                 - kick on tagline
The following needs a number to compare with and uses =, ==, <>, != to compare, but also <, <=, >, >= when surrounded by double quotes
idle=seconds                    - kick on idlers in seconds
idletime=seconds                - kick on idlers in seconds
logintime=seconds               - kick on logged in how many seconds
listtime=seconds                - kick on list in seconds
upime=seconds                   - kick on busy upload current file in seconds
downtime=seconds                - kick on busy download current file in seconds
listspeed=nr                    - kick on list speed in K/s
upspeed=nr                      - kick on upload speed in K/s
downspeed=nr                    - kick on download speed in K/s
uid=uid                         - kick on uid
gid=gid                         - kick on gid
times=all|once|nr          - Number for the amount of kicks, once, all or a number. all is the default
if you run with the first parameter debug then you get debug info


Due to the windows rdirection (using < and >) you will need to surround your partial or complete query with double quotes.
Also when the string you comapre with has a space in it you need to surround the argument with double quotes.

Be aware that the parameters are used as AND so:
site kill groups=group1 groups=group2
will kill everyone belonging to group1 AND group2.
Thus someone only belonging to group1 will not be killed.


Be aware that the things you type after the = are case insensitive
Allowed for wildcards are * and ?

Examples:
sitekill user=lamer                    - kills the user lamer once
sitekill user=lamer times=once         - kills the user lamer once
sitekill user=lamer times=25           - kills max 25 lamer users
sitekill user=l*r                      - kills users that match the l*r wildcard so lamer looser leecher in this example but not winner
sitekill ip=127.0.0.1                  - kills the 127.0.0.1 connections
sitekill ip=192.168.*.*                - kills the 192.168.*.* connections
sitekill "idletime>120"                - kills idlers that are longer then 120 secs idle
sitekill group=l*s                     - kills connections with main group l*s so leechers, loosers, lamers
sitekill action=noop                   - kills connections where the last command was NOOP
sitekill ident=TEST                    - kills connections with TEST as ident
sitekill user!=sitebot path=/movies/svcd/* "idletime>120"
                                        - kills all connections that are in /path/movies/svcd/ somewhere and that are 120 seconds or 
                                          more idle but dont kill user sitebot in this process
sitekill service=FTP_Service "downspeed<10"
                                        - kill all ftp leechers that are downloading < 10K/s
sitekill "vpath=/Stay out *" "logintime>600"
										- kill all ftp services that are logged in longer then 600 seconds in a path that I dont want them in.


Now if you run this command and it gives back: "uid=-1 can not be found in ..\etc\passwd" or something like that
then you may have a dead connection on your hands. It rarely happens but it can happen tho. Therefore I implemented
site kill uid so you can do site kill uid=-1 which would kill those dead connections.
For completeness I added site kill gid=  as well.


How to use this command in ioFTPD?
Lets say we for example want to kick all idle ftp users.

[Schedule]
KillIdlers  = 0,5,10,15,20,25,30,35,40,45,50,55 * * *       EXEC ..\scripts\SiteKill.exe "idletime>120" service=FTP_Service

or as a site command:
[Scripts]
KILL      = EXEC ..\scripts\sitekill.exe

To run this same command from a tcl script you could use:
[exec -- "c:\\ioFTPD\\scripts\\SiteKill.exe" "idletime>120" "service=FTP_Service"]
You can always grab the newest version from http://ftpservertools.com in the download section.
FTPServerTools is offline   Reply With Quote