mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-28 18:28:23 -05:00
WPS: Added wpa_gui-qt4 support for BSS selection and AP PIN use
The specific AP (BSSID) can now be selected through scan results for WPS (WPS pushbutton on the network configuration dialog). When a BSSID is selected, AP device PIN (e.g., from a label) can be used to configure the AP by acting as a Registrar.
This commit is contained in:
parent
a92c421d1a
commit
0ede75ae58
@ -44,6 +44,7 @@ NetworkConfig::NetworkConfig(QWidget *parent, const char *, bool, Qt::WFlags)
|
|||||||
connect(removeButton, SIGNAL(clicked()), this, SLOT(removeNetwork()));
|
connect(removeButton, SIGNAL(clicked()), this, SLOT(removeNetwork()));
|
||||||
connect(eapSelect, SIGNAL(activated(int)), this,
|
connect(eapSelect, SIGNAL(activated(int)), this,
|
||||||
SLOT(eapChanged(int)));
|
SLOT(eapChanged(int)));
|
||||||
|
connect(useWpsButton, SIGNAL(clicked()), this, SLOT(useWps()));
|
||||||
|
|
||||||
wpagui = NULL;
|
wpagui = NULL;
|
||||||
new_network = false;
|
new_network = false;
|
||||||
@ -98,6 +99,10 @@ void NetworkConfig::paramsFromScanResults(QTreeWidgetItem *sel)
|
|||||||
wepEnabled(auth == AUTH_NONE && encr == 1);
|
wepEnabled(auth == AUTH_NONE && encr == 1);
|
||||||
|
|
||||||
getEapCapa();
|
getEapCapa();
|
||||||
|
|
||||||
|
if (flags.indexOf("[WPS") >= 0)
|
||||||
|
useWpsButton->setEnabled(true);
|
||||||
|
bssid = sel->text(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -806,3 +811,13 @@ void NetworkConfig::getEapCapa()
|
|||||||
QStringList types = res.split(QChar(' '));
|
QStringList types = res.split(QChar(' '));
|
||||||
eapSelect->insertItems(-1, types);
|
eapSelect->insertItems(-1, types);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void NetworkConfig::useWps()
|
||||||
|
{
|
||||||
|
if (wpagui == NULL)
|
||||||
|
return;
|
||||||
|
wpagui->setBssFromScan(bssid);
|
||||||
|
wpagui->wpsDialog();
|
||||||
|
close();
|
||||||
|
}
|
||||||
|
@ -43,6 +43,7 @@ public slots:
|
|||||||
virtual void writeWepKey(int network_id, QLineEdit *edit, int id);
|
virtual void writeWepKey(int network_id, QLineEdit *edit, int id);
|
||||||
virtual void removeNetwork();
|
virtual void removeNetwork();
|
||||||
virtual void eapChanged(int sel);
|
virtual void eapChanged(int sel);
|
||||||
|
virtual void useWps();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void languageChange();
|
virtual void languageChange();
|
||||||
@ -51,6 +52,7 @@ private:
|
|||||||
WpaGui *wpagui;
|
WpaGui *wpagui;
|
||||||
int edit_network_id;
|
int edit_network_id;
|
||||||
bool new_network;
|
bool new_network;
|
||||||
|
QString bssid;
|
||||||
|
|
||||||
virtual void wepEnabled(bool enabled);
|
virtual void wepEnabled(bool enabled);
|
||||||
virtual void getEapCapa();
|
virtual void getEapCapa();
|
||||||
|
@ -349,14 +349,14 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="2" >
|
||||||
<widget class="QPushButton" name="addButton" >
|
<widget class="QPushButton" name="addButton" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Add</string>
|
<string>Add</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<item row="1" column="3" >
|
||||||
<widget class="QPushButton" name="removeButton" >
|
<widget class="QPushButton" name="removeButton" >
|
||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
@ -379,6 +379,16 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<widget class="QPushButton" name="useWpsButton" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>WPS</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11" />
|
<layoutdefault spacing="6" margin="11" />
|
||||||
|
@ -91,6 +91,9 @@ WpaGui::WpaGui(QWidget *parent, const char *, Qt::WFlags)
|
|||||||
SLOT(tabChanged(int)));
|
SLOT(tabChanged(int)));
|
||||||
connect(wpsPbcButton, SIGNAL(clicked()), this, SLOT(wpsPbc()));
|
connect(wpsPbcButton, SIGNAL(clicked()), this, SLOT(wpsPbc()));
|
||||||
connect(wpsPinButton, SIGNAL(clicked()), this, SLOT(wpsGeneratePin()));
|
connect(wpsPinButton, SIGNAL(clicked()), this, SLOT(wpsGeneratePin()));
|
||||||
|
connect(wpsApPinEdit, SIGNAL(textChanged(const QString &)), this,
|
||||||
|
SLOT(wpsApPinChanged(const QString &)));
|
||||||
|
connect(wpsApPinButton, SIGNAL(clicked()), this, SLOT(wpsApPin()));
|
||||||
|
|
||||||
eh = NULL;
|
eh = NULL;
|
||||||
scanres = NULL;
|
scanres = NULL;
|
||||||
@ -614,14 +617,7 @@ void WpaGui::disconnect()
|
|||||||
char reply[10];
|
char reply[10];
|
||||||
size_t reply_len = sizeof(reply);
|
size_t reply_len = sizeof(reply);
|
||||||
ctrlRequest("DISCONNECT", reply, &reply_len);
|
ctrlRequest("DISCONNECT", reply, &reply_len);
|
||||||
|
stopWpsRun(false);
|
||||||
if (wpsRunning)
|
|
||||||
wpsStatusText->setText("Stopped");
|
|
||||||
else
|
|
||||||
wpsStatusText->setText("");
|
|
||||||
wpsPinEdit->setEnabled(false);
|
|
||||||
wpsInstructions->setText("");
|
|
||||||
wpsRunning = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -769,12 +765,7 @@ void WpaGui::processMsg(char *msg)
|
|||||||
showTrayMessage(QSystemTrayIcon::Information, 3,
|
showTrayMessage(QSystemTrayIcon::Information, 3,
|
||||||
"Connection to network established.");
|
"Connection to network established.");
|
||||||
QTimer::singleShot(5 * 1000, this, SLOT(showTrayStatus()));
|
QTimer::singleShot(5 * 1000, this, SLOT(showTrayStatus()));
|
||||||
if (wpsRunning) {
|
stopWpsRun(true);
|
||||||
wpsStatusText->setText("Connected to the network");
|
|
||||||
wpsPinEdit->setEnabled(false);
|
|
||||||
wpsInstructions->setText("");
|
|
||||||
wpsRunning = false;
|
|
||||||
}
|
|
||||||
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PBC)) {
|
} else if (str_match(pos, WPS_EVENT_AP_AVAILABLE_PBC)) {
|
||||||
showTrayMessage(QSystemTrayIcon::Information, 3,
|
showTrayMessage(QSystemTrayIcon::Information, 3,
|
||||||
"Wi-Fi Protected Setup (WPS) AP\n"
|
"Wi-Fi Protected Setup (WPS) AP\n"
|
||||||
@ -877,14 +868,7 @@ void WpaGui::selectNetwork( const QString &sel )
|
|||||||
cmd.prepend("SELECT_NETWORK ");
|
cmd.prepend("SELECT_NETWORK ");
|
||||||
ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
|
ctrlRequest(cmd.toAscii().constData(), reply, &reply_len);
|
||||||
triggerUpdate();
|
triggerUpdate();
|
||||||
|
stopWpsRun(false);
|
||||||
if (wpsRunning)
|
|
||||||
wpsStatusText->setText("Stopped");
|
|
||||||
else
|
|
||||||
wpsStatusText->setText("");
|
|
||||||
wpsPinEdit->setEnabled(false);
|
|
||||||
wpsInstructions->setText("");
|
|
||||||
wpsRunning = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1372,8 +1356,9 @@ void WpaGui::tabChanged(int index)
|
|||||||
if (wpsRunning)
|
if (wpsRunning)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* TODO: Update WPS status based on latest scan results and
|
wpsApPinEdit->setEnabled(!bssFromScan.isEmpty());
|
||||||
* availability of WPS APs */
|
if (bssFromScan.isEmpty())
|
||||||
|
wpsApPinButton->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1417,3 +1402,51 @@ void WpaGui::wpsGeneratePin()
|
|||||||
wpsStatusText->setText("Waiting for Registrar");
|
wpsStatusText->setText("Waiting for Registrar");
|
||||||
wpsRunning = true;
|
wpsRunning = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WpaGui::setBssFromScan(const QString &bssid)
|
||||||
|
{
|
||||||
|
bssFromScan = bssid;
|
||||||
|
wpsApPinEdit->setEnabled(!bssFromScan.isEmpty());
|
||||||
|
wpsApPinButton->setEnabled(wpsApPinEdit->text().length() == 8);
|
||||||
|
wpsStatusText->setText("WPS AP selected from scan results");
|
||||||
|
wpsInstructions->setText("If you want to use an AP device PIN, e.g., "
|
||||||
|
"from a label in the device, enter the eight "
|
||||||
|
"digit AP PIN and click Use AP PIN button.");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WpaGui::wpsApPinChanged(const QString &text)
|
||||||
|
{
|
||||||
|
wpsApPinButton->setEnabled(text.length() == 8);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WpaGui::wpsApPin()
|
||||||
|
{
|
||||||
|
char reply[20];
|
||||||
|
size_t reply_len = sizeof(reply);
|
||||||
|
|
||||||
|
QString cmd("WPS_REG " + bssFromScan + " " + wpsApPinEdit->text());
|
||||||
|
if (ctrlRequest(cmd.toAscii().constData(), reply, &reply_len) < 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wpsStatusText->setText("Waiting for AP/Enrollee");
|
||||||
|
wpsRunning = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void WpaGui::stopWpsRun(bool success)
|
||||||
|
{
|
||||||
|
if (wpsRunning)
|
||||||
|
wpsStatusText->setText(success ? "Connected to the network" :
|
||||||
|
"Stopped");
|
||||||
|
else
|
||||||
|
wpsStatusText->setText("");
|
||||||
|
wpsPinEdit->setEnabled(false);
|
||||||
|
wpsInstructions->setText("");
|
||||||
|
wpsRunning = false;
|
||||||
|
bssFromScan = "";
|
||||||
|
wpsApPinEdit->setEnabled(false);
|
||||||
|
wpsApPinButton->setEnabled(false);
|
||||||
|
}
|
||||||
|
@ -38,6 +38,7 @@ public:
|
|||||||
virtual void enableNetwork(const QString &sel);
|
virtual void enableNetwork(const QString &sel);
|
||||||
virtual void disableNetwork(const QString &sel);
|
virtual void disableNetwork(const QString &sel);
|
||||||
virtual int getNetworkDisabled(const QString &sel);
|
virtual int getNetworkDisabled(const QString &sel);
|
||||||
|
void setBssFromScan(const QString &bssid);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void parse_argv();
|
virtual void parse_argv();
|
||||||
@ -75,6 +76,8 @@ public slots:
|
|||||||
virtual void tabChanged(int index);
|
virtual void tabChanged(int index);
|
||||||
virtual void wpsPbc();
|
virtual void wpsPbc();
|
||||||
virtual void wpsGeneratePin();
|
virtual void wpsGeneratePin();
|
||||||
|
virtual void wpsApPinChanged(const QString &text);
|
||||||
|
virtual void wpsApPin();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
virtual void languageChange();
|
virtual void languageChange();
|
||||||
@ -111,6 +114,10 @@ private:
|
|||||||
int openCtrlConnection(const char *ifname);
|
int openCtrlConnection(const char *ifname);
|
||||||
|
|
||||||
bool wpsRunning;
|
bool wpsRunning;
|
||||||
|
|
||||||
|
QString bssFromScan;
|
||||||
|
|
||||||
|
void stopWpsRun(bool success);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* WPAGUI_H */
|
#endif /* WPAGUI_H */
|
||||||
|
@ -293,100 +293,84 @@
|
|||||||
<attribute name="title" >
|
<attribute name="title" >
|
||||||
<string>WPS</string>
|
<string>WPS</string>
|
||||||
</attribute>
|
</attribute>
|
||||||
<widget class="QPushButton" name="wpsPbcButton" >
|
<layout class="QGridLayout" name="gridLayout" >
|
||||||
<property name="geometry" >
|
<item row="0" column="0" >
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>40</y>
|
|
||||||
<width>141</width>
|
|
||||||
<height>28</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>PBC - push button</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="wpsPinButton" >
|
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>90</y>
|
|
||||||
<width>141</width>
|
|
||||||
<height>28</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>Generate PIN</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="label" >
|
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>160</x>
|
|
||||||
<y>100</y>
|
|
||||||
<width>21</width>
|
|
||||||
<height>18</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
|
||||||
<string>PIN</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLineEdit" name="wpsPinEdit" >
|
|
||||||
<property name="enabled" >
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>190</x>
|
|
||||||
<y>90</y>
|
|
||||||
<width>113</width>
|
|
||||||
<height>28</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="readOnly" >
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="label_2" >
|
<widget class="QLabel" name="label_2" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>41</width>
|
|
||||||
<height>18</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Status:</string>
|
<string>Status:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="3" >
|
||||||
<widget class="QLabel" name="wpsStatusText" >
|
<widget class="QLabel" name="wpsStatusText" >
|
||||||
<property name="geometry" >
|
|
||||||
<rect>
|
|
||||||
<x>70</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>231</width>
|
|
||||||
<height>18</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string/>
|
<string/>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QTextEdit" name="wpsInstructions" >
|
</item>
|
||||||
<property name="geometry" >
|
<item row="1" column="0" colspan="2" >
|
||||||
<rect>
|
<widget class="QPushButton" name="wpsPbcButton" >
|
||||||
<x>10</x>
|
<property name="text" >
|
||||||
<y>130</y>
|
<string>PBC - push button</string>
|
||||||
<width>301</width>
|
</property>
|
||||||
<height>91</height>
|
</widget>
|
||||||
</rect>
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2" >
|
||||||
|
<widget class="QPushButton" name="wpsPinButton" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Generate PIN</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2" >
|
||||||
|
<widget class="QLabel" name="label" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>PIN:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3" >
|
||||||
|
<widget class="QLineEdit" name="wpsPinEdit" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="readOnly" >
|
<property name="readOnly" >
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" colspan="2" >
|
||||||
|
<widget class="QPushButton" name="wpsApPinButton" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="text" >
|
||||||
|
<string>Use AP PIN</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2" >
|
||||||
|
<widget class="QLabel" name="label_3" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>AP PIN:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="3" >
|
||||||
|
<widget class="QLineEdit" name="wpsApPinEdit" >
|
||||||
|
<property name="enabled" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" colspan="4" >
|
||||||
|
<widget class="QTextEdit" name="wpsInstructions" >
|
||||||
|
<property name="readOnly" >
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
Loading…
Reference in New Issue
Block a user