This site contains documentation for the dotDefender API. You can browse through the the dotDefender API functions using the links located on the left side. Please note that this site is still under construction and it's content is still being reviewed. Examples:Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_site_list(callback); //Get the list of sites in the server. Last argument is the callback function. function callback(response){ //Parse the response XML, in this case we use jQuery find method $(response).find('site').each(function(){ var site = $(this).find('site_id').text(); var display_name = $(this).find('display_name').text(); var operation_mode = $(this).find('operation_mode').text(); var str = site + ', ' + display_name + ', ' + operation_mode; //Present the Data document.write(str); }); } Python example using suds web services client
import suds import libxml2 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) response = client.service.get_site_list() #Parse the response doc = libxml2.parseDoc(response) root = doc.children #iterate over child = root.children while child is not None: if child.type == "element": print child.content child = child.next doc.freeDoc() Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_xpath(0,'/site/syslog',callback); //Get syslog xpath of site with ID 0. Last argument is the callback function. function callback(response){ //Parse the response XML, in this case we use jQuery find method var enabled = ($(response).find('enabled').text() == 'true'); //Enable checkbox $('#syslog_enabled').attr('checked',enabled); } Python example using suds web services client
import suds,libxml2,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) xpath = client.service.get_xpath(0,'/site/syslog') print base64.decodestring(xpath) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.start_session(0); conn.functions.set_xpath(0,'/site/description',Base64.encode("<description>desc</description>")); //set a new description conn.function.commit([0])//apply changes Python example using suds web services client
import suds,libxml2,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.start_session(0) print client.service.set_xpath(0,'/site/description',base64.encodestring('<description>desc</description>')) print client.service.commit([0]) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') var xpath = '/subcategories_status'; var xml = '<subcategory_status id=some_id>'; xml += '<enabled>true</enabled>'; xml += '</subcategory_status>'; conn.functions.add_xpath(0,xpath,Base64.encode(xml)); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) xpath = '/subcategories_status' xml = '<subcategory_status id=some_id>' xml += '<enabled>true</enabled>' xml += '</subcategory_status>' client.service.add_xpath(0,xpath,base64.encodestring(xml)) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') var xpath = "/ud_rules/server_mask_actions/server_mask_action[rule_id=11]"; conn.functions.remove_xpath(0,xpath); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) xpath = "/ud_rules/request_rules/request_rule[rule_id=2]" client.service.remove_xpath(0,xpath) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.discard_session(0); conn.functions.start_session(0); Python example using suds web services client
import suds url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) client.service.discard_session(0); client.service.start_session(0) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.discard_session(0); conn.functions.start_session(0); Python example using suds web services client
import suds url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) client.service.discard_session(0); client.service.start_session(0) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.discard_session(0); conn.functions.start_session(0); //Apply the changes only if changes were made if(conn.functions.site_was_changed(0) == 'true'){ conn.functions.commit(['0']); } Python example using suds web services client
import suds url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) client.service.discard_session(0); client.service.start_session(0) if client.service.site_was_changed(0): client.service.commit([0]) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.discard_session(0); conn.functions.start_session(0); var xpath = "/ud_rules/server_mask_actions/server_mask_action[rule_id=11]"; conn.functions.remove_xpath(0,xpath); //Apply the changes conn.functions.commit(['0']); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) client.service.discard_session(0); client.service.start_session(0) client = suds.client.Client(url) xpath = "/ud_rules/server_mask_actions/server_mask_action[rule_id=11]" client.service.remove_xpath(0,xpath) #Apply the changes client.service.commit([0]) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.discard_session(0); conn.functions.start_session(0); conn.functions.set_xpath(0,'/site/description',Base64.encode('<description>desc</description>') if(conn.functions.site_was_changed(0) == 'true'){ conn.functions.rollback(0); } Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) client.service.discard_session(0) client.service.start_session(0) client.service.set_xpath(0,'/site/description',base64.encodestring('<description>desc</description>')) if client.service.site_was_changed(0): client.service.rollback(0) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') var om = conn.functions.get_operation_mode(0); om = $(om).find('operation_mode').text(); document.write('dotDefender is in '+ om +' mode'); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) om = client.service.get_operation_mode(0) print om Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') //Rule XML must be created using the appcure_rules.xsd XML schema var request_rule = '\ <request_rule>\ <rule_id>1</rule_id>\ <enabled>true</enabled>\ <operation>any</operation>\ <uri>/my_uri</uri>\ <inverse_uri>true</inverse_uri>\ <log>true</log>\ <category_id>Whitelist (Permitted Access List)</category_id>\ <description>desc</description>\ <action>deny</action>\ <tarpit>0</tarpit>\ <severity>0</severity>\ <weight>50</weight>\ <primary_search>\ <keyword>keyw</keyword>\ <inverse>false</inverse>\ <locations>\ <fixed_location>PARAMETERS</fixed_location>\ </locations>\ </primary_search>\ <secondary_searches/>\ </request_rule>'; conn.functions.add_request_rule(0,Base64.encode(request_rule)); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) #Rule XML must be created using the appcure_rules.xsd XML schema request_rule = ''' <request_rule> <rule_id>1</rule_id> <enabled>true</enabled> <operation>any</operation> <uri>/my_uri</uri> <inverse_uri>true</inverse_uri> <log>true</log> <category_id>Whitelist (Permitted Access List)</category_id> <description>desc</description> <action>deny</action> <tarpit>0</tarpit> <severity>0</severity> <weight>50</weight> <primary_search> <keyword>keyw</keyword> <inverse>false</inverse> <locations> <fixed_location>PARAMETERS</fixed_location> </locations> </primary_search> <secondary_searches/> </request_rule>''' client.service.add_request_rule(0,base64.encodestring(request_rule)) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') //Rule XML must be created using the appcure_rules.xsd XML schema var response_rule = '\ <response_rule>\ <rule_id>1</rule_id>\ <enabled>true</enabled>\ <operation>any</operation>\ <uri>/my_uri</uri>\ <inverse_uri>true</inverse_uri>\ <log>true</log>\ <category_id>Whitelist (Permitted Access List)</category_id>\ <description>response_desc</description>\ <action>deny</action>\ <tarpit>0</tarpit>\ <severity>0</severity>\ <weight>50</weight>\ <primary_search>\ <keyword>keyw</keyword>\ <inverse>false</inverse>\ <locations>\ <fixed_location>RESPONSE_HEADERS</fixed_location>\ <fixed_location>FIRST_RESPONSE_LINE</fixed_location>\ </locations>\ </primary_search>\ <secondary_searches/>\ </response_rule>'; conn.functions.add_response_rule(0,Base64.encode(response_rule)); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) #Rule XML must be created using the appcure_rules.xsd XML schema response_rule = ''' <response_rule> <rule_id>1</rule_id> <enabled>true</enabled> <operation>any</operation> <uri>/my_uri</uri> <inverse_uri>true</inverse_uri> <log>true</log> <category_id>Whitelist (Permitted Access List)</category_id> <description>response_desc</description> <action>deny</action> <tarpit>0</tarpit> <severity>0</severity> <weight>50</weight> <primary_search> <keyword>keyw</keyword> <inverse>false</inverse> <locations> <fixed_location>RESPONSE_HEADERS</fixed_location> <fixed_location>FIRST_RESPONSE_LINE</fixed_location> </locations> </primary_search> <secondary_searches/> </response_rule>''' client.service.add_response_rule(0,base64.encodestring(response_rule)) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') //Rule XML must be created using the appcure_rules.xsd XML schema var server_mask_action = '\ <server_mask_action>\ <rule_id>1</rule_id>\ <enabled>true</enabled>\ <type>modify</type>\ <header>Server</header>\ <value>my_server</value>\ </server_mask_action>'; conn.functions.add_server_mask_action(0,Base64.encode(server_mask_action)); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) #Rule XML must be created using the appcure_rules.xsd XML schema server_mask_action = ''' <server_mask_action> <rule_id>1</rule_id> <enabled>true</enabled> <type>modify</type> <header>Server</header> <value>my_server</value> </server_mask_action>''' client.service.add_server_mask_action(0,base64.encodestring(server_mask_action)) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') //Rule XML must be created using the appcure_rules.xsd XML schema var upload_rule = '\ <upload_rule>\ <rule_id>1</rule_id>\ <enabled>true</enabled>\ <uri>/upload_uri/form.asp</uri>\ <extension>exe</extension>\ <extension>gif</extension>\ <inverse_extensions>true</inverse_extensions>\ <validate_content_type>true</validate_content_type>\ <filename/>\ <check_filename>false</check_filename>\ <content/>\ <check_content>false</check_content>\ </upload_rule>'; conn.functions.add_upload_rule(0,Base64.encode(upload_rule)); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) #Rule XML must be created using the appcure_rules.xsd XML schema upload_rule = ''' <upload_rule> <rule_id>1</rule_id> <enabled>true</enabled> <uri>/upload_uri/form.asp</uri> <extension>exe</extension> <extension>gif</extension> <inverse_extensions>true</inverse_extensions> <validate_content_type>true</validate_content_type> <filename/> <check_filename>false</check_filename> <content/> <check_content>false</check_content> </upload_rule>''' client.service.add_upload_rule(0,base64.encodestring(upload_rule)) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_update_configuration(function(response){ for (mykey in response){ alert ("response["+mykey +"] = "+response[mykey]); } }); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) s = client.service.get_update_configuration() for key in s: print key Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') var email = 'dotDefender@applicure.com'; var hash = Base64.encode(email+":pass"); conn.functions.set_update_configuration(email, hash, true, false); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) email = 'dotDefender@applicure.com' h = base64.encodestring(email+":pass") s = client.service.set_update_configuration(email, h, true, false) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') var a = conn.functions.get_db_list(); for(var i = 0; i < a.length; i++){ document.write(a[i]); } Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) a = client.service.get_db_list() for i in a: print i Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_attack_events(0,15,'3369-12bf-2d0f-9b54',function(response){ $(response).find('attack_event').each(function(){ document.write('Severity: '+$(this).find('severity').text()); }); }); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.get_attack_events(0,15,'3369-12bf-2d0f-9b54') Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_attack_events('3369-12bf-2d0f-9b54',function(response){ $(response).find('attack_event').each(function(){ var dest_url = Base64.decode($(this).find('dest_url').text()); document.write('Destination URL: '+dest_url); }); }); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.get_attack_events('3369-12bf-2d0f-9b54') Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') var total_count = 0; conn.functions.get_attack_count_per_site( '', 0, 1270080001, '', '', '', function(response){ $(response).find('attack_count').each(function(){ var name = $(this).find('name').text(); var count = parseInt($(this).find('count').text(),10); document.write('Attack count for ' + name + 'is: '+ count); total_count += count; }); document.write('Total count is: '+ total_count); }); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.get_attack_count_per_site("",0,1270080001,"","","") Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') var total_count = 0; conn.functions.get_attack_count_per_category( '', 0, 1270080001, '', '', '', function(response){ $(response).find('attack_count').each(function(){ var name = $(this).find('name').text(); var count = parseInt($(this).find('count').text(),10); document.write('Attack count for ' + name + 'is: '+ count); total_count += count; }); document.write('Total count is: '+ total_count); }); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.get_attack_count_per_category("",0,1270080001,"","","")
A demo example of this function (using Javascript) can be found here
Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') var total_count = 0; conn.functions.get_attack_count_per_ip( '', 0, 1270080001, '', '', '', function(response){ $(response).find('attack_count').each(function(){ var name = $(this).find('name').text(); var count = parseInt($(this).find('count').text(),10); document.write('Attack count for ' + name + 'is: '+ count); total_count += count; }); document.write('Total count is: '+ total_count); }); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.get_attack_count_per_ip("",0,1270080001,"","","") Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_recent_attacks( '', 0, 1270080001, 'site_id', 15, function(response){ var dest_url = Base64.decode($(this).find('dest_url').text()); document.write('Destination URL: '+dest_url); }); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.get_recent_attacks("",0,1270080001,"site_id",15)
A demo example of this function (using Javascript) can be found here
Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.search_attacks( '', 0, 1270080001, '', 'Probing', '', 0, 100, function(response){ $(response).find('attack_headline').each(function(){ var category = Base64.decode($(this).find('category').text()) var subcategory = Base64.decode($(this).find('subcategory').text()); document.write('Category: ' + category + ', Subcategory: '+ subcategory); }); }); Python example using suds web services client
import suds,base64 url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.search_attacks("",0,1270080001,"","Probing","",0,100) Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_status(function(response){ for (mykey in response){ alert ("response["+mykey +"] = "+response[mykey]); } }); Python example using suds web services client
import suds url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) s = client.service.get_status() for key in s: print key Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_installation_log(function(response){ document.write(response); }); Python example using suds web services client
import suds url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.get_installation_log() Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_audit_log(function(response){ document.write(response); }); Python example using suds web services client
import suds url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) print client.service.get_audit_log() Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.get_dsp(function(response){ for (mykey in response){ alert ("response["+mykey +"] = "+response[mykey]); } }); Python example using suds web services client
import suds url = "http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl" client = suds.client.Client(url) s = client.service.get_dsp() for key in s: print key Javascript example using DotDefenderAPI
//Create new instance of DotDefenderAPI object var conn = new DotDefenderAPI('http://my_domain/my_dotDefender_location/dotDefender_webservice?wsdl','admin','password') conn.functions.put_dsp(function(site,categories_status,subcategories_status,ud_rules); Python example using suds web services client
client.service.put_dsp(site,categories_status,subcategories_status,ud_rules) |