Skip to content

Instantly share code, notes, and snippets.

@jason-dark
Created July 20, 2018 22:34
Show Gist options
  • Save jason-dark/b2ecd1efe27c04abfdd187c8a6b9527b to your computer and use it in GitHub Desktop.
Save jason-dark/b2ecd1efe27c04abfdd187c8a6b9527b to your computer and use it in GitHub Desktop.
var params = {
searchCriteria: [
'user=naughtyuser@domain.com',
'action=blocked'
],
logType: 4,
adom: "root",
maxNumMatches: 1000,
}
searchFazLogs(params);
function searchFazLogs(params) {
var adom = params.adom;
var logType = params.logType;
var maxNumMatches = params.maxNumMatches;
var searchCriteria = "";
var queries = params.searchCriteria;
for (i = 0; i < queries.length; i++) {
var query = queries[i];
searchCriteria += query + " ";
}
var args = {
_xml:
'<r20:searchFazLog>' +
'<servicePass>' +
'<userID>apiuser@domain.com</userID>' +
'<password>apiuserpassword</password>' +
'</servicePass>' +
'<adom>' + adom + '</adom>' +
'<content>logs</content>' +
'<format>0</format>' +
'<deviceName>n4ltestlab-fw01</deviceName>' +
'<logType>' + logType + '</logType>' +
'<maxNumMatches>' + maxNumMatches + '</maxNumMatches>' +
'<startIndex>1</startIndex>' +
'<checkArchive>0</checkArchive>' +
'<compression>gzip</compression>' +
'<searchCriteria>' + searchCriteria + '</searchCriteria>' +
'</r20:searchFazLog>'
};
soap.createClient(url, function (err, client) {
if (err) console.error(err);
client.searchFazLog(args, function (err, result) {
if (err) console.error(err);
console.log(result); // Print the result
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment