1
/***************************************************************************
2
* Copyright (C) 2011 by Francesco Cecconi *
3
* francesco.cecconi@gmail.com *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License. *
9
* This program is distributed in the hope that it will be useful, *
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
* GNU General Public License for more details. *
14
* You should have received a copy of the GNU General Public License *
15
* along with this program; if not, write to the *
16
* Free Software Foundation, Inc., *
17
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18
***************************************************************************/
24
#include <QtGui/QTreeWidget>
25
#include <QtCore/QObject>
26
#include <QtCore/QList>
27
#include <QtCore/QHash>
30
#include <QtDBus/QDBusConnection>
34
#include "memorytools.h"
35
#include "qprocessthread.h"
37
#include "lookupmanager.h"
38
#include "digmanager.h"
40
using namespace memory;
44
class monitor : public QObject
49
Q_CLASSINFO("D-Bus Interface", "org.nmapsi4.Nmapsi4")
53
monitor(QTreeWidget* monitor, nmapClass* parent);
63
* Add host in the monitor and start scan.
65
void addMonitorHost(const QString hostName, const QStringList parameters, LookupType option);
67
* Return true if host is present in the monitor, otherwise return false.
69
bool isHostOnMonitor(const QString hostname);
71
* Return current number of scanning host in the monitor.
73
int monitorHostNumber();
75
* Clear all host in monitor
77
void clearHostMonitor();
79
* Clear all scan host details
81
void clearHostMonitorDetails();
84
void startScan(const QString hostname, QStringList parameters);
85
void startLookup(const QString hostname, LookupType option);
86
void updateMonitorHost(const QString hostName, int valueIndex, const QString newData);
88
* This method remove scanThread elem from scan hashTable
90
QProcessThread* takeMonitorElem(const QString hostName);
92
* Delete host from monitor
94
void delMonitorHost(const QString hostName);
97
QList<QTreeWidgetItem*> monitorElem;
98
QHash<QString, QProcessThread*> _scanHashList;
99
QHash<QString, QStringList> _scanHashListFlow;
100
QList<lookupManager*> internealLookupList;
101
QList<digManager*> digLookupList;
102
QTreeWidget* _monitor;
109
Q_SCRIPTABLE void monitorUpdated(int hostNumber);
113
void hostFinisced(const QStringList parametersList, QByteArray dataBuffer, QByteArray errorBuffer);
116
void readFlowFromThread(const QString hostname, QString lineData);
117
void scanFinisced(const QStringList parametersList, QByteArray dataBuffer, QByteArray errorBuffer);
118
void lookupFinisced(QHostInfo info, int state, const QString hostname);
122
* Stop host scan selected in the QTreeWidget.
124
void stopSelectedScan();
125
void showSelectedScanDetails();