This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
QZJ_NetKeeper_CrackerDlg.cpp
1038 lines (936 loc) · 26.9 KB
/
QZJ_NetKeeper_CrackerDlg.cpp
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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// QZJ_NetKeeper_CrackerDlg.cpp : 实现文件
//
#include "stdafx.h"
#include "QZJ_NetKeeper_Cracker.h"
#include "QZJ_NetKeeper_CrackerDlg.h"
//#include "winsock.h"
#include <afxinet.h>
#include "Nov30thAuth.h"
#include "TaskbarNotifier.h"
#include "Crypt.h"
#include "ChineseCodeLib.h"
#include "VirtualizerSDK.h"
#include "Md5Checksum.h"
#include "NetKeeperHeader.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//#define DEBUG
#define PROGRAMVERSION "2008"
CString DZKDXY = "@DZKD.XY";
HICON hIconOffline,hIconOnline,hIconNotLogin,hIconChat;
NOTIFYICONDATA nid;
static bool isError;
static bool isRun;
CString username,password,usernameMD5;
char buffresult[4096];
CTaskbarNotifier m_wndTaskbarNotifier1;
CString BlockList;
char md5Temp[200] = {0};
bool isChatICO = false;
bool hasUpdate = false;
bool hasChatInit = false;
CString m_pin;
CString patchAddress,patchFileName;
long waitTime = 30000;
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// 对话框数据
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
DECLARE_MESSAGE_MAP()
public:
CString m_aboutStr;
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
, m_aboutStr(_T("程序由QZJ [HOHO``]同学开发。\r\n仅限杭州电子科技大学内部研究使用。\r\n程序文件由HOHO软件签名。\r\n禁止任何尝试对本程序反向工程的行为。\r\n否则将追究法律责任。"))
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_EDIT1, m_aboutStr);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
END_MESSAGE_MAP()
// CQZJ_NetKeeper_CrackerDlg 对话框
CQZJ_NetKeeper_CrackerDlg::CQZJ_NetKeeper_CrackerDlg(CWnd* pParent /*=NULL*/)
: CDialog(CQZJ_NetKeeper_CrackerDlg::IDD, pParent)
, m_username(_T(""))
, m_password(_T(""))
, m_isRemember(FALSE)
, m_updateInfo(_T("正在连接升级服务器。"))
, m_isAutoRun(FALSE)
, m_resultname(_T(""))
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CQZJ_NetKeeper_CrackerDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Text(pDX, IDC_USER, m_username);
DDX_Text(pDX, IDC_PASS, m_password);
DDX_Check(pDX, IDC_CHECKREMEMBER, m_isRemember);
DDX_Control(pDX, IDC_BUTTONLOGIN, m_LoginBtn);
DDX_Check(pDX, IDC_CHECKAUTORUN, m_isAutoRun);
DDX_Text(pDX, IDC_EDITRESULTNAME, m_resultname);
}
BEGIN_MESSAGE_MAP(CQZJ_NetKeeper_CrackerDlg, CDialog)
ON_MESSAGE(WM_SHOWTASK,onShowTask)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_CLOSE()
//}}AFX_MSG_MAP
ON_BN_CLICKED(IDC_BUTTONLOGIN, &CQZJ_NetKeeper_CrackerDlg::OnBnClickedButtonlogin)
ON_BN_CLICKED(IDC_CHECKREMEMBER, &CQZJ_NetKeeper_CrackerDlg::OnBnClickedCheckremember)
ON_COMMAND(ID_32771, &CQZJ_NetKeeper_CrackerDlg::On32771)
ON_COMMAND(ID_32773, &CQZJ_NetKeeper_CrackerDlg::On32773)
ON_COMMAND(ID_32774, &CQZJ_NetKeeper_CrackerDlg::On32774)
ON_COMMAND(ID_32772, &CQZJ_NetKeeper_CrackerDlg::On32772)
ON_COMMAND(ID_Update, &CQZJ_NetKeeper_CrackerDlg::OnUpdate)
ON_COMMAND(ID_32778, &CQZJ_NetKeeper_CrackerDlg::On32778)
ON_COMMAND(ID_32777, &CQZJ_NetKeeper_CrackerDlg::On32777)
ON_COMMAND(ID_32798, &CQZJ_NetKeeper_CrackerDlg::On32798)
ON_BN_CLICKED(IDC_CHECKAUTORUN, &CQZJ_NetKeeper_CrackerDlg::OnBnClickedCheckautorun)
ON_COMMAND(ID_32799, &CQZJ_NetKeeper_CrackerDlg::On32799)
ON_COMMAND(ID_32801, &CQZJ_NetKeeper_CrackerDlg::On32801)
ON_COMMAND(ID_32803, &CQZJ_NetKeeper_CrackerDlg::On32803)
END_MESSAGE_MAP()
// CQZJ_NetKeeper_CrackerDlg 消息处理程序
BOOL CQZJ_NetKeeper_CrackerDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// 将“关于...”菜单项添加到系统菜单中。
// IDM_ABOUTBOX 必须在系统命令范围内。
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
CString strAboutMenu;
strAboutMenu.LoadString(IDS_ABOUTBOX);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
char szTheAppPath[MAX_PATH];
::GetModuleFileName(NULL, szTheAppPath, MAX_PATH);
char *p = strrchr(szTheAppPath, '\\');
*++p = 0;
if (!SetCurrentDirectory(szTheAppPath))
AfxMessageBox("Change Dir Error.");
/*
CCrypt crypt;
CString address = "http://students.hdu.edu.cn/NetKeeper.Msi";
CString filename = "NetKeeper.Msi";
CString address1 = crypt.Encrypt(address,'U');
filename = crypt.Encrypt(filename,'P');
CString hash = crypt.Encrypt(address,'D');
int i = 1;
*/
{
CString cmdString = GetCommandLine();
if (cmdString.Find(" -QuickResponse") > 0 && m_isRemember==TRUE)
{
m_isAutoRun = true;
waitTime = 10000;
}
}
// 设置此对话框的图标。当应用程序主窗口不是对话框时,框架将自动
// 执行此操作
SetIcon(m_hIcon, TRUE); // 设置大图标
SetIcon(m_hIcon, FALSE); // 设置小图标
m_wndTaskbarNotifier1.Create(this);
m_wndTaskbarNotifier1.SetSkin(IDB_BITMSN);
m_wndTaskbarNotifier1.SetTextFont("Arial",90,TN_TEXT_NORMAL,TN_TEXT_UNDERLINE);
m_wndTaskbarNotifier1.SetTextColor(RGB(0,0,0),RGB(0,0,200));
m_wndTaskbarNotifier1.SetTextRect(CRect(10,23,m_wndTaskbarNotifier1.m_nSkinWidth-10,m_wndTaskbarNotifier1.m_nSkinHeight-25));
VIRTUALIZER_START
char title[200];
sprintf_s(title,sizeof(title),"杭电极速 [红色家园专版] -- Nov30th.Com Software.",PROGRAMVERSION);
this->SetWindowTextA(title);
m_wndTaskbarNotifier1.Show("正在连接红色家园升级服务器!",500,5000,500);
AfxBeginThread(UpdateProgram,this);
nid.cbSize=(DWORD)sizeof(NOTIFYICONDATA);
nid.hWnd=this->m_hWnd;
nid.uID=IDR_MAINFRAME;
nid.uFlags=NIF_ICON|NIF_MESSAGE|NIF_TIP;
nid.uCallbackMessage=WM_SHOWTASK; //自定义的消息名称
//hIcon = LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDR_MAINFRAME));
hIconOnline = AfxGetApp()->LoadIcon(IDI_ONLINE);
hIconOffline = AfxGetApp()->LoadIcon(IDI_OFFLINE);
hIconNotLogin = AfxGetApp()->LoadIcon(IDI_LOGOUT);
nid.hIcon = hIconNotLogin;
strcpy(nid.szTip, "杭电极速 [红色家园最终版] | HOHO`` Software");
Shell_NotifyIcon(NIM_ADD ,&nid);
m_username = "[email protected]";
CStdioFile file;
char temp[100];
CString filepath;
CString autoStart;
DeleteFile(_T("Qzj_NetKeeper_Cracker.cfg"));
if (file.Open("config.qzj",CFile::modeRead))
{
CCrypt *crypt = new CCrypt();
file.ReadString(temp,100);
m_username = crypt->Decrypt(temp,31);
file.ReadString(temp,100);
m_password = crypt->Decrypt(temp,31);
file.ReadString(temp,100);
file.Close();
m_isRemember = true;
}
CString cmdString = GetCommandLine();
UpdateData(false);
if (cmdString.Find(" -autorun") > 0 && m_isRemember==TRUE)
{
m_isAutoRun = true;
UpdateData(false);
//OnBnClickedButtonlogin();
}
#ifdef DEBUG
GetDlgItem(IDC_BUTTONCHAT)->EnableWindow(TRUE);
#endif
VIRTUALIZER_END
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
}
void CQZJ_NetKeeper_CrackerDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialog::OnSysCommand(nID, lParam);
}
}
// 如果向对话框添加最小化按钮,则需要下面的代码
// 来绘制该图标。对于使用文档/视图模型的 MFC 应用程序,
// 这将由框架自动完成。
void CQZJ_NetKeeper_CrackerDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // 用于绘制的设备上下文
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// 使图标在工作区矩形中居中
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// 绘制图标
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialog::OnPaint();
}
}
//当用户拖动最小化窗口时系统调用此函数取得光标
//显示。
HCURSOR CQZJ_NetKeeper_CrackerDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CQZJ_NetKeeper_CrackerDlg::OnBnClickedButtonlogin()
{
CNov30thAuth auth;
CString tempString;
UpdateData();
m_resultname = "";
m_resultname = auth.getPIN(m_username);
m_resultname += m_username;
tempString = "http://192.168.0.1/cgi-bin/prim?rc=@prim&rf=0004&rd=x&Wt=0200&lf=0037&ai=0&En=00-19-5B-DB-65-73&_PT=on&IU0=";
tempString += m_resultname;
tempString += "&IW0=";
tempString += m_password;
tempString += "&_IW1=";
tempString += m_password;
tempString += "&IT0=&DT0=300&_DT0=5&IM0=1492&DF00=o&DF01=x&_AD=on&Ef0%23=20&Ef1%23=0&Ef05=x&Ef0%23=2000&Ef1%23=8&Ef13=o";
UpdateData(false);
ShellExecute(NULL, "OPEN", "IEXPLORE.EXE", tempString, NULL, SW_SHOWMAXIMIZED );
//URI:
//m_LoginBtn.EnableWindow(false);
//m_cuteBtn.EnableWindow(false);
//AfxBeginThread(PreLogin, this);
//m_wndTaskbarNotifier1.Show("登录中。请稍候。。。",500,5000,500);
}
UINT CQZJ_NetKeeper_CrackerDlg::PreLogin(LPVOID pParam)
{
VIRTUALIZER_START
CQZJ_NetKeeper_CrackerDlg* app = (CQZJ_NetKeeper_CrackerDlg*)pParam;
CNov30thAuth auth;
app->UpdateData(true);
if (isRun)
{
AfxMessageBox("请报告这个BUG.一个按钮无可能按两次!");
return 1;
}
if (app->m_username.GetLength() <12)
return 1;
m_pin = auth.getPIN(app->m_username.Left(12));
/////////////////////////////BLOCK ACTION
CString blockString = app->HashString(app->m_username.Left(12));
blockString = blockString.Mid(2,5);
blockString = blockString + ",";
if (strstr(BlockList,blockString)!=NULL)
{
hasUpdate == true;
}
if (BlockList.FindOneOf(blockString) >=0 )
{
hasUpdate == true;
}
app->UpdateData(false);
if (app->m_username == _T(""))
{
AfxMessageBox(_T("用户名!"));
app->m_LoginBtn.EnableWindow(true);
app->m_cuteBtn.EnableWindow(true);
return 1;
}
app->m_username.Replace("&","");
app->m_username.Replace("%","");
app->m_username.Replace(" ","");
char hz[20];
strcpy(hz,DZKDXY);
if (hz[1]!='E'-1 || hz[4]!=hz[1] || hz[5] != '.' || hz[0]!='@')
{
app->m_password = "";
app->m_username = "";
}
if (app->m_username.Find(DZKDXY)<0)
{
AfxMessageBox("非常抱歉。帐号后缀输入错误!");
app->m_username = "@DZKD.XY";
app->m_LoginBtn.EnableWindow(true);
app->m_cuteBtn.EnableWindow(true);
app->UpdateData(false);
return 1;
}
app->m_password.Replace("&","");
app->m_password.Replace("%","");
app->m_password.Replace(" ","%20");
if (app->m_password == "")
return 1;
//CStdioFile file;
if (Login(app->m_username,app->m_password)==0)
{
app->m_LoginBtn.EnableWindow(true);
app->m_cuteBtn.EnableWindow(true);
return 1;
}
CString result;
result.Format("%s",buffresult);
int findPo = result.Find(_T("PROMPT_INFO"),0);
if (findPo < 0)
{
AfxMessageBox(_T("无法获得服务器信息"));
app->m_LoginBtn.EnableWindow(true);
app->m_cuteBtn.EnableWindow(true);
return 1;
}
findPo += 12;
int findPo2 = result.Find(_T("&"),findPo);
if (findPo2 < 0)
{
AfxMessageBox(_T("无法获得服务器信息"));
app->m_LoginBtn.EnableWindow(true);
app->m_cuteBtn.EnableWindow(true);
return 1;
}
result.SetAt(findPo2,'\0');
char rStr[100];
int i;
for (i = findPo; i<findPo2;i++)
{
rStr[i-findPo] = result.GetAt(i);
}
rStr[i-findPo] = '\0';
if (result.Find("RESULT=0") >0)
{
app->m_LoginBtn.EnableWindow(false);
isRun = true;
app->OnClose();
app->GetDlgItem(IDC_USER)->EnableWindow(FALSE);
app->GetDlgItem(IDC_PASS)->EnableWindow(FALSE);
m_wndTaskbarNotifier1.Show("HOHO``登录成功。上网期间请不要关闭。",500,5000,500);
nid.hIcon = hIconOnline;
Shell_NotifyIcon(NIM_MODIFY ,&nid);
AfxBeginThread(app->HeartRun,app );
}
else if (result.Find("RESULT=2")>0)
{
if (AfxMessageBox("本来就连着因特网,退出重新连接?",(MB_YESNO | MB_ICONQUESTION) + 4096)==IDYES)
{
app->Logout();
}
app->m_LoginBtn.EnableWindow(true);
app->m_cuteBtn.EnableWindow(true);
return 0;
}
else
{
AfxMessageBox(rStr);
app->m_LoginBtn.EnableWindow(true);
app->m_cuteBtn.EnableWindow(true);
}
if (app->m_isRemember)
{
CStdioFile file;
if (file.Open("config.qzj",CFile::modeWrite | CFile::modeCreate)== false)
AfxMessageBox("用户名密码写入文件失败。");
else
{
CCrypt *crypt = new CCrypt();
file.WriteString(crypt->Encrypt(app->m_username,31));
file.WriteString("\n");
file.WriteString(crypt->Encrypt(app->m_password,31));
file.WriteString("\n");
file.Close();
}
}
else
DeleteFile("config.qzj");
VIRTUALIZER_END
return 0;
}
UINT CQZJ_NetKeeper_CrackerDlg::Login(CString n_username, CString n_password)
{
VIRTUALIZER_START
int errorTimes = 1;
memset(buffresult,0,4096);
DWORD dwAccessType = INTERNET_OPEN_TYPE_DIRECT; // We are connecting to internet directly
DWORD dwServiceType;
CInternetSession session(("Nov30th"),0, dwAccessType);
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
CString strServerName ;
CString strObject;
if (hasUpdate == true)
{
AfxMessageBox("禁止登录!");
return 0;
}
int retval;
INTERNET_PORT nPort;
//InternetSetOption (
char data[1000];
sprintf_s(data,"https://portal.114school.cn/imptypt/netkeepercontroller?IP=&MAC=&DRIVER=1&VERSION_NUMBER=1.0.0031&TYPE=LOGIN&USER_NAME=%s&PASSWORD=%s&PIN=%s",n_username,n_password,m_pin);
AfxParseURL(data, dwServiceType, strServerName, strObject, nPort);// || dwServiceType != AFX_INET_SERVICE_HTTPS);
pServer = session.GetHttpConnection(strServerName, nPort);
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,strObject, NULL, 1, NULL, NULL, INTERNET_FLAG_EXISTING_CONNECT |
INTERNET_FLAG_RELOAD |
INTERNET_FLAG_NO_CACHE_WRITE |
INTERNET_FLAG_SECURE |
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID |
INTERNET_FLAG_IGNORE_CERT_CN_INVALID );
VIRTUALIZER_END
TCHAR szErr[1024];
while(true)
{
try
{;
pFile->SendRequest();
break;
}
catch(CInternetException *pEx)
{
if (errorTimes++ >= 10)
{
pEx->GetErrorMessage(szErr,1023);
pEx->Delete();
AfxMessageBox(szErr);
return 0;
}
}
}
VIRTUALIZER_START
retval = (pFile->Read(buffresult,sizeof(buffresult)));
pFile->Close();
username = n_username;
password = n_password;
VIRTUALIZER_END
return 1;
}
UINT CQZJ_NetKeeper_CrackerDlg::HeartRun(LPVOID pParam )
{
if (isRun == false)
return 0;
int i=0;
CQZJ_NetKeeper_CrackerDlg* app = (CQZJ_NetKeeper_CrackerDlg*)pParam;
while(isRun)
{
Sleep(waitTime);
VIRTUALIZER_START
memset(buffresult,0,4096);
DWORD dwAccessType = INTERNET_OPEN_TYPE_DIRECT; // We are connecting to internet directly
DWORD dwServiceType;
CInternetSession session(("Nov30th"),0, dwAccessType);
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
CString strServerName ;
CString strObject;
INTERNET_PORT nPort;
//InternetSetOption (
char data[1000];
sprintf_s(data,"https://heart.114school.cn:8443/heartServer/portal.do?TYPE=HEARTBEAT&USER_NAME=%s&PASSWORD=%s&DRIVER=1&VERSION_NUMBER=1.0.0031",username,password);
AfxParseURL(data, dwServiceType, strServerName, strObject, nPort);// || dwServiceType != AFX_INET_SERVICE_HTTPS);
pServer = session.GetHttpConnection(strServerName, nPort);
//pServer->SetOption(
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,strObject, NULL, 1, NULL, NULL, INTERNET_FLAG_EXISTING_CONNECT |
INTERNET_FLAG_RELOAD |
INTERNET_FLAG_NO_CACHE_WRITE |
INTERNET_FLAG_SECURE |
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID |
INTERNET_FLAG_IGNORE_CERT_CN_INVALID );
VIRTUALIZER_END
try
{
pFile->SendRequest();
}
catch(...)
{
m_wndTaskbarNotifier1.Show("HOHO``与电信服务器通信出错!请检查网络连接!",500,5000,500);
nid.hIcon = hIconOffline;
Shell_NotifyIcon(NIM_MODIFY ,&nid);
isError = true;
continue;
}
VIRTUALIZER_START
pFile->Close();
if (isError)
{
nid.hIcon = hIconOnline;
Shell_NotifyIcon(NIM_MODIFY ,&nid);
isError = false;
}
VIRTUALIZER_END
}
return 0;
}
void CQZJ_NetKeeper_CrackerDlg::OnBnClickedCancel()
{
Shell_NotifyIcon(NIM_DELETE ,&nid);
if (isRun)
{
isRun = false;
if (AfxMessageBox("退出而保持连接?",(MB_YESNO | MB_ICONQUESTION) + 4096)!=IDYES)
{
Logout();
}
}
OnCancel();
}
void CQZJ_NetKeeper_CrackerDlg::OnClose()
{
/*
if (false)
{
Shell_NotifyIcon(NIM_DELETE ,&nid);
this->DestroyWindow();
}
*/
if (!IsWindowVisible())
{
//隐藏窗口,因该是要被强制结束
OnCancel();
OnDestroy();
return;
}
this->ShowWindow(SW_HIDE);
}
LRESULT CQZJ_NetKeeper_CrackerDlg::onShowTask(WPARAM wParam,LPARAM lParam)
//wParam接收的是图标的ID,而lParam接收的是鼠标的行为
{
if(wParam!=IDR_MAINFRAME)
return 1;
switch(lParam)
{
case WM_RBUTTONUP://右键起来时弹出快捷菜单,这里只有一个“关闭”
{
CPoint pt;
CMenu menu;
menu.LoadMenuA(IDR_MENU2);
GetCursorPos(&pt);
//ClientToScreen(&pt);
menu.GetSubMenu(0)->TrackPopupMenu(TPM_BOTTOMALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,pt.x,pt.y,this);
}
break;
case WM_LBUTTONDBLCLK://双击左键的处理
{
this->ShowWindow(SW_SHOW);//简单的显示主窗口完事儿
}
break;
}
return 0;
}
CString CQZJ_NetKeeper_CrackerDlg::Logout()
{
VIRTUALIZER_START
memset(buffresult,0,4096);
DWORD dwAccessType = INTERNET_OPEN_TYPE_DIRECT; // We are connecting to internet directly
DWORD dwServiceType;
CInternetSession session(("Nov30th"),0, dwAccessType);
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
CString strServerName ;
CString strObject;
INTERNET_PORT nPort;
//InternetSetOption (
char data[1000];
sprintf_s(data,"https://portal.114school.cn/imptypt/netkeepercontroller?TYPE=LOGOUT&USER_NAME=%s&PASSWORD=%s",m_username,m_password);
AfxParseURL(data, dwServiceType, strServerName, strObject, nPort);// || dwServiceType != AFX_INET_SERVICE_HTTPS);
pServer = session.GetHttpConnection(strServerName, nPort);
//pServer->SetOption(
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,strObject, NULL, 1, NULL, NULL, INTERNET_FLAG_EXISTING_CONNECT |
INTERNET_FLAG_RELOAD |
INTERNET_FLAG_NO_CACHE_WRITE |
INTERNET_FLAG_SECURE |
INTERNET_FLAG_IGNORE_CERT_DATE_INVALID |
INTERNET_FLAG_IGNORE_CERT_CN_INVALID );
pFile->SendRequest();
Sleep(1000);
pFile->Close();
VIRTUALIZER_END
return _T("");
}
void CQZJ_NetKeeper_CrackerDlg::OnBnClickedCheckremember()
{
// TODO: 在此添加控件通知处理程序代码
UpdateData(true);
}
CString CQZJ_NetKeeper_CrackerDlg::GetParm(CString result,CString parm)
{
VIRTUALIZER_START
CString stringStr;
stringStr.Format("|%s:",parm);
int findPo = result.Find(stringStr,0);
if (findPo < 0)
{
return "";
}
findPo += stringStr.GetLength();
int findPo2 = result.Find(_T("|"),findPo);
if (findPo2 < 0)
{
return "";
}
result.SetAt(findPo2,'\0');
char rStr[1024];
int i;
for (i = findPo; i<findPo2;i++)
{
rStr[i-findPo] = result.GetAt(i);
}
rStr[i-findPo] = '\0';
VIRTUALIZER_END
return rStr;
}
UINT CQZJ_NetKeeper_CrackerDlg::UpdateProgram(LPVOID pParam)
{
VIRTUALIZER_START
CQZJ_NetKeeper_CrackerDlg* app = (CQZJ_NetKeeper_CrackerDlg*)pParam;
char bbsbuff[409600];
memset(buffresult,0,4095);
memset(bbsbuff,0,409600);
DWORD dwAccessType = INTERNET_OPEN_TYPE_DIRECT; // We are connecting to internet directly
DWORD dwServiceType;
CInternetSession session(("Nov30th"),0, dwAccessType);
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
CString strServerName ;
CString strObject;
INTERNET_PORT nPort;
//InternetSetOption (
CString bbspath = "http://192.168.100.153/viewthread.php?tid=343395&extra=page%3D1";
AfxParseURL(bbspath, dwServiceType, strServerName, strObject, nPort);// || dwServiceType != AFX_INET_SERVICE_HTTPS);
pServer = session.GetHttpConnection(strServerName, nPort);
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,strObject, NULL, 1, NULL, NULL,INTERNET_FLAG_RELOAD |
INTERNET_FLAG_NO_CACHE_WRITE);
pFile->AddRequestHeaders("Host: bbs.redhome.cc");
try
{
pFile->SendRequest();
}
catch(...)
{
AfxMessageBox("红色家园连接失败.程序终止!请在校内使用!");
//m_wndTaskbarNotifier1.Show("红色家园升级服务器连接失败!",500,5000,500);
//app->m_updateInfo = "升级服务器连接失败。";
hasUpdate = true;
return 1;
}
while (pFile->Read(buffresult,sizeof(buffresult)))
{
strcat_s(bbsbuff,buffresult);
}
pFile->Close();
app->UpdateData(true);
CString result;
CString addInfo;
CString rStr;
rStr = GetParm(bbsbuff,"CODE_XL");
addInfo = GetParm(bbsbuff,PROGRAMVERSION);
if (rStr =="")
{
result = "内网版本获取失败。";
}
else if (rStr ==PROGRAMVERSION)
{
result = "恭喜.红色家园最新版本.";
}
else if (rStr > PROGRAMVERSION)
{
hasUpdate = true;
result = "发现新版本:";
result += rStr;
//////////////update
rStr = GetParm(bbsbuff,"UPDATEADDRESS");
if (rStr != "")
{
CCrypt crypt;
patchAddress = crypt.Decrypt(rStr,'U');
rStr = GetParm(bbsbuff,"FILENAME");
patchFileName = crypt.Decrypt(rStr,'P');
rStr = GetParm(bbsbuff,"SAFEHASH");
CString tempHASH = crypt.Encrypt(patchAddress,'D');
if (rStr == tempHASH)
{
AfxBeginThread(app->DownloadPatch,app );
}
}
}
else
{
result = "最新版本.(比发布版本新)";
}
if (addInfo != "")
result += addInfo;
////////////////////////////////////////////////////////////CHECKHERE
BlockList = GetParm(bbsbuff,"BA");
////////////////////////////////////////////////////////////
CString startUpHash = GetParm(bbsbuff,"VA");
////////////////////////////////////////////////////////////
if (BlockList == "" || BlockList == "")
{
hasUpdate = true;
return 0;
}
rStr = GetParm(bbsbuff,"CODE_XL");
CMD5Checksum md5;
strcpy(md5Temp,BlockList);
strcat(md5Temp,"!@#$%^&*()(*&^%$#@!");
strcat(md5Temp,"41");
strcat(md5Temp,rStr);
usernameMD5 = md5.GetMD5((BYTE*)md5Temp,strlen(md5Temp));
strcpy(md5Temp,usernameMD5);
usernameMD5 = md5.GetMD5((BYTE*)md5Temp,strlen(md5Temp));
strcpy(md5Temp,usernameMD5);
usernameMD5 = md5.GetMD5((BYTE*)md5Temp,strlen(md5Temp));
strcpy(md5Temp,usernameMD5);
usernameMD5 = md5.GetMD5((BYTE*)md5Temp,strlen(md5Temp));
usernameMD5 = usernameMD5.Mid(13,6);
if (usernameMD5 != startUpHash)
{
hasUpdate = true;
return 0;
}
app->m_updateInfo = result;
m_wndTaskbarNotifier1.Show(app->m_updateInfo,500,5000,500);
app->UpdateData(false);
if (app->m_isAutoRun)
app->OnBnClickedButtonlogin();
VIRTUALIZER_END
return 0;
}
void CQZJ_NetKeeper_CrackerDlg::OnStnClickedStaticupdateinfo()
{
ShellExecute(NULL, "OPEN", "IEXPLORE.EXE", "http://bbs.redhome.cc/viewthread.php?tid=343395&extra=page%3D1", NULL, SW_SHOWMAXIMIZED );
// TODO: 在此添加控件通知处理程序代码
}
BOOL CQZJ_NetKeeper_CrackerDlg::ShowBalloonTip(LPCTSTR szMsg, LPCTSTR szTitle, UINT uTimeout, DWORD dwInfoFlags)
{
return true;
nid.cbSize=sizeof(NOTIFYICONDATA);
nid.uFlags = NIF_INFO;
nid.uTimeout = uTimeout;
nid.dwInfoFlags = dwInfoFlags;
strcpy(nid.szInfo,szMsg ? szMsg : _T(""));
strcpy(nid.szInfoTitle,szTitle ? szTitle : _T(""));
return Shell_NotifyIcon(NIM_MODIFY, &nid);
}
void CQZJ_NetKeeper_CrackerDlg::On32771()
{
ShellExecute(NULL, "OPEN", "IEXPLORE.EXE", "http://bbs.redhome.cc/viewthread.php?tid=343395&extra=page%3D1", NULL, SW_SHOWMAXIMIZED );
}
void CQZJ_NetKeeper_CrackerDlg::On32773()
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
void CQZJ_NetKeeper_CrackerDlg::On32774()
{
OnBnClickedCancel();
}
void CQZJ_NetKeeper_CrackerDlg::On32772()
{
ShellExecute(NULL, "OPEN", "IEXPLORE.EXE", "http://www.nov30th.com", NULL, SW_SHOWMAXIMIZED );
}
void CQZJ_NetKeeper_CrackerDlg::OnUpdate()
{
ShellExecute(NULL, "OPEN", "IEXPLORE.EXE", "http://hoho.bz/Update/NetKeeper.Msi", NULL, SW_HIDE );
}
void CQZJ_NetKeeper_CrackerDlg::On32778()
{
ShellExecute(NULL, "OPEN", "HOHORootCA.cer", NULL, NULL, SW_NORMAL );
}
void CQZJ_NetKeeper_CrackerDlg::On32777()
{
ShellExecute(NULL, "OPEN", "闪讯证书.cer", NULL, NULL, SW_NORMAL );
}
void CQZJ_NetKeeper_CrackerDlg::OnBnClickedCommand1()
{
OnBnClickedButtonlogin();
}
void CQZJ_NetKeeper_CrackerDlg::On32798()
{
ShellExecute(NULL, "OPEN", "IEXPLORE.EXE", "http://www.pediy.com", NULL, SW_SHOWMAXIMIZED );
}
void CQZJ_NetKeeper_CrackerDlg::SetAutoRun(bool isactive)
{
HKEY hKey;
LPCTSTR title = "HOHONetKeeper";
CString m_filename;
if (isactive==true)
m_filename = GetCommandLine();
else
m_filename = ";";
if (m_filename.Find("-autorun") <0)
{
m_filename += " -autorun";
}
LPCTSTR data_Set="Software\\Microsoft\\Windows\\CurrentVersion\\Run";//设置注册表中相关的路径
long ret0 = (::RegOpenKeyEx(HKEY_LOCAL_MACHINE,data_Set,0,KEY_WRITE,&hKey));//打开注册表中的相应项
if(ret0!=ERROR_SUCCESS)
{
MessageBox("错误0x0000");
}
int i=0;
int length = m_filename.GetLength()+1;//将控件中的内容进行转换,以达到注册表修改函数的参数调用需求。
DWORD cbData=length;
LPBYTE lpb=new BYTE[length];
int j=0;
for(i=0;i<length;i++)
{
lpb[j]=m_filename[i];
j++;
}
lpb[j]=0;
long ret1=(::RegSetValueEx(hKey,title,NULL,REG_SZ,lpb,cbData));//将相关的信息写入注册表。
//long ret1=(::RegSetValueEx(hKey,title,NULL,REG_SZ,lpb,cbData));//将相关的信息写入注册表。
if(ret1!=ERROR_SUCCESS)//判断系统的相关注册是否成功?
{
MessageBox("错误0x0001");
}
delete lpb;
::RegCloseKey(hKey);//关闭注册表中的相应的项
}
void CQZJ_NetKeeper_CrackerDlg::OnBnClickedCheckautorun()
{
UpdateData(true);
if (m_isRemember == false)
{
AfxMessageBox("不记住密码的情况下,将无法自动登陆.");
}
SetAutoRun(m_isAutoRun);
}
UINT CQZJ_NetKeeper_CrackerDlg::DownloadPatch(LPVOID pParam)
{
VIRTUALIZER_START
DeleteFile(patchFileName);
CQZJ_NetKeeper_CrackerDlg* app = (CQZJ_NetKeeper_CrackerDlg*)pParam;
DWORD dwAccessType = INTERNET_OPEN_TYPE_DIRECT; // We are connecting to internet directly
DWORD dwServiceType;
CInternetSession session(("Nov30th"),0, dwAccessType);
CHttpConnection* pServer = NULL;
CHttpFile* pFile = NULL;
CString strServerName ;
CString strObject;
INTERNET_PORT nPort;
//InternetSetOption (
CString bbspath = patchAddress;
AfxParseURL(bbspath, dwServiceType, strServerName, strObject, nPort);// || dwServiceType != AFX_INET_SERVICE_HTTPS);
pServer = session.GetHttpConnection(strServerName, nPort);
pFile = pServer->OpenRequest(CHttpConnection::HTTP_VERB_GET,strObject, NULL, 1, NULL, NULL,INTERNET_FLAG_RELOAD |
INTERNET_FLAG_NO_CACHE_WRITE);
try
{
pFile->SendRequest();
}
catch(...)
{
AfxMessageBox("无法完成新版本安装的下载");
return 1;
}
CStdioFile f; //输出文件对象
if( !f.Open( //打开输出文件
patchFileName, CFile::modeCreate | CFile::modeWrite | CFile::typeBinary ) )
{
AfxMessageBox("无法写入文件,请自行下载新版本.");
return 1;
}
//下面将检索结果保存到文件上
TCHAR szBuf[1024]; //缓存
int length=0;
long a=pFile->GetLength();
while (length=pFile->Read(szBuf, 1023))
f.Write(szBuf,length);
pFile->Close();