mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 08:14:38 +02:00
2007-08-07 Esteban Sanchez <estebans@artica.es>
* pandora.cc: Updated agent version. * pandora.h, modules/pandora_module_exec.cc: Redefine WINVER, so CreateJobProject can be found without modifying windef.h. * pandora_agent_conf.cc: Rewritten a loop. * ftp/pandora_ftp_client.[cc,h]: Added to repository. Implemented FTP transfer protocol using libcurl. It adds a library dependency. * pandora_windows_service.cc: Added support for FTP transfers. Select between SSH (default) or FTP. Improved file structure to be cleaner. * pandora_windows_service.h: Added new private functions and removed unneccessary private attribute. * misc/pandora_file.[cc,h]: Added a function to get the filename of a path. * main.cc: Indentation fixed. * bin/libcurl.dll: Added to repository. New dependency. * bin/PandoraAgent.exe: Updated to last commit. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@594 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
0590bc5aee
commit
cee0fa4897
@ -1,3 +1,30 @@
|
|||||||
|
2007-08-07 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* pandora.cc: Updated agent version.
|
||||||
|
|
||||||
|
* pandora.h, modules/pandora_module_exec.cc: Redefine WINVER, so
|
||||||
|
CreateJobProject can be found without modifying windef.h.
|
||||||
|
|
||||||
|
* pandora_agent_conf.cc: Rewritten a loop.
|
||||||
|
|
||||||
|
* ftp/pandora_ftp_client.[cc,h]: Added to repository. Implemented FTP
|
||||||
|
transfer protocol using libcurl. It adds a library dependency.
|
||||||
|
|
||||||
|
* pandora_windows_service.cc: Added support for FTP transfers. Select
|
||||||
|
between SSH (default) or FTP. Improved file structure to be cleaner.
|
||||||
|
|
||||||
|
* pandora_windows_service.h: Added new private functions and removed
|
||||||
|
unneccessary private attribute.
|
||||||
|
|
||||||
|
* misc/pandora_file.[cc,h]: Added a function to get the filename of a
|
||||||
|
path.
|
||||||
|
|
||||||
|
* main.cc: Indentation fixed.
|
||||||
|
|
||||||
|
* bin/libcurl.dll: Added to repository. New dependency.
|
||||||
|
|
||||||
|
* bin/PandoraAgent.exe: Updated to last commit.
|
||||||
|
|
||||||
2007-05-23 Raul Mateos <raulofpandora@gmail.com>
|
2007-05-23 Raul Mateos <raulofpandora@gmail.com>
|
||||||
|
|
||||||
* installer/Pandora_Windows_Agent-1.2.1-Setup.exe: Updated installer.
|
* installer/Pandora_Windows_Agent-1.2.1-Setup.exe: Updated installer.
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
[Project]
|
[Project]
|
||||||
FileName=PandoraAgent.dev
|
FileName=PandoraAgent.dev
|
||||||
Name=PandoraAgent
|
Name=PandoraAgent
|
||||||
UnitCount=65
|
UnitCount=67
|
||||||
Type=1
|
Type=1
|
||||||
Ver=1
|
Ver=1
|
||||||
ObjFiles=
|
ObjFiles=
|
||||||
@ -12,7 +12,7 @@ ResourceIncludes=
|
|||||||
MakeIncludes=
|
MakeIncludes=
|
||||||
Compiler=
|
Compiler=
|
||||||
CppCompiler=
|
CppCompiler=
|
||||||
Linker=-lole32_@@_-loleaut32_@@_-luuid_@@_-lpsapi_@@_-lwsock32_@@_-lz_@@_-liphlpapi_@@_-lnetapi32_@@_-lws2_32_@@_-lcrypto_@@_-lgdi32_@@__@@_
|
Linker=-lole32_@@_-loleaut32_@@_-luuid_@@_-lpsapi_@@_-lwsock32_@@_-lz_@@_-liphlpapi_@@_-lnetapi32_@@_-lws2_32_@@_-lcrypto_@@_-lgdi32_@@_-lcurldll_@@_
|
||||||
IsCpp=1
|
IsCpp=1
|
||||||
Icon=
|
Icon=
|
||||||
ExeOutput=
|
ExeOutput=
|
||||||
@ -20,7 +20,7 @@ ObjectOutput=
|
|||||||
OverrideOutput=0
|
OverrideOutput=0
|
||||||
OverrideOutputName=PandoraAgent.exe
|
OverrideOutputName=PandoraAgent.exe
|
||||||
HostApplication=
|
HostApplication=
|
||||||
Folders=Misc,Modules,Modules/Utils,SSH,SSH/libssh2,Windows,Windows/WMI,XML
|
Folders=FTP,Misc,Modules,Modules/Utils,SSH,SSH/libssh2,Windows,Windows/WMI,XML
|
||||||
CommandLine=
|
CommandLine=
|
||||||
UseCustomMakefile=0
|
UseCustomMakefile=0
|
||||||
CustomMakefile=
|
CustomMakefile=
|
||||||
@ -697,3 +697,23 @@ Priority=1000
|
|||||||
OverrideBuildCmd=0
|
OverrideBuildCmd=0
|
||||||
BuildCmd=
|
BuildCmd=
|
||||||
|
|
||||||
|
[Unit66]
|
||||||
|
FileName=ftp\pandora_ftp_client.cc
|
||||||
|
CompileCpp=1
|
||||||
|
Folder=FTP
|
||||||
|
Compile=1
|
||||||
|
Link=1
|
||||||
|
Priority=1000
|
||||||
|
OverrideBuildCmd=0
|
||||||
|
BuildCmd=
|
||||||
|
|
||||||
|
[Unit67]
|
||||||
|
FileName=ftp\pandora_ftp_client.h
|
||||||
|
CompileCpp=1
|
||||||
|
Folder=FTP
|
||||||
|
Compile=1
|
||||||
|
Link=1
|
||||||
|
Priority=1000
|
||||||
|
OverrideBuildCmd=0
|
||||||
|
BuildCmd=
|
||||||
|
|
||||||
|
Binary file not shown.
BIN
pandora_agents/win32/bin/libcurl.dll
Normal file
BIN
pandora_agents/win32/bin/libcurl.dll
Normal file
Binary file not shown.
196
pandora_agents/win32/ftp/pandora_ftp_client.cc
Normal file
196
pandora_agents/win32/ftp/pandora_ftp_client.cc
Normal file
@ -0,0 +1,196 @@
|
|||||||
|
/* Class to abstract an FTP client. It uses libcurl.
|
||||||
|
|
||||||
|
Copyright (C) 2006 Artica ST.
|
||||||
|
Written by Esteban Sanchez.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
#include <iostream>
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include "pandora_ftp_client.h"
|
||||||
|
#include "../misc/pandora_file.h"
|
||||||
|
#include "../pandora_strutils.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
using namespace FTP;
|
||||||
|
using namespace Pandora;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a FTP client object and initialize its attributes.
|
||||||
|
*/
|
||||||
|
Pandora_Ftp_Client::Pandora_Ftp_Client ()
|
||||||
|
{
|
||||||
|
curl = NULL;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Destroy a FTP client object.
|
||||||
|
*
|
||||||
|
* It also disconnect the client from the host if connected.
|
||||||
|
*
|
||||||
|
* @see disconnect
|
||||||
|
*/
|
||||||
|
Pandora_Ftp_Client::~Pandora_Ftp_Client ()
|
||||||
|
{
|
||||||
|
this->disconnect ();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Disconnects from remote host.
|
||||||
|
*
|
||||||
|
* It will close all open connections and channels.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Pandora_Ftp_Client::disconnect ()
|
||||||
|
{
|
||||||
|
if (curl != NULL) {
|
||||||
|
curl_easy_cleanup (curl);
|
||||||
|
curl = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connects to specified host and port using a username and a
|
||||||
|
* password.
|
||||||
|
*
|
||||||
|
* @param host Host to connect to.
|
||||||
|
* @param port Port of FTP server in host
|
||||||
|
* @param username FTP username in server.
|
||||||
|
* @param password Username's password in server
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Pandora_Ftp_Client::connect (const string host,
|
||||||
|
const int port,
|
||||||
|
const string username,
|
||||||
|
const string password)
|
||||||
|
{
|
||||||
|
this->username = username;
|
||||||
|
this->password = password;
|
||||||
|
this->host = host;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t
|
||||||
|
read_func(void *ptr, size_t size, size_t nmemb, FILE *stream)
|
||||||
|
{
|
||||||
|
return fread (ptr, size, nmemb, stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy a file using a FTP connection.
|
||||||
|
*
|
||||||
|
* The function receives a filename in the local filesystem and copies all
|
||||||
|
* its content to the remote host. The remote filename will be the
|
||||||
|
* basename of the local file and will be copied in the remote actual
|
||||||
|
* directory.
|
||||||
|
*
|
||||||
|
* @param remote_filename Remote path to copy the local file in.
|
||||||
|
* @param filename Path to the local file.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Pandora_Ftp_Client::ftpFileFilename (const string remote_filename,
|
||||||
|
const string filepath)
|
||||||
|
{
|
||||||
|
FILE *fd;
|
||||||
|
string operation1;
|
||||||
|
string operation2;
|
||||||
|
struct stat file_info;
|
||||||
|
int file;
|
||||||
|
struct curl_slist *headerlist = NULL;
|
||||||
|
string filename;
|
||||||
|
string url;
|
||||||
|
|
||||||
|
if (this->host == "")
|
||||||
|
throw Unknown_Host ();
|
||||||
|
|
||||||
|
filename = Pandora_File::fileName (filepath);
|
||||||
|
|
||||||
|
url = "ftp://";
|
||||||
|
url += username;
|
||||||
|
url += ':';
|
||||||
|
url += password;
|
||||||
|
url += '@';
|
||||||
|
url += host;
|
||||||
|
url += '/';
|
||||||
|
url += filename;
|
||||||
|
|
||||||
|
file = open (filepath.c_str (), O_RDONLY);
|
||||||
|
fstat (file, &file_info);
|
||||||
|
close (file);
|
||||||
|
|
||||||
|
fd = fopen (filepath.c_str (), "rb");
|
||||||
|
|
||||||
|
curl_global_init (CURL_GLOBAL_ALL);
|
||||||
|
|
||||||
|
this->curl = curl_easy_init ();
|
||||||
|
if (this->curl) {
|
||||||
|
|
||||||
|
pandoraLog ("Copying %s to %s%s", filepath.c_str (), this->host.c_str (),
|
||||||
|
remote_filename.c_str ());
|
||||||
|
|
||||||
|
operation1 = "RNFR " + filename;
|
||||||
|
headerlist = curl_slist_append (headerlist, operation1.c_str ());
|
||||||
|
|
||||||
|
operation2 = "RNTO " + remote_filename;
|
||||||
|
headerlist = curl_slist_append (headerlist, operation2.c_str ());
|
||||||
|
|
||||||
|
curl_easy_setopt (this->curl, CURLOPT_UPLOAD, 1) ;
|
||||||
|
curl_easy_setopt (this->curl, CURLOPT_URL, url.c_str ());
|
||||||
|
curl_easy_setopt (this->curl, CURLOPT_POSTQUOTE, headerlist);
|
||||||
|
curl_easy_setopt (this->curl, CURLOPT_READFUNCTION, read_func);
|
||||||
|
curl_easy_setopt (this->curl, CURLOPT_READDATA, fd);
|
||||||
|
curl_easy_setopt (curl, CURLOPT_INFILESIZE_LARGE,
|
||||||
|
(curl_off_t) file_info.st_size);
|
||||||
|
|
||||||
|
this->result = curl_easy_perform (this->curl);
|
||||||
|
|
||||||
|
curl_slist_free_all (headerlist);
|
||||||
|
curl_easy_cleanup (this->curl);
|
||||||
|
|
||||||
|
this->curl = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
curl_global_cleanup ();
|
||||||
|
fclose (fd);
|
||||||
|
|
||||||
|
switch (this->result) {
|
||||||
|
case CURLE_OK:
|
||||||
|
break;
|
||||||
|
case CURLE_COULDNT_CONNECT:
|
||||||
|
throw Unknown_Host ();
|
||||||
|
|
||||||
|
break;
|
||||||
|
case CURLE_FTP_ACCESS_DENIED:
|
||||||
|
throw Authentication_Failed ();
|
||||||
|
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw FTP_Exception ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string
|
||||||
|
Pandora_Ftp_Client::getError ()
|
||||||
|
{
|
||||||
|
string error (curl_easy_strerror (this->result));
|
||||||
|
|
||||||
|
return error;
|
||||||
|
}
|
80
pandora_agents/win32/ftp/pandora_ftp_client.h
Normal file
80
pandora_agents/win32/ftp/pandora_ftp_client.h
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
/* Class to abstract an FTP client. It uses libcurl.
|
||||||
|
|
||||||
|
Copyright (C) 2006 Artica ST.
|
||||||
|
Written by Esteban Sanchez.
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2, or (at your option)
|
||||||
|
any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License along
|
||||||
|
with this program; if not, write to the Free Software Foundation,
|
||||||
|
Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __PANDORA_FTP_CLIENT__
|
||||||
|
#define __PANDORA_FTP_CLIENT__
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "../pandora.h"
|
||||||
|
#include <curl/curl.h>
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FTP connection classes.
|
||||||
|
*/
|
||||||
|
namespace FTP {
|
||||||
|
/**
|
||||||
|
* A FTP super-class exception.
|
||||||
|
*/
|
||||||
|
class FTP_Exception : public Pandora::Pandora_Exception {
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The FTP authentication fails when connecting.
|
||||||
|
*/
|
||||||
|
class Authentication_Failed : public FTP::FTP_Exception {
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The FTP host is unknown.
|
||||||
|
*/
|
||||||
|
class Unknown_Host : public FTP::FTP_Exception {
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client to perform a FTP connection to a host.
|
||||||
|
*/
|
||||||
|
class Pandora_Ftp_Client {
|
||||||
|
private:
|
||||||
|
string host;
|
||||||
|
string username;
|
||||||
|
string password;
|
||||||
|
|
||||||
|
CURL *curl;
|
||||||
|
CURLcode result;
|
||||||
|
public:
|
||||||
|
Pandora_Ftp_Client ();
|
||||||
|
~Pandora_Ftp_Client ();
|
||||||
|
|
||||||
|
void connect (const string host,
|
||||||
|
const int port,
|
||||||
|
const string username,
|
||||||
|
const string password);
|
||||||
|
|
||||||
|
void disconnect ();
|
||||||
|
|
||||||
|
void ftpFileFilename (const string remote_filename,
|
||||||
|
const string filepath);
|
||||||
|
|
||||||
|
string getError ();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
@ -30,51 +30,51 @@
|
|||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[]) {
|
main (int argc, char *argv[]) {
|
||||||
Pandora_Windows_Service *service;
|
Pandora_Windows_Service *service;
|
||||||
char buffer[PATH_SIZE];
|
char buffer[PATH_SIZE];
|
||||||
string aux;
|
string aux;
|
||||||
unsigned int pos;
|
unsigned int pos;
|
||||||
|
|
||||||
service = new Pandora_Windows_Service (Pandora::name, Pandora::display_name,
|
service = new Pandora_Windows_Service (Pandora::name, Pandora::display_name,
|
||||||
Pandora::description);
|
Pandora::description);
|
||||||
|
|
||||||
GetModuleFileName (NULL, buffer, MAX_PATH);
|
GetModuleFileName (NULL, buffer, MAX_PATH);
|
||||||
aux = buffer;
|
aux = buffer;
|
||||||
Pandora::setPandoraInstallPath (aux);
|
Pandora::setPandoraInstallPath (aux);
|
||||||
pos = aux.rfind ("\\");
|
pos = aux.rfind ("\\");
|
||||||
aux.erase (pos + 1);
|
aux.erase (pos + 1);
|
||||||
Pandora::setPandoraInstallDir (aux);
|
Pandora::setPandoraInstallDir (aux);
|
||||||
|
|
||||||
/* Check the parameters */
|
/* Check the parameters */
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
if (_stricmp(argv[i], SERVICE_INSTALL_CMDLINE_PARAM) == 0) {
|
if (_stricmp(argv[i], SERVICE_INSTALL_CMDLINE_PARAM) == 0) {
|
||||||
/* Install parameter */
|
/* Install parameter */
|
||||||
service->install (Pandora::getPandoraInstallPath ().c_str ());
|
service->install (Pandora::getPandoraInstallPath ().c_str ());
|
||||||
|
|
||||||
delete service;
|
delete service;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (_stricmp(argv[i], SERVICE_UNINSTALL_CMDLINE_PARAM) == 0) {
|
} else if (_stricmp(argv[i], SERVICE_UNINSTALL_CMDLINE_PARAM) == 0) {
|
||||||
/* Uninstall parameter */
|
/* Uninstall parameter */
|
||||||
service->uninstall ();
|
service->uninstall ();
|
||||||
|
|
||||||
delete service;
|
delete service;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (_stricmp(argv[i], SSH_TEST_CMDLINE_PARAM) == 0) {
|
} else if (_stricmp(argv[i], SSH_TEST_CMDLINE_PARAM) == 0) {
|
||||||
/* SSH test parameter */
|
/* SSH test parameter */
|
||||||
SSH::Pandora_SSH_Test ssh_test;
|
SSH::Pandora_SSH_Test ssh_test;
|
||||||
|
|
||||||
delete service;
|
delete service;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ssh_test.test ();
|
ssh_test.test ();
|
||||||
} catch (Pandora_Exception e) {
|
} catch (Pandora_Exception e) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else if (_stricmp(argv[i], HELP_CMDLINE_PARAM) == 0) {
|
} else if (_stricmp(argv[i], HELP_CMDLINE_PARAM) == 0) {
|
||||||
/* Help parameter */
|
/* Help parameter */
|
||||||
cout << "Usage: " << argv[0] << " [OPTION]" << endl << endl;
|
cout << "Usage: " << argv[0] << " [OPTION]" << endl << endl;
|
||||||
cout << "Available options are:" << endl;
|
cout << "Available options are:" << endl;
|
||||||
@ -84,21 +84,21 @@ main (int argc, char *argv[]) {
|
|||||||
cout << ": Uninstall the Pandora Agent service." << endl;
|
cout << ": Uninstall the Pandora Agent service." << endl;
|
||||||
cout << "\t" << SSH_TEST_CMDLINE_PARAM;
|
cout << "\t" << SSH_TEST_CMDLINE_PARAM;
|
||||||
cout << ": Test the SSH Pandora Agent configuration." << endl;
|
cout << ": Test the SSH Pandora Agent configuration." << endl;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
/* No parameter recognized */
|
/* No parameter recognized */
|
||||||
cout << "Usage: " << argv[0] << " [" << SERVICE_INSTALL_CMDLINE_PARAM;
|
cout << "Usage: " << argv[0] << " [" << SERVICE_INSTALL_CMDLINE_PARAM;
|
||||||
cout << "] [" << SERVICE_UNINSTALL_CMDLINE_PARAM << "]" << endl;
|
cout << "] [" << SERVICE_UNINSTALL_CMDLINE_PARAM << "]" << endl;
|
||||||
cout << "Run " << argv[0] << "with " << HELP_CMDLINE_PARAM;
|
cout << "Run " << argv[0] << "with " << HELP_CMDLINE_PARAM;
|
||||||
cout << " parameter for more info." << endl;
|
cout << " parameter for more info." << endl;
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
service->run ();
|
service->run ();
|
||||||
|
|
||||||
delete service;
|
delete service;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include "pandora_file.h"
|
#include "pandora_file.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
@ -106,3 +107,25 @@ Pandora_File::writeFile (const string filepath, const string data) {
|
|||||||
file.write (data.c_str (), data.length ());
|
file.write (data.c_str (), data.length ());
|
||||||
file.close ();
|
file.close ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the filename of a complete filepath.
|
||||||
|
*
|
||||||
|
* @param filepath
|
||||||
|
*/
|
||||||
|
string
|
||||||
|
Pandora_File::fileName (const string filepath)
|
||||||
|
{
|
||||||
|
string filename;
|
||||||
|
int pos;
|
||||||
|
|
||||||
|
pos = filepath.find_last_of ("\\");
|
||||||
|
|
||||||
|
if (pos != string::npos) {
|
||||||
|
filename = filepath.substr (pos + 1);
|
||||||
|
} else {
|
||||||
|
filename = filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
return filename;
|
||||||
|
}
|
||||||
|
@ -54,6 +54,7 @@ namespace Pandora_File {
|
|||||||
string readFile (const string filename);
|
string readFile (const string filename);
|
||||||
void removeFile (const string filename);
|
void removeFile (const string filename);
|
||||||
void writeFile (const string filename, const string data);
|
void writeFile (const string filename, const string data);
|
||||||
|
string fileName (const string filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -64,7 +64,9 @@ Pandora_Module_Exec::run () {
|
|||||||
|
|
||||||
/* Create a job to kill the child tree if it become zombie */
|
/* Create a job to kill the child tree if it become zombie */
|
||||||
/* CAUTION: In order to work this, WINVER should be defined to 0x0500.
|
/* CAUTION: In order to work this, WINVER should be defined to 0x0500.
|
||||||
It is defined in <windef.h> */
|
This may need no change, since it was redefined by the
|
||||||
|
program, but if needed, the macro is defined
|
||||||
|
in <windef.h> */
|
||||||
job = CreateJobObject (&attributes, this->module_name.c_str ());
|
job = CreateJobObject (&attributes, this->module_name.c_str ());
|
||||||
if (job == NULL) {
|
if (job == NULL) {
|
||||||
pandoraLog ("CreateJobObject bad. Err: %d", GetLastError ());
|
pandoraLog ("CreateJobObject bad. Err: %d", GetLastError ());
|
||||||
|
@ -30,7 +30,7 @@ using namespace Pandora;
|
|||||||
using namespace Pandora_Strutils;
|
using namespace Pandora_Strutils;
|
||||||
|
|
||||||
#define PATH_SIZE _MAX_PATH+1
|
#define PATH_SIZE _MAX_PATH+1
|
||||||
#define PANDORA_VERSION ("1.2Beta")
|
#define PANDORA_VERSION ("1.3(Build 070807)")
|
||||||
|
|
||||||
string pandora_path;
|
string pandora_path;
|
||||||
string pandora_dir;
|
string pandora_dir;
|
||||||
@ -46,33 +46,33 @@ string pandora_version = PANDORA_VERSION;
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Key_Value::parseLine (string str) {
|
Key_Value::parseLine (string str) {
|
||||||
unsigned int pos;
|
unsigned int pos;
|
||||||
list<string> tokens;
|
list<string> tokens;
|
||||||
list<string>::iterator iter;
|
list<string>::iterator iter;
|
||||||
string trimmedstr;
|
string trimmedstr;
|
||||||
|
|
||||||
trimmedstr = trim (str);
|
trimmedstr = trim (str);
|
||||||
|
|
||||||
/* Check if the string has " */
|
/* Check if the string has " */
|
||||||
pos = trimmedstr.find ("\"");
|
pos = trimmedstr.find ("\"");
|
||||||
if (pos == string::npos) {
|
if (pos == string::npos) {
|
||||||
stringtok (tokens, trimmedstr, " \t");
|
stringtok (tokens, trimmedstr, " \t");
|
||||||
} else {
|
} else {
|
||||||
stringtok (tokens, trimmedstr, "\"");
|
stringtok (tokens, trimmedstr, "\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Pick the first and the last value of the token list */
|
/* Pick the first and the last value of the token list */
|
||||||
iter = tokens.begin ();
|
iter = tokens.begin ();
|
||||||
key = trim (*iter);
|
key = trim (*iter);
|
||||||
transform (key.begin(), key.end(), key.begin(), (int(*)(int)) tolower);
|
transform (key.begin(), key.end(), key.begin(), (int(*)(int)) tolower);
|
||||||
iter = tokens.end ();
|
iter = tokens.end ();
|
||||||
iter--;
|
iter--;
|
||||||
/* Check if the line has only one token */
|
/* Check if the line has only one token */
|
||||||
if (iter != tokens.begin ()) {
|
if (iter != tokens.begin ()) {
|
||||||
value = trim (*iter);
|
value = trim (*iter);
|
||||||
} else {
|
} else {
|
||||||
value = "";
|
value = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -82,7 +82,7 @@ Key_Value::parseLine (string str) {
|
|||||||
*/
|
*/
|
||||||
string
|
string
|
||||||
Key_Value::getKey () {
|
Key_Value::getKey () {
|
||||||
return key;
|
return key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -92,32 +92,32 @@ Key_Value::getKey () {
|
|||||||
*/
|
*/
|
||||||
string
|
string
|
||||||
Key_Value::getValue () {
|
Key_Value::getValue () {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
pandoraWriteLog (string filename, string line) {
|
pandoraWriteLog (string filename, string line) {
|
||||||
string buffer;
|
string buffer;
|
||||||
char str_time[25];
|
char str_time[25];
|
||||||
FILE *file;
|
FILE *file;
|
||||||
string filepath;
|
string filepath;
|
||||||
time_t now;
|
time_t now;
|
||||||
struct tm *gmtime;
|
struct tm *gmtime;
|
||||||
|
|
||||||
now = time (0);
|
now = time (0);
|
||||||
gmtime = localtime (&now);
|
gmtime = localtime (&now);
|
||||||
strftime (str_time, 25, "%m-%d-%y %H:%M:%S: ", gmtime);
|
strftime (str_time, 25, "%m-%d-%y %H:%M:%S: ", gmtime);
|
||||||
|
|
||||||
buffer = (char *) str_time;
|
buffer = (char *) str_time;
|
||||||
buffer += line;
|
buffer += line;
|
||||||
|
|
||||||
filepath = pandora_dir + filename;
|
filepath = pandora_dir + filename;
|
||||||
|
|
||||||
file = fopen (filepath.c_str (), "a+");
|
file = fopen (filepath.c_str (), "a+");
|
||||||
if (file != NULL) {
|
if (file != NULL) {
|
||||||
fprintf (file, "%s\n", buffer.c_str ());
|
fprintf (file, "%s\n", buffer.c_str ());
|
||||||
fclose (file);
|
fclose (file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -131,14 +131,14 @@ pandoraWriteLog (string filename, string line) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Pandora::pandoraLog (char *format, ...) {
|
Pandora::pandoraLog (char *format, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
char msg[5000];
|
char msg[5000];
|
||||||
|
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
vsprintf (msg, format, args);
|
vsprintf (msg, format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
pandoraWriteLog ("pandora-log.log", (char *) msg);
|
pandoraWriteLog ("pandora-log.log", (char *) msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -152,17 +152,17 @@ Pandora::pandoraLog (char *format, ...) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Pandora::pandoraDebug (char *format, ...) {
|
Pandora::pandoraDebug (char *format, ...) {
|
||||||
if (pandora_debug) {
|
if (pandora_debug) {
|
||||||
va_list args;
|
va_list args;
|
||||||
char msg[5000];
|
char msg[5000];
|
||||||
|
|
||||||
va_start (args, format);
|
va_start (args, format);
|
||||||
vsprintf (msg, format, args);
|
vsprintf (msg, format, args);
|
||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
pandoraWriteLog ("pandora-debug.dbg", (char *) msg);
|
pandoraWriteLog ("pandora-debug.dbg", (char *) msg);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -172,9 +172,9 @@ Pandora::pandoraDebug (char *format, ...) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Pandora::pandoraFree (void * pointer) {
|
Pandora::pandoraFree (void * pointer) {
|
||||||
if (pointer != NULL)
|
if (pointer != NULL)
|
||||||
free (pointer);
|
free (pointer);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -189,7 +189,7 @@ Pandora::pandoraFree (void * pointer) {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Pandora::setPandoraInstallDir (string dir) {
|
Pandora::setPandoraInstallDir (string dir) {
|
||||||
pandora_dir = dir;
|
pandora_dir = dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -204,7 +204,7 @@ Pandora::setPandoraInstallDir (string dir) {
|
|||||||
*/
|
*/
|
||||||
string
|
string
|
||||||
Pandora::getPandoraInstallDir () {
|
Pandora::getPandoraInstallDir () {
|
||||||
return pandora_dir;
|
return pandora_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -218,7 +218,7 @@ Pandora::getPandoraInstallDir () {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Pandora::setPandoraInstallPath (string path) {
|
Pandora::setPandoraInstallPath (string path) {
|
||||||
pandora_path = path;
|
pandora_path = path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -232,7 +232,7 @@ Pandora::setPandoraInstallPath (string path) {
|
|||||||
*/
|
*/
|
||||||
string
|
string
|
||||||
Pandora::getPandoraInstallPath () {
|
Pandora::getPandoraInstallPath () {
|
||||||
return pandora_path;
|
return pandora_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -247,7 +247,7 @@ Pandora::getPandoraInstallPath () {
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
Pandora::setPandoraDebug (bool dbg) {
|
Pandora::setPandoraDebug (bool dbg) {
|
||||||
pandora_debug = dbg;
|
pandora_debug = dbg;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -271,5 +271,5 @@ Pandora::getPandoraDebug () {
|
|||||||
*/
|
*/
|
||||||
string
|
string
|
||||||
Pandora::getPandoraAgentVersion () {
|
Pandora::getPandoraAgentVersion () {
|
||||||
return pandora_version;
|
return pandora_version;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,9 @@
|
|||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#undef WINVER
|
||||||
|
#define WINVER 0x0500
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include "windows_service.h"
|
#include "windows_service.h"
|
||||||
|
|
||||||
|
@ -87,14 +87,14 @@ Pandora::Pandora_Agent_Conf::~Pandora_Agent_Conf () {
|
|||||||
* If it could not be found then an empty string is returned.
|
* If it could not be found then an empty string is returned.
|
||||||
*/
|
*/
|
||||||
string
|
string
|
||||||
Pandora::Pandora_Agent_Conf::getValue (const string key) {
|
Pandora::Pandora_Agent_Conf::getValue (const string key)
|
||||||
std::list<Key_Value>::iterator i = key_values->begin ();
|
{
|
||||||
|
std::list<Key_Value>::iterator i;
|
||||||
|
|
||||||
while (i != key_values->end ()) {
|
for (i = key_values->begin (); i != key_values->end (); i++) {
|
||||||
if ((*i).getKey () == key) {
|
if ((*i).getKey () == key) {
|
||||||
return (*i).getValue ();
|
return (*i).getValue ();
|
||||||
}
|
}
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include "windows_service.h"
|
#include "windows_service.h"
|
||||||
#include "modules/pandora_module_factory.h"
|
#include "modules/pandora_module_factory.h"
|
||||||
#include "ssh/pandora_ssh_client.h"
|
#include "ssh/pandora_ssh_client.h"
|
||||||
|
#include "ftp/pandora_ftp_client.h"
|
||||||
#include "misc/pandora_file.h"
|
#include "misc/pandora_file.h"
|
||||||
#include "windows/pandora_windows_info.h"
|
#include "windows/pandora_windows_info.h"
|
||||||
|
|
||||||
@ -99,6 +100,7 @@ Pandora_Windows_Service::pandora_init () {
|
|||||||
|
|
||||||
conf_file = Pandora::getPandoraInstallDir ();
|
conf_file = Pandora::getPandoraInstallDir ();
|
||||||
conf_file += "pandora_agent.conf";
|
conf_file += "pandora_agent.conf";
|
||||||
|
|
||||||
this->conf = new Pandora::Pandora_Agent_Conf (conf_file);
|
this->conf = new Pandora::Pandora_Agent_Conf (conf_file);
|
||||||
this->modules = new Pandora_Module_List (conf_file);
|
this->modules = new Pandora_Module_List (conf_file);
|
||||||
|
|
||||||
@ -156,13 +158,14 @@ Pandora_Windows_Service::getXmlHeader () {
|
|||||||
return agent;
|
return agent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Pandora_Windows_Service::copyDataFile (string filename)
|
Pandora_Windows_Service::copyScpDataFile (string host,
|
||||||
|
string remote_path,
|
||||||
|
string filename)
|
||||||
{
|
{
|
||||||
string remote_host, remote_filepath;
|
SSH::Pandora_Ssh_Client ssh_client;
|
||||||
string tmp_dir, filepath;
|
string tmp_dir, filepath;
|
||||||
string pubkey_file, privkey_file;
|
string pubkey_file, privkey_file;
|
||||||
|
|
||||||
tmp_dir = conf->getValue ("temporal");
|
tmp_dir = conf->getValue ("temporal");
|
||||||
if (tmp_dir[tmp_dir.length () - 1] != '\\') {
|
if (tmp_dir[tmp_dir.length () - 1] != '\\') {
|
||||||
@ -170,69 +173,127 @@ Pandora_Windows_Service::copyDataFile (string filename)
|
|||||||
}
|
}
|
||||||
filepath = tmp_dir + filename;
|
filepath = tmp_dir + filename;
|
||||||
|
|
||||||
remote_host = conf->getValue ("server_ip");
|
pandoraDebug ("Connecting with %s", host.c_str ());
|
||||||
ssh_client = new SSH::Pandora_Ssh_Client ();
|
|
||||||
pandoraDebug ("Connecting with %s", remote_host.c_str ());
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
pubkey_file = Pandora::getPandoraInstallDir ();
|
pubkey_file = Pandora::getPandoraInstallDir ();
|
||||||
pubkey_file += "key\\id_dsa.pub";
|
pubkey_file += "key\\id_dsa.pub";
|
||||||
privkey_file = Pandora::getPandoraInstallDir ();
|
privkey_file = Pandora::getPandoraInstallDir ();
|
||||||
privkey_file += "key\\id_dsa";
|
privkey_file += "key\\id_dsa";
|
||||||
|
|
||||||
ssh_client->connectWithPublicKey (remote_host.c_str (), 22, "pandora",
|
ssh_client.connectWithPublicKey (host.c_str (), 22, "pandora",
|
||||||
pubkey_file, privkey_file, "");
|
pubkey_file, privkey_file, "");
|
||||||
} catch (SSH::Authentication_Failed e) {
|
} catch (SSH::Authentication_Failed e) {
|
||||||
delete ssh_client;
|
pandoraLog ("Pandora Agent: Authentication Failed "
|
||||||
pandoraLog ("Pandora Agent: Authentication Failed when connecting to %s",
|
"when connecting to %s",
|
||||||
remote_host.c_str ());
|
host.c_str ());
|
||||||
if (getPandoraDebug () == false) {
|
throw e;
|
||||||
try {
|
|
||||||
Pandora_File::removeFile (filepath);
|
|
||||||
} catch (Pandora_File::Delete_Error e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
} catch (Pandora_Exception e) {
|
} catch (Pandora_Exception e) {
|
||||||
delete ssh_client;
|
|
||||||
pandoraLog ("Pandora Agent: Failed when copying to %s",
|
pandoraLog ("Pandora Agent: Failed when copying to %s",
|
||||||
remote_host.c_str ());
|
host.c_str ());
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
pandoraDebug ("Remote copying XML %s on server %s at %s%s",
|
||||||
|
filepath.c_str (), host.c_str (),
|
||||||
|
remote_path.c_str (), filename.c_str ());
|
||||||
|
try {
|
||||||
|
ssh_client.scpFileFilename (remote_path + filename,
|
||||||
|
filepath);
|
||||||
|
} catch (Pandora_Exception e) {
|
||||||
|
pandoraLog ("Unable to copy at %s%s", remote_path.c_str (),
|
||||||
|
filename.c_str ());
|
||||||
|
ssh_client.disconnect();
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh_client.disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Pandora_Windows_Service::copyFtpDataFile (string host,
|
||||||
|
string remote_path,
|
||||||
|
string filename)
|
||||||
|
{
|
||||||
|
FTP::Pandora_Ftp_Client ftp_client;
|
||||||
|
string filepath;
|
||||||
|
string password;
|
||||||
|
|
||||||
|
filepath = conf->getValue ("temporal");
|
||||||
|
if (filepath[filepath.length () - 1] != '\\') {
|
||||||
|
filepath += "\\";
|
||||||
|
}
|
||||||
|
filepath += filename;
|
||||||
|
|
||||||
|
password = conf->getValue ("ftp_password");
|
||||||
|
|
||||||
|
ftp_client.connect (host,
|
||||||
|
22,
|
||||||
|
"pandora",
|
||||||
|
password);
|
||||||
|
|
||||||
|
try {
|
||||||
|
ftp_client.ftpFileFilename (remote_path + filename,
|
||||||
|
filepath);
|
||||||
|
} catch (FTP::Unknown_Host e) {
|
||||||
|
pandoraLog ("Failed when copying to %s (%s)", host.c_str (),
|
||||||
|
ftp_client.getError ().c_str ());
|
||||||
|
throw e;
|
||||||
|
} catch (FTP::Authentication_Failed e) {
|
||||||
|
pandoraLog ("Pandora Agent: Authentication Failed "
|
||||||
|
"when connecting to %s (%s)",
|
||||||
|
host.c_str (), ftp_client.getError ().c_str ());
|
||||||
|
throw e;
|
||||||
|
} catch (FTP::FTP_Exception e) {
|
||||||
|
pandoraLog ("Pandora Agent: Failed when copying to %s (%s)",
|
||||||
|
host.c_str (), ftp_client.getError ().c_str ());
|
||||||
|
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
|
||||||
|
ftp_client.disconnect ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Pandora_Windows_Service::copyDataFile (string filename)
|
||||||
|
{
|
||||||
|
string mode, host, remote_path;
|
||||||
|
|
||||||
|
mode = conf->getValue ("transfer_mode");
|
||||||
|
host = conf->getValue ("server_ip");
|
||||||
|
remote_path = conf->getValue ("server_path");
|
||||||
|
if (remote_path[remote_path.length () - 1] != '/') {
|
||||||
|
remote_path += "/";
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (mode == "ftp") {
|
||||||
|
copyFtpDataFile (host, remote_path, filename);
|
||||||
|
} else if (mode == "ssh" || mode == "") {
|
||||||
|
copyScpDataFile (host, remote_path, filename);
|
||||||
|
} else {
|
||||||
|
pandoraLog ("Invalid transfer mode: %s."
|
||||||
|
"Please rechak transfer_mode option "
|
||||||
|
"in configuration file.");
|
||||||
|
}
|
||||||
|
|
||||||
|
pandoraLog ("Successfuly copied XML file to server.");
|
||||||
|
} catch (Pandora_Exception e) {
|
||||||
if (getPandoraDebug () == false) {
|
if (getPandoraDebug () == false) {
|
||||||
|
string filepath;
|
||||||
|
|
||||||
|
filepath = conf->getValue ("temporal");
|
||||||
|
if (filepath[filepath.length () - 1] != '\\') {
|
||||||
|
filepath += "\\";
|
||||||
|
}
|
||||||
|
filepath += filename;
|
||||||
try {
|
try {
|
||||||
Pandora_File::removeFile (filepath);
|
Pandora_File::removeFile (filepath);
|
||||||
} catch (Pandora_File::Delete_Error e) {
|
} catch (Pandora_File::Delete_Error e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
remote_filepath = conf->getValue ("server_path");
|
|
||||||
if (remote_filepath[remote_filepath.length () - 1] != '/') {
|
|
||||||
remote_filepath += "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
pandoraDebug ("Remote copying XML %s on server %s at %s%s",
|
|
||||||
filepath.c_str (), remote_host.c_str (),
|
|
||||||
remote_filepath.c_str (), filename.c_str ());
|
|
||||||
try {
|
|
||||||
ssh_client->scpFileFilename (remote_filepath + filename,
|
|
||||||
filepath);
|
|
||||||
} catch (Pandora_Exception e) {
|
|
||||||
pandoraLog ("Unable to copy at %s%s", remote_filepath.c_str (),
|
|
||||||
filename.c_str ());
|
|
||||||
ssh_client->disconnect();
|
|
||||||
delete ssh_client;
|
|
||||||
if (getPandoraDebug () == false) {
|
|
||||||
try {
|
|
||||||
Pandora_File::removeFile (filepath);
|
|
||||||
} catch (Pandora_File::Delete_Error e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssh_client->disconnect();
|
|
||||||
delete ssh_client;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -36,14 +36,19 @@ namespace Pandora {
|
|||||||
*/
|
*/
|
||||||
class Pandora_Windows_Service : public Windows_Service {
|
class Pandora_Windows_Service : public Windows_Service {
|
||||||
private:
|
private:
|
||||||
SSH::Pandora_Ssh_Client *ssh_client;
|
|
||||||
Pandora_Agent_Conf *conf;
|
Pandora_Agent_Conf *conf;
|
||||||
Pandora_Modules::Pandora_Module_List *modules;
|
Pandora_Modules::Pandora_Module_List *modules;
|
||||||
long execution_number;
|
long execution_number;
|
||||||
string agent_name;
|
string agent_name;
|
||||||
|
|
||||||
TiXmlElement *getXmlHeader ();
|
TiXmlElement *getXmlHeader ();
|
||||||
void copyDataFile (string filename);
|
void copyDataFile (string filename);
|
||||||
|
void copyScpDataFile (string host,
|
||||||
|
string remote_path,
|
||||||
|
string filename);
|
||||||
|
void copyFtpDataFile (string host,
|
||||||
|
string remote_path,
|
||||||
|
string filename);
|
||||||
|
|
||||||
void pandora_run ();
|
void pandora_run ();
|
||||||
void pandora_init ();
|
void pandora_init ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user