mirror of
https://github.com/cmclark00/retro-imager.git
synced 2025-05-18 16:05:21 +01:00
Windows WLAN PSK retrieval: unescape XML
Assuming unescaping standard XML entities is sufficient. (Skipping numerical unicode XML entities for now, as there is not a proper standardized way to represent non-ascii characters in a PSK anyway) Ref #541
This commit is contained in:
parent
6d69ff0797
commit
d972d5b87b
1 changed files with 20 additions and 1 deletions
|
@ -912,6 +912,25 @@ QString ImageWriter::getSSID()
|
|||
return ssid;
|
||||
}
|
||||
|
||||
inline QString unescapeXml(QString str)
|
||||
{
|
||||
static const char *table[] = {
|
||||
"<", "<",
|
||||
">", ">",
|
||||
""", "\"",
|
||||
"'", "'",
|
||||
"&", "&"
|
||||
};
|
||||
int tableLen = sizeof(table) / sizeof(table[0]);
|
||||
|
||||
for (int i=0; i < tableLen; i+=2)
|
||||
{
|
||||
str.replace(table[i], table[i+1]);
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
QString ImageWriter::getPSK(const QString &ssid)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -956,7 +975,7 @@ QString ImageWriter::getPSK(const QString &ssid)
|
|||
QRegularExpressionMatch match = rx.match(xml);
|
||||
|
||||
if (match.hasMatch()) {
|
||||
psk = match.captured(1);
|
||||
psk = unescapeXml(match.captured(1));
|
||||
}
|
||||
|
||||
WlanFreeMemory(xmlstr);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue