Project

General

Profile

ThreatScript Web Client » History » Version 1

Version 1/3 - Next » - Current version
Luke Murphey, 05/19/2010 11:45 PM


ThreatScript Web Client

ThreatScript definitions can actively access and gather information from websites using one of the HTTP request classes. The following classes are available (each corresponding to the associated HTTP verb):

  • GetRequest
  • PostRequest
  • DeleteRequest
  • PutRequest
  • TraceRequest
  • HeadRequest
  • OptionsRequest
/*
 * Name: Example.Test.WebRequest
 * ID: 1200001
 * Version: 1
 * Message: Get the first 24 characters on a web-page
 * Severity: Low
 */

importPackage(Packages.ThreatScript);
importPackage(Packages.HTTP);

function analyze( httpResponse, variables, environment ){
    var get = new GetRequest(httpResponse.getLocation());
    var httpResponse = get.run();
    var s = httpResponse.getResponseBodyAsString();

    if( s == null ){
        return new Result( true, "null");
    }

    return new Result( true, "First 24 characters of page is: " + s.substring(0,24));
}