Submit a ticketCall us

Webinar: Web Help Desk for HR, Facilities and Accounting Departments
This webinar will focus on use cases for HR, Facilities and Accounting.

Having a unified ticketing and asset management system for all the departments in your company can provide end-users with a seamless experience and make things easier for your IT team. Yet, with different business tasks and objectives, many departments don’t fully understand the capabilities of Web Help Desk and how the software can be customized for effective use in their departments.
Register Now.

Home > Success Center > Kiwi CatTools > Kiwi CatTools 3.11 Administrator Guide > Menus > Options > TFTP Server > Scripting Options

Scripting Options

Table of contents
No headers

To set scripting options, choose Options >??Setup > TFTP Server >??Scripting Options.

This pane allows you to specify vbscripts that will be run before and/or after a TFTP session.


Use the tick boxes to determine whether a script will be run and enter the full path to the script in the appropriate text box.


Timing Issues

It's important to note that you only have 1 second to get everything done in the pre-session external script and return a value otherwise the TFTP session times out, and retries.


Scripting Information

Your script must start with Function Main(session) where session is the TFTP session being passed in.

If the script is successful it should return a value of True which will allow the TFTP session to continue.


Returning a value of False will cause the TFTP session to abort.

For security reasons if the script can not be loaded or if the script fails then the TFTP session will be aborted.


You can access the following properties of the session:

Session.CreatTime The time the session was started by the host. (Actually represented as the number of seconds from midnight 1/1/1970 UTC).
Session.FileName The name of the file to be written.
Session.FileSize The size of the file on the server for a'Get' operation. (Will be zero fo a 'Put' operation.)
Session.Host The IP address of the remote client represented as a long. (Converted from an 8 digit hex value.)

The IP address of the remote client represented as a string. i.e.

Session.Port The TFTP Port on the remote client.

The number of bytes transferred so far.

Note: in the pre-session script this will be zero and in the post session script this should be the the whole file file size.


Upload for a Put. Download for a Get.


Example Scripts:

The script below checks the host address of the remote client issuing a 'Put'.

If it matches a certain address then the filename is changed.


Rename of the file based on host address:

Function Main(session)

Main= False

With session

If .HostS = "" Then

.FileName = "NewFileName.txt"

End If

End With

Main= True

End Function


Reject a file based on the time of day:

Function Main(session)

Dim CreateHour

Main= False

With session

'convert the create time from the unix format to the current time

CreateHour = DateAdd("s", session.CreateTime, DateSerial(1970, 1, 1))

'convert to 24 hour format

CreateHour = FormatDateTime(CreateHour, vbShortTime)

'seperate out the hour value only

CreateHour = DatePart("h", currentTime)

Select Case CreateHour

'reject files created two hours either side of midnight

Case 1,22,23,24

'accept files created at any other time


Case Else


End Select

End With

End Function

Note: At the moment there is a bug where if a script is triggered in the pre-session event that renames the filename e.g.. .FileName = "NewTestFileName.txt" The file is put into the TFTP folder with the filename correctly changed to NewTestFileName.txt but the existing 'Test.txt' file in the TFTP folder is deleted.


Last modified
10:56, 2 Sep 2016


This page has no custom tags.