Bom comigo não funcionou, quando vou fazer o teste pra verificar a funcionalidade do script, aparentemente ele baixa algum arquivo, aparece isso:
http://img811.imageshack.us/img811/1040/print01mi.png
Porém quando vou acessar o diretório onde ele deveria salvar os arquivos aparecem os arquivos baixados manualmente, e mais esses com nomeação estranhas:
http://img259.imageshack.us/img259/1787/print02.png
O que pode ser?
Segue o script:
#!/bin/bash
wget --output-document="/mnt/arquivos/ti/Backup-Firewall/config-firewall.coren-$(date +%F-%X).xml" --http-user="admin" --http-passwd="xxxx" --no-check-certificate --post-data "backuparea=&Submit=download"
http://172.16.10.1/diag_backup.php
Este é o conteúdo dos arquivos que ele baixou, aparentemente é nada mais, nada menos, que a tela de login.
Detalhe, meu pfsense é a versão 2.0.1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="/javascript/scriptaculous/prototype.js"></script>
<script type="text/javascript" src="/javascript/scriptaculous/scriptaculous.js"></script>
<script>document.observe('dom:loaded', function() { $('usernamefld').focus(); });</script>
<title>Login</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="shortcut icon" href="/themes/pfsense_ng/images/icons/favicon.ico" />
<link rel="stylesheet" type="text/css" href="/themes/pfsense_ng/login.css" media="all" />
<script type="text/javascript">
<!--
function page_load() {}
function clearError() {
if($('inputerrors'))
$('inputerrors').innerHTML='';
}
var input_errors = '';
Event.observe(window, 'load', init, false);
var noAjaxOnSubmit = false;
function init() {
if($('submit') && ! noAjaxOnSubmit) {
// debugging helper
//alert('adding observe event for submit button');
Event.observe("submit", "click", submit_form, false);
$('submit').onclick = function() {return false;};
var to_insert = "<div style='visibility:hidden' id='loading' name='loading'><img src='/themes/pfsense_ng/images/misc/loader.gif' \/><\/div>";
new Insertion.Before('submit', to_insert);
}
}
function submit_form(e){
// debugging helper
//alert(Form.serialize($('iform')));
if($('inputerrors'))
$('inputerrors').innerHTML = '<center><b><i>Loading...</i></b></center>';
/* dsh: Introduced because pkg_edit tries to set some hidden fields
* if executing submit's onclick event. The click gets deleted
* by Ajax. Hence using onkeydown instead.
*/
if($('submit') && $('submit').onkeydown)
$('submit').onkeydown();
if($('submit'))
$('submit').style.visibility = 'hidden';
if($('cancelbutton'))
$('cancelbutton').style.visibility = 'hidden';
$('loading').style.visibility = 'visible';
// submit the form using Ajax
}
function formSubmitted(resp) {
var responseText = resp.responseText;
// debugging helper
// alert(responseText);
if(responseText.indexOf('html') > 0) {
/* somehow we have been fed an html page! */
//alert('Somehow we have been fed an html page! Forwarding to /.');
document.location.href = '/';
}
eval(responseText);
}
/* this function will be called if an HTTP error will be triggered */
function formFailure(resp) {
showajaxmessage(resp.responseText);
if($('submit'))
$('submit').style.visibility = 'visible';
if($('cancelbutton'))
$('cancelbutton').style.visibility = 'visible';
if($('loading'))
$('loading').style.visibility = 'hidden';
}
function showajaxmessage(message) {
var message_html;
if (message == '') {
NiftyCheck();
Rounded("div#redbox","all","#FFF","#990000","smooth");
Rounded("td#blackbox","all","#FFF","#000000","smooth");
if($('submit'))
$('submit').style.visibility = 'visible';
if($('cancelbutton'))
$('cancelbutton').style.visibility = 'visible';
if($('loading'))
$('loading').style.visibility = 'hidden';
return;
}
message_html = '<table height="32" width="100%"><tr><td>';
message_html += '<div style="background-color:#990000" id="redbox">';
message_html += '<table width="100%"><tr><td width="8%">';
message_html += '<img style="vertical-align:center" src="/themes/pfsense_ng/images/icons/icon_exclam.gif" width="28" height="32" \/>';
message_html += '<\/td><td width="70%"><font color="white">';
message_html += '<b>' + message + '<\/b><\/font><\/td>';
if(message.indexOf('apply') > 0) {
message_html += '<td>';
message_html += '<input name="apply" type="submit" class="formbtn" id="apply" value="Apply changes" \/>';
message_html += '<\/td>';
}
message_html += '<\/tr><\/table><\/div><\/td><\/table><br \/>';
$('inputerrors').innerHTML = message_html;
NiftyCheck();
Rounded("div#redbox","all","#FFF","#990000","smooth");
Rounded("td#blackbox","all","#FFF","#000000","smooth");
if($('submit'))
$('submit').style.visibility = 'visible';
if($('cancelbutton'))
$('cancelbutton').style.visibility = 'visible';
if($('loading'))
$('loading').style.visibility = 'hidden';
if($('inputerrors'))
window.scrollTo(0, 0);
}
//-->
</script>
<script type="text/javascript" src="/themes/pfsense_ng/javascript/niftyjsCode.js"></script>
</head>
<body onload="page_load()">
<div id="login">
<form id="iform" name="login_iform" method="post" action="/diag_backup.php">
<h1></h1>
<div id="inputerrors"></div>
<p>
<span style="text-align:left">
Username:<br>
<input onclick="clearError();" onchange="clearError();" id="usernamefld" type="text" name="usernamefld" class="formfld user" tabindex="1" />
</span>
</p>
<br>
<p>
<span style="text-align:left">
Password: <br>
<input onclick="clearError();" onchange="clearError();" id="passwordfld" type="password" name="passwordfld" class="formfld pwd" tabindex="2" />
</span>
</p>
<br>
<p>
<span style="text-align:center; font-weight: normal ; font-style: italic">
Enter username and password to login. </span>
</p>
<p>
<span style="text-align:center">
<input type="submit" name="login" class="formbtn" value="Login" tabindex="3" />
</span>
</P>
</form>
</div>
</body>
</html>