From Syhunt |

Docs: Syhunt Hybrid: Lua API

The information in this document applies to version 6.9.12 of Syhunt Hybrid.

Table of Contents

Introduction
Launch a Dynamic Scan
Launch a Source Code Scan
Get the results of a scan
Generate a scan report or export
Get session details
Email a report
Update Syhunt preferences
Additional API functions and objects

Introduction

Syhunt Hybrid Platinum comes with a simple, easy-to-use Lua API that allows to launch dynamic and source code scans, get status, report and log of a launched scan session, and more.

Loading the Syhunt library

Before using Syhunt's Lua API, you must load the Syhunt library:


-- From GUI app
require "SyMini"
-- From Console app
require "SyMini.Console"

Launch a Dynamic Scan


local res = symini.scantask_launch({
  sessionname = "Test",
  starturl = "http://127.0.0.1",
  huntmethod = "appscan",
  reporttemplate = "Complete"
})
if res.result == true then
  print(res.sessionname)
end

Keys explained:

Return table keys:

Launch a Source Code Scan


-- Scan a local directory
local res = symini.scantask_launch({
  sessionname = "Test",
  sourcetarget = "P:\\Private\\MyWebApp\\",
  huntmethod = "normal",
  reporttemplate = "Complete"
})

-- Scan a project URL
local res = symini.scantask_launch({
  sessionname = "Test",
  sourcetarget = "https://github.com/drnic/php-helloworld.git",
  sourcebranch = "master",
  huntmethod = "normal",
  reporttemplate = "Complete"
})

if res.result == true then
  print(res.sessionname)
end

Keys explained:

Return table keys:

Get Results (Status, report or log)

Get Status


local res = symini.scantask_getresults({
  sessionname = "Test",
  resulttype = "status"
})

Keys explained:

Return table keys:

Get Report


local res = symini.scantask_getresults({
  sessionname = "Test",
  resulttype = "report_xml"
})

-- Alternatively you can obtain the JSON report
local res = symini.scantask_getresults({
  sessionname = "Test",
  resulttype = "report_json"
})

Get Log


local res = symini.scantask_getresults({
  sessionname = "Test",
  resulttype = "session_log"
})

The return will contain the scan log in text format.

Generate a scan report or export


local res = symini.genreport({
    sessionname = 'mysessionname',
    outfilename = 'myreport.pdf',
    template = 'Standard'
})

Keys explained:

Return table keys:

Get session details


local res = symini.getsessiondetails('mysessionname')

Return table keys:

Email a report


local res = symini.emailreport({
    tracker = 'myemailtrackername',
    filename = 'myreport.pdf',
    subject = 'My Test Report'
})

Keys explained:

Return table keys:

Update Syhunt preferences

A list of available preference IDs is available here.


-- Update a site preference
local res = symini.prefs_set('enabled', true, 'http://127.0.0.1')
-- Update a global preference
local res = symini.prefs_set('hybrid.report.company.logo.url', 'https://www.mydomain.com/mylogo.png')
if (res.result == true) then
  print('Preference updated.')
end

Return table keys:

Additional API functions

The scantools repository includes additional Syhunt API usage examples using objects.


For additional product documentation, visit syhunt.com/docs

Retrieved from https://www.syhunt.com/en/index.php?n=Docs.SyhuntIntegrationLuaAPI
Page last modified on February 21, 2022, at 03:51 PM