~brand-nmapsi4/nmapsi4/master

« back to all changes in this revision

Viewing changes to src/app/mainwin.h

  • Committer: Francesco Cecconi
  • Date: 2011-12-18 11:02:04 UTC
  • Revision ID: git-v1:60a69e132c8ffeb2727e558b2b2e8ac1713e332e
Removed nmapsi4-logr (dedicate repository) but it could be deprecated.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/***************************************************************************
 
2
 *   Copyright (C) 2007-2011 by Francesco Cecconi                          *
 
3
 *   francesco.cecconi@gmail.com                                           *
 
4
 *                                                                         *
 
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.        *
 
8
 *                                                                         *
 
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.                          *
 
13
 *                                                                         *
 
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
 ***************************************************************************/
 
19
 
 
20
#ifndef MAINWIN_H
 
21
#define MAINWIN_H
 
22
 
 
23
#include "ui_mainwin.h"
 
24
 
 
25
// Qt4 include
 
26
#include <QtGui/QMainWindow>
 
27
#include <QtGui/QMessageBox>
 
28
#include <QtGui/QToolButton>
 
29
#include <QtGui/QTextDocument>
 
30
#include <QtGui/QSplitter>
 
31
#include <QtCore/QHash>
 
32
#include <QtCore/QPointer>
 
33
#include <QtCore/QTimer>
 
34
#include <QtCore/QDir>
 
35
#include <QtCore/QDate>
 
36
#include <QtCore/QTime>
 
37
#include <QtNetwork/QHostInfo>
 
38
#include <QtNetwork/QHostAddress>
 
39
#include <QtWebKit/QWebView>
 
40
#include <QtGui/QCompleter>
 
41
#include <QtGui/QStringListModel>
 
42
 
 
43
// local include
 
44
#include "profilemain.h"
 
45
#include "loghistory.h"
 
46
#include "staticDefine.h"
 
47
#include "nmapsi4Debug.h"
 
48
#include "addparameterstobookmark.h"
 
49
#include "memorytools.h"
 
50
#include "monitor.h"
 
51
#include "utilities.h"
 
52
#include "hostTools.h"
 
53
#include "qpushbuttonorientated.h"
 
54
#include "vulnerability.h"
 
55
#include "nsemanager.h"
 
56
#include "discovermanager.h"
 
57
#include "parsermanager.h"
 
58
 
 
59
// define class namespace
 
60
using namespace memory;
 
61
 
 
62
namespace Ui
 
63
{
 
64
    class MainWindow;
 
65
}
 
66
 
 
67
class nmapClass : public QMainWindow, public Ui::MainWindow
 
68
{
 
69
    Q_OBJECT
 
70
 
 
71
    friend class parserManager;
 
72
    friend class vulnerability;
 
73
    friend class nseManager;
 
74
    friend class discoverManager;
 
75
    friend class monitor;
 
76
 
 
77
public:
 
78
    nmapClass();
 
79
    ~nmapClass();
 
80
 
 
81
private:
 
82
    void preScanLookup(const QString hostname);
 
83
    void rootMode();
 
84
    void isEmptyLog();
 
85
    void setNmapsiSlot();
 
86
    QFile* create_logFile(const QString Path);
 
87
    QStringList check_extensions();
 
88
    QStringList loadExtensions();
 
89
    void resetOptions();
 
90
    void checkProfile();
 
91
    void initGUI();
 
92
    bool checkViewOS(const QString OSline, QTreeWidgetItem *itemOS) const;
 
93
    void setTreeWidgetValues();
 
94
    void createBar();
 
95
    void updateComboPar();
 
96
    void updateComboBook();
 
97
    void restoreGlobalProfile();
 
98
    QHash<QString, QString> defaultScanProfile() const;
 
99
    void loadHistoryDefault();
 
100
    void restoreSettings();
 
101
    void setTreeSettings();
 
102
    void setDefaultAction();
 
103
    void setDefaultSplitter();
 
104
    void defaultComboValues();
 
105
    void createToolButtonSetup();
 
106
    void setQuickProfile();
 
107
    void setNormalProfile();
 
108
    void setFullVersionProfile();
 
109
    void setQuickVersionProfile();
 
110
    void updateCompleter();
 
111
 
 
112
protected:
 
113
    int uid;
 
114
    QFile *_logFilePath;
 
115
    QListWidgetItem *scanW;
 
116
    QListWidgetItem *toolW;
 
117
    QListWidgetItem *discoverW;
 
118
    QListWidgetItem *fileW;
 
119
    QListWidgetItem *timingW;
 
120
    QString FileName;
 
121
    QString firstPath;
 
122
    QString Profile;
 
123
    QString logPath;
 
124
    QString logSessionFile;
 
125
    bool globalProfile;
 
126
    bool checkLog;
 
127
    bool flag_state;
 
128
    bool savePos;
 
129
    bool saveSize;
 
130
    bool listClearFlag;
 
131
    bool verboseLog;
 
132
    bool lookupInternal;
 
133
    bool lookupDig;
 
134
    bool NSSsupport;
 
135
    bool TraceEnabled;
 
136
    bool LookupEnabled;
 
137
    bool digSupported;
 
138
    int hostCache;;
 
139
    QList<QTreeWidgetItem*> mainTreeElem;
 
140
    QHash<QString, QPushButtonOrientated*> _collectionsButton;
 
141
    QSplitter *cW;
 
142
    QSplitter *bW;
 
143
    QToolButton *menuSetup;
 
144
    monitor *_monitor;
 
145
    utilities *_utilities;
 
146
    parserManager *_parser;
 
147
    QPointer<QCompleter> _completer;
 
148
    QPointer<QCompleter> _completerVuln;
 
149
    QPointer<QStringListModel> _hostModel;
 
150
    QPointer<QStringListModel> _vulnModel;
 
151
    vulnerability* _vulnerability;
 
152
    nseManager* _nseManager;
 
153
    discoverManager* _discoverManager;
 
154
 
 
155
private slots:
 
156
    void initObject();
 
157
    void startScan();
 
158
    void stop_scan();
 
159
    void exit();
 
160
    void update_portCombo();
 
161
    void update_scanCombo();
 
162
    void update_inputcheck();
 
163
    void update_discover();
 
164
    void update_timing();
 
165
    void update_options();
 
166
    void update_comboVerbosity();
 
167
    void openBrowser();
 
168
    void fileSession();
 
169
    void listClear();
 
170
    void checkFullScreen();
 
171
    void updateMenuBar();
 
172
    void updateIconsBox();
 
173
    void callScanH();
 
174
    void callParFromBook();
 
175
    void monitorRuntimeEvent();
 
176
    void updateScanCounter(int hostNumber);
 
177
    //update and log slots
 
178
    void startProfile_ui();
 
179
    void readProfile();
 
180
    void saveAsLog();
 
181
    void saveLog();
 
182
    void updateFontHost();
 
183
    void callSearchHistory();
 
184
    void saveBookMarks();
 
185
    void saveBookMarksPar(const QString profileName, const QString profilePar);
 
186
    void deleteBookMark();
 
187
    void deleteBookMarkPar();
 
188
    void optionListCreate();
 
189
    void optionListUpdate();
 
190
    void updateSezScan();
 
191
    void updateSezLog();
 
192
    void updateSezVuln();
 
193
    void updateDiscoverVuln();
 
194
    void updateTabLook();
 
195
    void updateTabTrace();
 
196
    void NSSCheck();
 
197
    void loadDefaultProfile();
 
198
    void resetPar();
 
199
    void detailsOptions();
 
200
    void nssOptions();
 
201
    void bookOptions();
 
202
    void bookOptionsPar();
 
203
    //contest Menu
 
204
    void menuScanBook();
 
205
    void menuVulnBook();
 
206
    void menuParBook();
 
207
    void menuServiceMain();
 
208
    void slotParSelected();
 
209
    void slotHostSelected();
 
210
    void saveUiSettings();
 
211
    // global profile
 
212
    void saveGlobalProfile();
 
213
    void removeGlobalProfile();
 
214
    void startAddParBook_ui();
 
215
};
 
216
 
 
217
#endif