1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
/***************************************************************************
* *
* Copyright (C) 2005, 2006 by Kevin Gilbert *
* kev.gilbert@cdu.edu.au *
* *
* 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 of the License, 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 _SCANWIDGET_H_
#define _SCANWIDGET_H_
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <ntqframe.h>
#include "global.h"
// forward class definitions
// =========================
class CommonWidget;
class CompoundWidget;
class HTMLWidget;
class TDEConfig;
class TDEProcess;
class KTabWidget;
class LoggingOptions;
class OutputWidget;
class PAndSOptions;
class TQFile;
class TQLineEdit;
class TQPushButton;
class TQStringList;
class ScanMonitor;
class SimpleOptions;
class TimingWidget;
// ScanWidget class definition
// ===========================
class ScanWidget : public TQFrame
{ Q_OBJECT
public:
ScanWidget( const TQString& scanName,
const bool useTargetHost,
TQWidget* parent = NULL,
const char* name = NULL );
virtual ~ScanWidget( );
enum State
{ dormant,
finished,
running
};
void fileSave( );
void fileSaveAs( );
void ignoreTabChanges( const bool b ) { m_ignoreTabChanges = b; }
bool isDirty( ) const { return m_dirty; }
void profileAskAndSave( );
void profileCopy( );
void profileDelete( );
void profileLoad( );
TQString profileName( ) const { return m_profileName; }
void profileRename( );
void profileSave( );
void profileSaveAs( );
void readSettings( );
void renameScan( const TQString& newScanName );
void saveSettings( );
TQString scanName( ) const { return m_scanName; }
void setProfileName( const TQString& profileName );
State state( ) const { return m_state; }
void state( const State s ) { m_state = s; }
void updateStatusBarText( );
bool useTargetHost( ) const { return m_useTargetHost; }
void useTargetHost( const bool b );
void wrapText( const bool wrap );
signals:
void displayHelp( const TQString& );
void errorLoadingLocalManPage( const TQString& );
void optionsDirty( );
void outputAvailable( const bool, const bool );
void scanRename( const TQString& );
void scanStarted( );
void scanStopped( ScanWidget* );
void setManPageActionStuff( const bool );
void statusBarText( const TQString& );
private slots:
void slotClearOutput( );
void slotDisplayDocBook( const TQString& anchor );
void slotDisplayUnknown( );
void slotFinaliseInitialisation( );
void slotHideOptions( );
void slotOptionsDirty( const bool dirty = true );
void slotProcessExited( );
void slotReceivedStderr( TDEProcess* process, char* buffer, int buflen );
void slotReceivedStdout( TDEProcess* process, char* buffer, int buflen );
void slotStartClicked( );
void slotStopClicked( );
void slotTabChanged( TQWidget* toWidget );
void slotTargetChanged( const TQString& target );
private:
TQStringList buildNmapOptionsList( );
void closePipe( TQFile*& pipe, int& pipeFD );
void createLayout( );
bool createPipe( const TQString type, const TQString& tempDir, TQFile*& pipe, int& pipeFD );
bool createPipes( );
void customEvent( TQCustomEvent* event );
bool getOptions( );
void getPortRanges( TQStringList* portRanges );
void initialiseManPage( );
void profileRead( );
void saveProfileName( );
void setInitialValues( );
TQPushButton* m_clearOutputButton;
int m_commonIndex;
CommonWidget* m_commonWidget;
int m_compoundIndex;
CompoundWidget* m_compoundWidget;
int m_currentTab;
bool m_dirty;
bool m_hideOptions;
TQPushButton* m_hideOptionsButton;
int m_htmlIndex;
bool m_ignoreTabChanges;
int m_loggingIndex;
LoggingOptions* m_loggingWidget;
TDEProcess* m_nmapProcess;
OutputWidget* m_outputWidget;
int m_pAndSIndex;
PAndSOptions* m_pAndSWidget;
TQFile* m_pipeStderr;
TQFile* m_pipeStdout;
int m_pipeStderrFD;
int m_pipeStdoutFD;
bool m_piping;
TQString m_profileName;
ScanMonitor* m_scanMonitor;
TQString m_scanName;
int m_simpleIndex;
SimpleOptions* m_simpleWidget;
TQPushButton* m_startButton;
State m_state;
TQPushButton* m_stopButton;
KTabWidget* m_tabWidget;
int m_timingIndex;
TimingWidget* m_timingWidget;
bool m_useTargetHost;
};
#endif // _SCANWIDGET_H_
|