Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
FmclientUi
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuai.liu
FmclientUi
Commits
12ec6bcb
Commit
12ec6bcb
authored
Mar 11, 2019
by
刘帅
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
加入白名单验证
parent
cb967bce
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
4 deletions
+60
-4
base/FmPee.cpp
+4
-2
main.cpp
+7
-1
qfmclient.cpp
+48
-1
qfmclient.h
+1
-0
No files found.
base/FmPee.cpp
View file @
12ec6bcb
...
...
@@ -35,9 +35,10 @@ namespace FmMd5{
in
.
seekg
(
0
,
ios_base
::
end
);
int
nFileLen
=
in
.
tellg
();
in
.
seekg
(
0
,
ios_base
::
beg
);
double
iCount
=
ceil
((
double
)
nFileLen
/
1024
);
iCount
=
iCount
-
minusCount
;
if
(
iCount
<=
minusCount
)
if
(
iCount
<=
0
)
{
return
""
;
}
...
...
@@ -57,7 +58,8 @@ namespace FmMd5{
if
(
i
==
iCount
)
{
md5
.
update
(
buffer
,
length
);
//md5.update(buffer, length);
break
;
}
}
...
...
main.cpp
View file @
12ec6bcb
...
...
@@ -42,11 +42,17 @@ int main(int argc, char *argv[])
qDebug
()
<<
"verify failed! this application can not run."
;
return
0
;
}
QFmClient
client
;
if
(
!
client
.
verifyWhitelists
())
{
OutputDebugStringA
(
"verify whitelists failed"
);
return
0
;
}
InitLogger
();
QLOG_INFO
()
<<
"start FmclientUi..."
;
Widget
w
;
scanner
s
;
QFmClient
client
;
//
QFmClient client;
QObject
::
connect
(
&
client
,
&
QFmClient
::
HideUi
,
&
w
,
&
Widget
::
hide
,
Qt
::
QueuedConnection
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
ShowUi
,
&
w
,
&
Widget
::
showRequesting
,
Qt
::
QueuedConnection
);
QObject
::
connect
(
&
client
,
&
QFmClient
::
ShowRefundUi
,
&
s
,
&
scanner
::
showRefund
);
...
...
qfmclient.cpp
View file @
12ec6bcb
...
...
@@ -13,7 +13,8 @@
#include <QTimer>
#include "QsLog/QsLog.h"
#include "utility.h"
#include "base/md5.h"
#include "base/FmPee.h"
#include "scanner.h"
#ifdef WIN32
...
...
@@ -998,6 +999,52 @@ void QFmClient::SetTransactionId(QString fmId)
emit
ContinueRefund
();
}
bool
QFmClient
::
verifyWhitelists
()
{
if
(
!
Init
(
"115.159.63.201"
,
29534
,
34952
,
30
,
5
))
{
qDebug
()
<<
"Init failed!"
;
return
false
;
}
QString
filePath
=
QCoreApplication
::
applicationFilePath
();
std
::
string
sign
=
FmMd5
::
FileDigest
(
filePath
.
toStdString
().
c_str
(),
2
).
c_str
();
OutputDebugStringA
(
sign
.
c_str
());
QJsonObject
verifyObject
;
verifyObject
.
insert
(
"reqtype"
,
31
);
verifyObject
.
insert
(
"ver"
,
1
);
verifyObject
.
insert
(
"sign"
,
QString
(
sign
.
c_str
()));
strcpy
(
_sendbuf
,
QString
(
QJsonDocument
(
verifyObject
).
toJson
()).
toStdString
().
c_str
());
if
(
0
!=
Try2ConnectZhProxy
())
{
OutputDebugStringA
(
"connect to proxy failed"
);
return
false
;
}
if
(
0
!=
SendData2ZhProxyAndWaitRspData
())
{
OutputDebugStringA
(
"SendData2ZhProxyAndWaitRspData() failed"
);
return
false
;
}
OutputDebugStringA
(
_recvbuf
);
QByteArray
recvdata
(
_recvbuf
);
QJsonParseError
json_error
;
QJsonDocument
doc
=
QJsonDocument
::
fromJson
(
recvdata
,
&
json_error
);
if
(
json_error
.
error
!=
QJsonParseError
::
NoError
||
!
doc
.
isObject
())
{
OutputDebugStringA
(
"error request json data!"
);
return
false
;
}
QJsonObject
json
=
doc
.
object
();
if
(
json
.
contains
(
"statusCode"
)
&&
json
[
"statusCode"
].
toInt
()
==
100
)
{
return
true
;
}
else
{
return
false
;
}
}
void
QFmClient
::
run
()
{
if
(
!
Init
(
"115.159.63.201"
,
29534
,
34952
,
30
,
5
))
...
...
qfmclient.h
View file @
12ec6bcb
...
...
@@ -68,6 +68,7 @@ public:
int
sendAESData2Proxy
(
int
sock
,
char
*
buf
,
int
length
);
int
recvAESDataFromProxy
(
int
sock
,
char
*
buf
,
int
maxBufferLength
);
void
outputHex
(
char
*
out
,
int
length
);
bool
verifyWhitelists
();
//白名单验证
public
slots
:
void
SetTransactionId
(
QString
fmId
);
//退款流程1, 从输入获取长码
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment