├── .gitattributes
├── .gitignore
├── LICENSE
├── Login.sln
├── Login
├── IconJlu.ico
├── IconJluSm.ico
├── LogUtil.cpp
├── LogUtil.h
├── Login.rc
├── Login.vcxproj
├── Login.vcxproj.filters
├── WinMain.cpp
├── dogcom
│ ├── auth.cpp
│ ├── auth.h
│ ├── configparse.cpp
│ ├── configparse.h
│ ├── keepalive.cpp
│ ├── keepalive.h
│ ├── login.cpp
│ ├── login.h
│ ├── md4.cpp
│ ├── md4.h
│ ├── md5.cpp
│ ├── md5.h
│ ├── sha1.cpp
│ └── sha1.h
└── resource.h
└── README.md
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | bld/
21 | [Bb]in/
22 | [Oo]bj/
23 | [Ll]og/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 | # Uncomment if you have tasks that create the project's static files in wwwroot
28 | #wwwroot/
29 |
30 | # MSTest test Results
31 | [Tt]est[Rr]esult*/
32 | [Bb]uild[Ll]og.*
33 |
34 | # NUNIT
35 | *.VisualState.xml
36 | TestResult.xml
37 |
38 | # Build Results of an ATL Project
39 | [Dd]ebugPS/
40 | [Rr]eleasePS/
41 | dlldata.c
42 |
43 | # DNX
44 | project.lock.json
45 | project.fragment.lock.json
46 | artifacts/
47 |
48 | *_i.c
49 | *_p.c
50 | *_i.h
51 | *.ilk
52 | *.meta
53 | *.obj
54 | *.pch
55 | *.pdb
56 | *.pgc
57 | *.pgd
58 | *.rsp
59 | *.sbr
60 | *.tlb
61 | *.tli
62 | *.tlh
63 | *.tmp
64 | *.tmp_proj
65 | *.log
66 | *.vspscc
67 | *.vssscc
68 | .builds
69 | *.pidb
70 | *.svclog
71 | *.scc
72 |
73 | # Chutzpah Test files
74 | _Chutzpah*
75 |
76 | # Visual C++ cache files
77 | ipch/
78 | *.aps
79 | *.ncb
80 | *.opendb
81 | *.opensdf
82 | *.sdf
83 | *.cachefile
84 | *.VC.db
85 | *.VC.VC.opendb
86 |
87 | # Visual Studio profiler
88 | *.psess
89 | *.vsp
90 | *.vspx
91 | *.sap
92 |
93 | # TFS 2012 Local Workspace
94 | $tf/
95 |
96 | # Guidance Automation Toolkit
97 | *.gpState
98 |
99 | # ReSharper is a .NET coding add-in
100 | _ReSharper*/
101 | *.[Rr]e[Ss]harper
102 | *.DotSettings.user
103 |
104 | # JustCode is a .NET coding add-in
105 | .JustCode
106 |
107 | # TeamCity is a build add-in
108 | _TeamCity*
109 |
110 | # DotCover is a Code Coverage Tool
111 | *.dotCover
112 |
113 | # NCrunch
114 | _NCrunch_*
115 | .*crunch*.local.xml
116 | nCrunchTemp_*
117 |
118 | # MightyMoose
119 | *.mm.*
120 | AutoTest.Net/
121 |
122 | # Web workbench (sass)
123 | .sass-cache/
124 |
125 | # Installshield output folder
126 | [Ee]xpress/
127 |
128 | # DocProject is a documentation generator add-in
129 | DocProject/buildhelp/
130 | DocProject/Help/*.HxT
131 | DocProject/Help/*.HxC
132 | DocProject/Help/*.hhc
133 | DocProject/Help/*.hhk
134 | DocProject/Help/*.hhp
135 | DocProject/Help/Html2
136 | DocProject/Help/html
137 |
138 | # Click-Once directory
139 | publish/
140 |
141 | # Publish Web Output
142 | *.[Pp]ublish.xml
143 | *.azurePubxml
144 | # TODO: Comment the next line if you want to checkin your web deploy settings
145 | # but database connection strings (with potential passwords) will be unencrypted
146 | #*.pubxml
147 | *.publishproj
148 |
149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
150 | # checkin your Azure Web App publish settings, but sensitive information contained
151 | # in these scripts will be unencrypted
152 | PublishScripts/
153 |
154 | # NuGet Packages
155 | *.nupkg
156 | # The packages folder can be ignored because of Package Restore
157 | **/packages/*
158 | # except build/, which is used as an MSBuild target.
159 | !**/packages/build/
160 | # Uncomment if necessary however generally it will be regenerated when needed
161 | #!**/packages/repositories.config
162 | # NuGet v3's project.json files produces more ignoreable files
163 | *.nuget.props
164 | *.nuget.targets
165 |
166 | # Microsoft Azure Build Output
167 | csx/
168 | *.build.csdef
169 |
170 | # Microsoft Azure Emulator
171 | ecf/
172 | rcf/
173 |
174 | # Windows Store app package directories and files
175 | AppPackages/
176 | BundleArtifacts/
177 | Package.StoreAssociation.xml
178 | _pkginfo.txt
179 |
180 | # Visual Studio cache files
181 | # files ending in .cache can be ignored
182 | *.[Cc]ache
183 | # but keep track of directories ending in .cache
184 | !*.[Cc]ache/
185 |
186 | # Others
187 | ClientBin/
188 | ~$*
189 | *~
190 | *.dbmdl
191 | *.dbproj.schemaview
192 | *.jfm
193 | *.pfx
194 | *.publishsettings
195 | node_modules/
196 | orleans.codegen.cs
197 |
198 | # Since there are multiple workflows, uncomment next line to ignore bower_components
199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
200 | #bower_components/
201 |
202 | # RIA/Silverlight projects
203 | Generated_Code/
204 |
205 | # Backup & report files from converting an old project file
206 | # to a newer Visual Studio version. Backup files are not needed,
207 | # because we have git ;-)
208 | _UpgradeReport_Files/
209 | Backup*/
210 | UpgradeLog*.XML
211 | UpgradeLog*.htm
212 |
213 | # SQL Server files
214 | *.mdf
215 | *.ldf
216 |
217 | # Business Intelligence projects
218 | *.rdl.data
219 | *.bim.layout
220 | *.bim_*.settings
221 |
222 | # Microsoft Fakes
223 | FakesAssemblies/
224 |
225 | # GhostDoc plugin setting file
226 | *.GhostDoc.xml
227 |
228 | # Node.js Tools for Visual Studio
229 | .ntvs_analysis.dat
230 |
231 | # Visual Studio 6 build log
232 | *.plg
233 |
234 | # Visual Studio 6 workspace options file
235 | *.opt
236 |
237 | # Visual Studio LightSwitch build output
238 | **/*.HTMLClient/GeneratedArtifacts
239 | **/*.DesktopClient/GeneratedArtifacts
240 | **/*.DesktopClient/ModelManifest.xml
241 | **/*.Server/GeneratedArtifacts
242 | **/*.Server/ModelManifest.xml
243 | _Pvt_Extensions
244 |
245 | # Paket dependency manager
246 | .paket/paket.exe
247 | paket-files/
248 |
249 | # FAKE - F# Make
250 | .fake/
251 |
252 | # JetBrains Rider
253 | .idea/
254 | *.sln.iml
255 |
256 | # CodeRush
257 | .cr/
258 |
259 | # Python Tools for Visual Studio (PTVS)
260 | __pycache__/
261 | *.pyc
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU AFFERO GENERAL PUBLIC LICENSE
2 | Version 3, 19 November 2007
3 |
4 | Copyright (C) 2007 Free Software Foundation, Inc.
5 | Everyone is permitted to copy and distribute verbatim copies
6 | of this license document, but changing it is not allowed.
7 |
8 | Preamble
9 |
10 | The GNU Affero General Public License is a free, copyleft license for
11 | software and other kinds of works, specifically designed to ensure
12 | cooperation with the community in the case of network server software.
13 |
14 | The licenses for most software and other practical works are designed
15 | to take away your freedom to share and change the works. By contrast,
16 | our General Public Licenses are intended to guarantee your freedom to
17 | share and change all versions of a program--to make sure it remains free
18 | software for all its users.
19 |
20 | When we speak of free software, we are referring to freedom, not
21 | price. Our General Public Licenses are designed to make sure that you
22 | have the freedom to distribute copies of free software (and charge for
23 | them if you wish), that you receive source code or can get it if you
24 | want it, that you can change the software or use pieces of it in new
25 | free programs, and that you know you can do these things.
26 |
27 | Developers that use our General Public Licenses protect your rights
28 | with two steps: (1) assert copyright on the software, and (2) offer
29 | you this License which gives you legal permission to copy, distribute
30 | and/or modify the software.
31 |
32 | A secondary benefit of defending all users' freedom is that
33 | improvements made in alternate versions of the program, if they
34 | receive widespread use, become available for other developers to
35 | incorporate. Many developers of free software are heartened and
36 | encouraged by the resulting cooperation. However, in the case of
37 | software used on network servers, this result may fail to come about.
38 | The GNU General Public License permits making a modified version and
39 | letting the public access it on a server without ever releasing its
40 | source code to the public.
41 |
42 | The GNU Affero General Public License is designed specifically to
43 | ensure that, in such cases, the modified source code becomes available
44 | to the community. It requires the operator of a network server to
45 | provide the source code of the modified version running there to the
46 | users of that server. Therefore, public use of a modified version, on
47 | a publicly accessible server, gives the public access to the source
48 | code of the modified version.
49 |
50 | An older license, called the Affero General Public License and
51 | published by Affero, was designed to accomplish similar goals. This is
52 | a different license, not a version of the Affero GPL, but Affero has
53 | released a new version of the Affero GPL which permits relicensing under
54 | this license.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | TERMS AND CONDITIONS
60 |
61 | 0. Definitions.
62 |
63 | "This License" refers to version 3 of the GNU Affero General Public License.
64 |
65 | "Copyright" also means copyright-like laws that apply to other kinds of
66 | works, such as semiconductor masks.
67 |
68 | "The Program" refers to any copyrightable work licensed under this
69 | License. Each licensee is addressed as "you". "Licensees" and
70 | "recipients" may be individuals or organizations.
71 |
72 | To "modify" a work means to copy from or adapt all or part of the work
73 | in a fashion requiring copyright permission, other than the making of an
74 | exact copy. The resulting work is called a "modified version" of the
75 | earlier work or a work "based on" the earlier work.
76 |
77 | A "covered work" means either the unmodified Program or a work based
78 | on the Program.
79 |
80 | To "propagate" a work means to do anything with it that, without
81 | permission, would make you directly or secondarily liable for
82 | infringement under applicable copyright law, except executing it on a
83 | computer or modifying a private copy. Propagation includes copying,
84 | distribution (with or without modification), making available to the
85 | public, and in some countries other activities as well.
86 |
87 | To "convey" a work means any kind of propagation that enables other
88 | parties to make or receive copies. Mere interaction with a user through
89 | a computer network, with no transfer of a copy, is not conveying.
90 |
91 | An interactive user interface displays "Appropriate Legal Notices"
92 | to the extent that it includes a convenient and prominently visible
93 | feature that (1) displays an appropriate copyright notice, and (2)
94 | tells the user that there is no warranty for the work (except to the
95 | extent that warranties are provided), that licensees may convey the
96 | work under this License, and how to view a copy of this License. If
97 | the interface presents a list of user commands or options, such as a
98 | menu, a prominent item in the list meets this criterion.
99 |
100 | 1. Source Code.
101 |
102 | The "source code" for a work means the preferred form of the work
103 | for making modifications to it. "Object code" means any non-source
104 | form of a work.
105 |
106 | A "Standard Interface" means an interface that either is an official
107 | standard defined by a recognized standards body, or, in the case of
108 | interfaces specified for a particular programming language, one that
109 | is widely used among developers working in that language.
110 |
111 | The "System Libraries" of an executable work include anything, other
112 | than the work as a whole, that (a) is included in the normal form of
113 | packaging a Major Component, but which is not part of that Major
114 | Component, and (b) serves only to enable use of the work with that
115 | Major Component, or to implement a Standard Interface for which an
116 | implementation is available to the public in source code form. A
117 | "Major Component", in this context, means a major essential component
118 | (kernel, window system, and so on) of the specific operating system
119 | (if any) on which the executable work runs, or a compiler used to
120 | produce the work, or an object code interpreter used to run it.
121 |
122 | The "Corresponding Source" for a work in object code form means all
123 | the source code needed to generate, install, and (for an executable
124 | work) run the object code and to modify the work, including scripts to
125 | control those activities. However, it does not include the work's
126 | System Libraries, or general-purpose tools or generally available free
127 | programs which are used unmodified in performing those activities but
128 | which are not part of the work. For example, Corresponding Source
129 | includes interface definition files associated with source files for
130 | the work, and the source code for shared libraries and dynamically
131 | linked subprograms that the work is specifically designed to require,
132 | such as by intimate data communication or control flow between those
133 | subprograms and other parts of the work.
134 |
135 | The Corresponding Source need not include anything that users
136 | can regenerate automatically from other parts of the Corresponding
137 | Source.
138 |
139 | The Corresponding Source for a work in source code form is that
140 | same work.
141 |
142 | 2. Basic Permissions.
143 |
144 | All rights granted under this License are granted for the term of
145 | copyright on the Program, and are irrevocable provided the stated
146 | conditions are met. This License explicitly affirms your unlimited
147 | permission to run the unmodified Program. The output from running a
148 | covered work is covered by this License only if the output, given its
149 | content, constitutes a covered work. This License acknowledges your
150 | rights of fair use or other equivalent, as provided by copyright law.
151 |
152 | You may make, run and propagate covered works that you do not
153 | convey, without conditions so long as your license otherwise remains
154 | in force. You may convey covered works to others for the sole purpose
155 | of having them make modifications exclusively for you, or provide you
156 | with facilities for running those works, provided that you comply with
157 | the terms of this License in conveying all material for which you do
158 | not control copyright. Those thus making or running the covered works
159 | for you must do so exclusively on your behalf, under your direction
160 | and control, on terms that prohibit them from making any copies of
161 | your copyrighted material outside their relationship with you.
162 |
163 | Conveying under any other circumstances is permitted solely under
164 | the conditions stated below. Sublicensing is not allowed; section 10
165 | makes it unnecessary.
166 |
167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
168 |
169 | No covered work shall be deemed part of an effective technological
170 | measure under any applicable law fulfilling obligations under article
171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
172 | similar laws prohibiting or restricting circumvention of such
173 | measures.
174 |
175 | When you convey a covered work, you waive any legal power to forbid
176 | circumvention of technological measures to the extent such circumvention
177 | is effected by exercising rights under this License with respect to
178 | the covered work, and you disclaim any intention to limit operation or
179 | modification of the work as a means of enforcing, against the work's
180 | users, your or third parties' legal rights to forbid circumvention of
181 | technological measures.
182 |
183 | 4. Conveying Verbatim Copies.
184 |
185 | You may convey verbatim copies of the Program's source code as you
186 | receive it, in any medium, provided that you conspicuously and
187 | appropriately publish on each copy an appropriate copyright notice;
188 | keep intact all notices stating that this License and any
189 | non-permissive terms added in accord with section 7 apply to the code;
190 | keep intact all notices of the absence of any warranty; and give all
191 | recipients a copy of this License along with the Program.
192 |
193 | You may charge any price or no price for each copy that you convey,
194 | and you may offer support or warranty protection for a fee.
195 |
196 | 5. Conveying Modified Source Versions.
197 |
198 | You may convey a work based on the Program, or the modifications to
199 | produce it from the Program, in the form of source code under the
200 | terms of section 4, provided that you also meet all of these conditions:
201 |
202 | a) The work must carry prominent notices stating that you modified
203 | it, and giving a relevant date.
204 |
205 | b) The work must carry prominent notices stating that it is
206 | released under this License and any conditions added under section
207 | 7. This requirement modifies the requirement in section 4 to
208 | "keep intact all notices".
209 |
210 | c) You must license the entire work, as a whole, under this
211 | License to anyone who comes into possession of a copy. This
212 | License will therefore apply, along with any applicable section 7
213 | additional terms, to the whole of the work, and all its parts,
214 | regardless of how they are packaged. This License gives no
215 | permission to license the work in any other way, but it does not
216 | invalidate such permission if you have separately received it.
217 |
218 | d) If the work has interactive user interfaces, each must display
219 | Appropriate Legal Notices; however, if the Program has interactive
220 | interfaces that do not display Appropriate Legal Notices, your
221 | work need not make them do so.
222 |
223 | A compilation of a covered work with other separate and independent
224 | works, which are not by their nature extensions of the covered work,
225 | and which are not combined with it such as to form a larger program,
226 | in or on a volume of a storage or distribution medium, is called an
227 | "aggregate" if the compilation and its resulting copyright are not
228 | used to limit the access or legal rights of the compilation's users
229 | beyond what the individual works permit. Inclusion of a covered work
230 | in an aggregate does not cause this License to apply to the other
231 | parts of the aggregate.
232 |
233 | 6. Conveying Non-Source Forms.
234 |
235 | You may convey a covered work in object code form under the terms
236 | of sections 4 and 5, provided that you also convey the
237 | machine-readable Corresponding Source under the terms of this License,
238 | in one of these ways:
239 |
240 | a) Convey the object code in, or embodied in, a physical product
241 | (including a physical distribution medium), accompanied by the
242 | Corresponding Source fixed on a durable physical medium
243 | customarily used for software interchange.
244 |
245 | b) Convey the object code in, or embodied in, a physical product
246 | (including a physical distribution medium), accompanied by a
247 | written offer, valid for at least three years and valid for as
248 | long as you offer spare parts or customer support for that product
249 | model, to give anyone who possesses the object code either (1) a
250 | copy of the Corresponding Source for all the software in the
251 | product that is covered by this License, on a durable physical
252 | medium customarily used for software interchange, for a price no
253 | more than your reasonable cost of physically performing this
254 | conveying of source, or (2) access to copy the
255 | Corresponding Source from a network server at no charge.
256 |
257 | c) Convey individual copies of the object code with a copy of the
258 | written offer to provide the Corresponding Source. This
259 | alternative is allowed only occasionally and noncommercially, and
260 | only if you received the object code with such an offer, in accord
261 | with subsection 6b.
262 |
263 | d) Convey the object code by offering access from a designated
264 | place (gratis or for a charge), and offer equivalent access to the
265 | Corresponding Source in the same way through the same place at no
266 | further charge. You need not require recipients to copy the
267 | Corresponding Source along with the object code. If the place to
268 | copy the object code is a network server, the Corresponding Source
269 | may be on a different server (operated by you or a third party)
270 | that supports equivalent copying facilities, provided you maintain
271 | clear directions next to the object code saying where to find the
272 | Corresponding Source. Regardless of what server hosts the
273 | Corresponding Source, you remain obligated to ensure that it is
274 | available for as long as needed to satisfy these requirements.
275 |
276 | e) Convey the object code using peer-to-peer transmission, provided
277 | you inform other peers where the object code and Corresponding
278 | Source of the work are being offered to the general public at no
279 | charge under subsection 6d.
280 |
281 | A separable portion of the object code, whose source code is excluded
282 | from the Corresponding Source as a System Library, need not be
283 | included in conveying the object code work.
284 |
285 | A "User Product" is either (1) a "consumer product", which means any
286 | tangible personal property which is normally used for personal, family,
287 | or household purposes, or (2) anything designed or sold for incorporation
288 | into a dwelling. In determining whether a product is a consumer product,
289 | doubtful cases shall be resolved in favor of coverage. For a particular
290 | product received by a particular user, "normally used" refers to a
291 | typical or common use of that class of product, regardless of the status
292 | of the particular user or of the way in which the particular user
293 | actually uses, or expects or is expected to use, the product. A product
294 | is a consumer product regardless of whether the product has substantial
295 | commercial, industrial or non-consumer uses, unless such uses represent
296 | the only significant mode of use of the product.
297 |
298 | "Installation Information" for a User Product means any methods,
299 | procedures, authorization keys, or other information required to install
300 | and execute modified versions of a covered work in that User Product from
301 | a modified version of its Corresponding Source. The information must
302 | suffice to ensure that the continued functioning of the modified object
303 | code is in no case prevented or interfered with solely because
304 | modification has been made.
305 |
306 | If you convey an object code work under this section in, or with, or
307 | specifically for use in, a User Product, and the conveying occurs as
308 | part of a transaction in which the right of possession and use of the
309 | User Product is transferred to the recipient in perpetuity or for a
310 | fixed term (regardless of how the transaction is characterized), the
311 | Corresponding Source conveyed under this section must be accompanied
312 | by the Installation Information. But this requirement does not apply
313 | if neither you nor any third party retains the ability to install
314 | modified object code on the User Product (for example, the work has
315 | been installed in ROM).
316 |
317 | The requirement to provide Installation Information does not include a
318 | requirement to continue to provide support service, warranty, or updates
319 | for a work that has been modified or installed by the recipient, or for
320 | the User Product in which it has been modified or installed. Access to a
321 | network may be denied when the modification itself materially and
322 | adversely affects the operation of the network or violates the rules and
323 | protocols for communication across the network.
324 |
325 | Corresponding Source conveyed, and Installation Information provided,
326 | in accord with this section must be in a format that is publicly
327 | documented (and with an implementation available to the public in
328 | source code form), and must require no special password or key for
329 | unpacking, reading or copying.
330 |
331 | 7. Additional Terms.
332 |
333 | "Additional permissions" are terms that supplement the terms of this
334 | License by making exceptions from one or more of its conditions.
335 | Additional permissions that are applicable to the entire Program shall
336 | be treated as though they were included in this License, to the extent
337 | that they are valid under applicable law. If additional permissions
338 | apply only to part of the Program, that part may be used separately
339 | under those permissions, but the entire Program remains governed by
340 | this License without regard to the additional permissions.
341 |
342 | When you convey a copy of a covered work, you may at your option
343 | remove any additional permissions from that copy, or from any part of
344 | it. (Additional permissions may be written to require their own
345 | removal in certain cases when you modify the work.) You may place
346 | additional permissions on material, added by you to a covered work,
347 | for which you have or can give appropriate copyright permission.
348 |
349 | Notwithstanding any other provision of this License, for material you
350 | add to a covered work, you may (if authorized by the copyright holders of
351 | that material) supplement the terms of this License with terms:
352 |
353 | a) Disclaiming warranty or limiting liability differently from the
354 | terms of sections 15 and 16 of this License; or
355 |
356 | b) Requiring preservation of specified reasonable legal notices or
357 | author attributions in that material or in the Appropriate Legal
358 | Notices displayed by works containing it; or
359 |
360 | c) Prohibiting misrepresentation of the origin of that material, or
361 | requiring that modified versions of such material be marked in
362 | reasonable ways as different from the original version; or
363 |
364 | d) Limiting the use for publicity purposes of names of licensors or
365 | authors of the material; or
366 |
367 | e) Declining to grant rights under trademark law for use of some
368 | trade names, trademarks, or service marks; or
369 |
370 | f) Requiring indemnification of licensors and authors of that
371 | material by anyone who conveys the material (or modified versions of
372 | it) with contractual assumptions of liability to the recipient, for
373 | any liability that these contractual assumptions directly impose on
374 | those licensors and authors.
375 |
376 | All other non-permissive additional terms are considered "further
377 | restrictions" within the meaning of section 10. If the Program as you
378 | received it, or any part of it, contains a notice stating that it is
379 | governed by this License along with a term that is a further
380 | restriction, you may remove that term. If a license document contains
381 | a further restriction but permits relicensing or conveying under this
382 | License, you may add to a covered work material governed by the terms
383 | of that license document, provided that the further restriction does
384 | not survive such relicensing or conveying.
385 |
386 | If you add terms to a covered work in accord with this section, you
387 | must place, in the relevant source files, a statement of the
388 | additional terms that apply to those files, or a notice indicating
389 | where to find the applicable terms.
390 |
391 | Additional terms, permissive or non-permissive, may be stated in the
392 | form of a separately written license, or stated as exceptions;
393 | the above requirements apply either way.
394 |
395 | 8. Termination.
396 |
397 | You may not propagate or modify a covered work except as expressly
398 | provided under this License. Any attempt otherwise to propagate or
399 | modify it is void, and will automatically terminate your rights under
400 | this License (including any patent licenses granted under the third
401 | paragraph of section 11).
402 |
403 | However, if you cease all violation of this License, then your
404 | license from a particular copyright holder is reinstated (a)
405 | provisionally, unless and until the copyright holder explicitly and
406 | finally terminates your license, and (b) permanently, if the copyright
407 | holder fails to notify you of the violation by some reasonable means
408 | prior to 60 days after the cessation.
409 |
410 | Moreover, your license from a particular copyright holder is
411 | reinstated permanently if the copyright holder notifies you of the
412 | violation by some reasonable means, this is the first time you have
413 | received notice of violation of this License (for any work) from that
414 | copyright holder, and you cure the violation prior to 30 days after
415 | your receipt of the notice.
416 |
417 | Termination of your rights under this section does not terminate the
418 | licenses of parties who have received copies or rights from you under
419 | this License. If your rights have been terminated and not permanently
420 | reinstated, you do not qualify to receive new licenses for the same
421 | material under section 10.
422 |
423 | 9. Acceptance Not Required for Having Copies.
424 |
425 | You are not required to accept this License in order to receive or
426 | run a copy of the Program. Ancillary propagation of a covered work
427 | occurring solely as a consequence of using peer-to-peer transmission
428 | to receive a copy likewise does not require acceptance. However,
429 | nothing other than this License grants you permission to propagate or
430 | modify any covered work. These actions infringe copyright if you do
431 | not accept this License. Therefore, by modifying or propagating a
432 | covered work, you indicate your acceptance of this License to do so.
433 |
434 | 10. Automatic Licensing of Downstream Recipients.
435 |
436 | Each time you convey a covered work, the recipient automatically
437 | receives a license from the original licensors, to run, modify and
438 | propagate that work, subject to this License. You are not responsible
439 | for enforcing compliance by third parties with this License.
440 |
441 | An "entity transaction" is a transaction transferring control of an
442 | organization, or substantially all assets of one, or subdividing an
443 | organization, or merging organizations. If propagation of a covered
444 | work results from an entity transaction, each party to that
445 | transaction who receives a copy of the work also receives whatever
446 | licenses to the work the party's predecessor in interest had or could
447 | give under the previous paragraph, plus a right to possession of the
448 | Corresponding Source of the work from the predecessor in interest, if
449 | the predecessor has it or can get it with reasonable efforts.
450 |
451 | You may not impose any further restrictions on the exercise of the
452 | rights granted or affirmed under this License. For example, you may
453 | not impose a license fee, royalty, or other charge for exercise of
454 | rights granted under this License, and you may not initiate litigation
455 | (including a cross-claim or counterclaim in a lawsuit) alleging that
456 | any patent claim is infringed by making, using, selling, offering for
457 | sale, or importing the Program or any portion of it.
458 |
459 | 11. Patents.
460 |
461 | A "contributor" is a copyright holder who authorizes use under this
462 | License of the Program or a work on which the Program is based. The
463 | work thus licensed is called the contributor's "contributor version".
464 |
465 | A contributor's "essential patent claims" are all patent claims
466 | owned or controlled by the contributor, whether already acquired or
467 | hereafter acquired, that would be infringed by some manner, permitted
468 | by this License, of making, using, or selling its contributor version,
469 | but do not include claims that would be infringed only as a
470 | consequence of further modification of the contributor version. For
471 | purposes of this definition, "control" includes the right to grant
472 | patent sublicenses in a manner consistent with the requirements of
473 | this License.
474 |
475 | Each contributor grants you a non-exclusive, worldwide, royalty-free
476 | patent license under the contributor's essential patent claims, to
477 | make, use, sell, offer for sale, import and otherwise run, modify and
478 | propagate the contents of its contributor version.
479 |
480 | In the following three paragraphs, a "patent license" is any express
481 | agreement or commitment, however denominated, not to enforce a patent
482 | (such as an express permission to practice a patent or covenant not to
483 | sue for patent infringement). To "grant" such a patent license to a
484 | party means to make such an agreement or commitment not to enforce a
485 | patent against the party.
486 |
487 | If you convey a covered work, knowingly relying on a patent license,
488 | and the Corresponding Source of the work is not available for anyone
489 | to copy, free of charge and under the terms of this License, through a
490 | publicly available network server or other readily accessible means,
491 | then you must either (1) cause the Corresponding Source to be so
492 | available, or (2) arrange to deprive yourself of the benefit of the
493 | patent license for this particular work, or (3) arrange, in a manner
494 | consistent with the requirements of this License, to extend the patent
495 | license to downstream recipients. "Knowingly relying" means you have
496 | actual knowledge that, but for the patent license, your conveying the
497 | covered work in a country, or your recipient's use of the covered work
498 | in a country, would infringe one or more identifiable patents in that
499 | country that you have reason to believe are valid.
500 |
501 | If, pursuant to or in connection with a single transaction or
502 | arrangement, you convey, or propagate by procuring conveyance of, a
503 | covered work, and grant a patent license to some of the parties
504 | receiving the covered work authorizing them to use, propagate, modify
505 | or convey a specific copy of the covered work, then the patent license
506 | you grant is automatically extended to all recipients of the covered
507 | work and works based on it.
508 |
509 | A patent license is "discriminatory" if it does not include within
510 | the scope of its coverage, prohibits the exercise of, or is
511 | conditioned on the non-exercise of one or more of the rights that are
512 | specifically granted under this License. You may not convey a covered
513 | work if you are a party to an arrangement with a third party that is
514 | in the business of distributing software, under which you make payment
515 | to the third party based on the extent of your activity of conveying
516 | the work, and under which the third party grants, to any of the
517 | parties who would receive the covered work from you, a discriminatory
518 | patent license (a) in connection with copies of the covered work
519 | conveyed by you (or copies made from those copies), or (b) primarily
520 | for and in connection with specific products or compilations that
521 | contain the covered work, unless you entered into that arrangement,
522 | or that patent license was granted, prior to 28 March 2007.
523 |
524 | Nothing in this License shall be construed as excluding or limiting
525 | any implied license or other defenses to infringement that may
526 | otherwise be available to you under applicable patent law.
527 |
528 | 12. No Surrender of Others' Freedom.
529 |
530 | If conditions are imposed on you (whether by court order, agreement or
531 | otherwise) that contradict the conditions of this License, they do not
532 | excuse you from the conditions of this License. If you cannot convey a
533 | covered work so as to satisfy simultaneously your obligations under this
534 | License and any other pertinent obligations, then as a consequence you may
535 | not convey it at all. For example, if you agree to terms that obligate you
536 | to collect a royalty for further conveying from those to whom you convey
537 | the Program, the only way you could satisfy both those terms and this
538 | License would be to refrain entirely from conveying the Program.
539 |
540 | 13. Remote Network Interaction; Use with the GNU General Public License.
541 |
542 | Notwithstanding any other provision of this License, if you modify the
543 | Program, your modified version must prominently offer all users
544 | interacting with it remotely through a computer network (if your version
545 | supports such interaction) an opportunity to receive the Corresponding
546 | Source of your version by providing access to the Corresponding Source
547 | from a network server at no charge, through some standard or customary
548 | means of facilitating copying of software. This Corresponding Source
549 | shall include the Corresponding Source for any work covered by version 3
550 | of the GNU General Public License that is incorporated pursuant to the
551 | following paragraph.
552 |
553 | Notwithstanding any other provision of this License, you have
554 | permission to link or combine any covered work with a work licensed
555 | under version 3 of the GNU General Public License into a single
556 | combined work, and to convey the resulting work. The terms of this
557 | License will continue to apply to the part which is the covered work,
558 | but the work with which it is combined will remain governed by version
559 | 3 of the GNU General Public License.
560 |
561 | 14. Revised Versions of this License.
562 |
563 | The Free Software Foundation may publish revised and/or new versions of
564 | the GNU Affero General Public License from time to time. Such new versions
565 | will be similar in spirit to the present version, but may differ in detail to
566 | address new problems or concerns.
567 |
568 | Each version is given a distinguishing version number. If the
569 | Program specifies that a certain numbered version of the GNU Affero General
570 | Public License "or any later version" applies to it, you have the
571 | option of following the terms and conditions either of that numbered
572 | version or of any later version published by the Free Software
573 | Foundation. If the Program does not specify a version number of the
574 | GNU Affero General Public License, you may choose any version ever published
575 | by the Free Software Foundation.
576 |
577 | If the Program specifies that a proxy can decide which future
578 | versions of the GNU Affero General Public License can be used, that proxy's
579 | public statement of acceptance of a version permanently authorizes you
580 | to choose that version for the Program.
581 |
582 | Later license versions may give you additional or different
583 | permissions. However, no additional obligations are imposed on any
584 | author or copyright holder as a result of your choosing to follow a
585 | later version.
586 |
587 | 15. Disclaimer of Warranty.
588 |
589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
597 |
598 | 16. Limitation of Liability.
599 |
600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
608 | SUCH DAMAGES.
609 |
610 | 17. Interpretation of Sections 15 and 16.
611 |
612 | If the disclaimer of warranty and limitation of liability provided
613 | above cannot be given local legal effect according to their terms,
614 | reviewing courts shall apply local law that most closely approximates
615 | an absolute waiver of all civil liability in connection with the
616 | Program, unless a warranty or assumption of liability accompanies a
617 | copy of the Program in return for a fee.
618 |
619 | END OF TERMS AND CONDITIONS
620 |
621 | How to Apply These Terms to Your New Programs
622 |
623 | If you develop a new program, and you want it to be of the greatest
624 | possible use to the public, the best way to achieve this is to make it
625 | free software which everyone can redistribute and change under these terms.
626 |
627 | To do so, attach the following notices to the program. It is safest
628 | to attach them to the start of each source file to most effectively
629 | state the exclusion of warranty; and each file should have at least
630 | the "copyright" line and a pointer to where the full notice is found.
631 |
632 |
633 | Copyright (C)
634 |
635 | This program is free software: you can redistribute it and/or modify
636 | it under the terms of the GNU Affero General Public License as published
637 | by the Free Software Foundation, either version 3 of the License, or
638 | (at your option) any later version.
639 |
640 | This program is distributed in the hope that it will be useful,
641 | but WITHOUT ANY WARRANTY; without even the implied warranty of
642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
643 | GNU Affero General Public License for more details.
644 |
645 | You should have received a copy of the GNU Affero General Public License
646 | along with this program. If not, see .
647 |
648 | Also add information on how to contact you by electronic and paper mail.
649 |
650 | If your software can interact with users remotely through a computer
651 | network, you should also make sure that it provides a way for users to
652 | get its source. For example, if your program is a web application, its
653 | interface could display a "Source" link that leads users to an archive
654 | of the code. There are many ways you could offer source, and different
655 | solutions will be better for different programs; see section 13 for the
656 | specific requirements.
657 |
658 | You should also get your employer (if you work as a programmer) or school,
659 | if any, to sign a "copyright disclaimer" for the program, if necessary.
660 | For more information on this, and how to apply and follow the GNU AGPL, see
661 | .
662 |
--------------------------------------------------------------------------------
/Login.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.27703.2042
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Login", "Login\Login.vcxproj", "{81A03759-5A78-419E-B2B7-6010CB1E74E2}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x64 = Debug|x64
11 | Debug|x86 = Debug|x86
12 | Release|x64 = Release|x64
13 | Release|x86 = Release|x86
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {81A03759-5A78-419E-B2B7-6010CB1E74E2}.Debug|x64.ActiveCfg = Debug|x64
17 | {81A03759-5A78-419E-B2B7-6010CB1E74E2}.Debug|x64.Build.0 = Debug|x64
18 | {81A03759-5A78-419E-B2B7-6010CB1E74E2}.Debug|x86.ActiveCfg = Debug|Win32
19 | {81A03759-5A78-419E-B2B7-6010CB1E74E2}.Debug|x86.Build.0 = Debug|Win32
20 | {81A03759-5A78-419E-B2B7-6010CB1E74E2}.Release|x64.ActiveCfg = Release|x64
21 | {81A03759-5A78-419E-B2B7-6010CB1E74E2}.Release|x64.Build.0 = Release|x64
22 | {81A03759-5A78-419E-B2B7-6010CB1E74E2}.Release|x86.ActiveCfg = Release|Win32
23 | {81A03759-5A78-419E-B2B7-6010CB1E74E2}.Release|x86.Build.0 = Release|Win32
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {61E70EE7-4D43-4F66-B6E2-8C87AC7A3EB8}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/Login/IconJlu.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code4lala/dr-jlu-win32/6568d479300575215adee5813801726aa47f19d3/Login/IconJlu.ico
--------------------------------------------------------------------------------
/Login/IconJluSm.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code4lala/dr-jlu-win32/6568d479300575215adee5813801726aa47f19d3/Login/IconJluSm.ico
--------------------------------------------------------------------------------
/Login/LogUtil.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include "LogUtil.h"
6 |
7 | #ifdef UNICODE
8 | const WCHAR * szDebugPrefix = szDebugPrefixW;
9 | #elif
10 | const char * szDebugPrefix = szDebugPrefixA;
11 | #endif
12 |
13 | static TCHAR szBuffer[1024];
14 | static TCHAR szB2[1024];
15 | static char strBuf[1024];
16 | static char strB2[1024];
17 | static SYSTEMTIME st;
18 |
19 | void CDECL loge(const TCHAR * szFormat, ...) {
20 | va_list pArgList;
21 | va_start(pArgList, szFormat);
22 | #ifdef UNICODE
23 | _vsnwprintf_s(szBuffer, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
24 | #elif
25 | _vsnprintf_s(strBuf, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
26 | #endif
27 | va_end(pArgList);
28 |
29 | GetLocalTime(&st);
30 |
31 | wsprintf(szB2, TEXT("[ERROR] %02d:%02d:%02d.%03d [%d] %s %s\n"),
32 | // current time
33 | st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
34 | // process id
35 | GetCurrentProcessId(),
36 | // debug log
37 | szDebugPrefix, szBuffer);
38 | OutputDebugString(szB2);
39 | }
40 |
41 | void CDECL logi(const TCHAR * szFormat, ...) {
42 | va_list pArgList;
43 | va_start(pArgList, szFormat);
44 | #ifdef UNICODE
45 | _vsnwprintf_s(szBuffer, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
46 | #elif
47 | _vsnprintf_s(strBuf, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
48 | #endif
49 | va_end(pArgList);
50 |
51 | GetLocalTime(&st);
52 |
53 | wsprintf(szB2, TEXT("[INFO] %02d:%02d:%02d.%03d [%d] %s %s\n"),
54 | // current time
55 | st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
56 | // process id
57 | GetCurrentProcessId(),
58 | // debug log
59 | szDebugPrefix, szBuffer);
60 | OutputDebugString(szB2);
61 | }
62 |
63 | #ifndef _DEBUG
64 | void CDECL logd(const TCHAR * szFormat, ...) { }
65 | void CDECL logdA(const char * szFormat, ...) { }
66 | #else
67 | void CDECL logd(const TCHAR * szFormat, ...) {
68 | va_list pArgList;
69 | va_start(pArgList, szFormat);
70 | #ifdef UNICODE
71 | _vsnwprintf_s(szBuffer, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
72 | #elif
73 | _vsnprintf_s(strBuf, sizeof(szBuffer) / sizeof(TCHAR), szFormat, pArgList);
74 | #endif
75 | va_end(pArgList);
76 |
77 | GetLocalTime(&st);
78 |
79 | wsprintf(szB2, TEXT("[DEBUG] %02d:%02d:%02d.%03d [%d] %s %s\n"),
80 | // current time
81 | st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
82 | // process id
83 | GetCurrentProcessId(),
84 | // debug log
85 | szDebugPrefix, szBuffer);
86 | OutputDebugString(szB2);
87 | }
88 |
89 | void CDECL logdA(const char * szFormat, ...) {
90 | va_list pArgList;
91 | va_start(pArgList, szFormat);
92 | _vsnprintf_s(strBuf, sizeof(strBuf) / sizeof(char), szFormat, pArgList);
93 | va_end(pArgList);
94 |
95 | GetLocalTime(&st);
96 |
97 | sprintf(strB2, "[INFO] %02d:%02d:%02d.%03d [%d] %s %s\n",
98 | // current time
99 | st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
100 | // process id
101 | GetCurrentProcessId(),
102 | // debug log
103 | szDebugPrefixA, strBuf);
104 | OutputDebugStringA(strB2);
105 | }
106 | #endif // _DEBUG
107 |
108 |
109 |
110 | void CDECL logeA(const char * szFormat, ...) {
111 | va_list pArgList;
112 | va_start(pArgList, szFormat);
113 | _vsnprintf_s(strBuf, sizeof(strBuf) / sizeof(char), szFormat, pArgList);
114 | va_end(pArgList);
115 |
116 | GetLocalTime(&st);
117 |
118 | sprintf(strB2, "[ERROR] %02d:%02d:%02d.%03d [%d] %s %s\n",
119 | // current time
120 | st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
121 | // process id
122 | GetCurrentProcessId(),
123 | // debug log
124 | szDebugPrefixA, strBuf);
125 | OutputDebugStringA(strB2);
126 | }
127 |
128 | void CDECL logiA(const char * szFormat, ...) {
129 | va_list pArgList;
130 | va_start(pArgList, szFormat);
131 | _vsnprintf_s(strBuf, sizeof(strBuf) / sizeof(char), szFormat, pArgList);
132 | va_end(pArgList);
133 |
134 | GetLocalTime(&st);
135 |
136 | sprintf(strB2, "[INFO] %02d:%02d:%02d.%03d [%d] %s %s\n",
137 | // current time
138 | st.wHour, st.wMinute, st.wSecond, st.wMilliseconds,
139 | // process id
140 | GetCurrentProcessId(),
141 | // debug log
142 | szDebugPrefixA, strBuf);
143 | OutputDebugStringA(strB2);
144 | }
145 |
--------------------------------------------------------------------------------
/Login/LogUtil.h:
--------------------------------------------------------------------------------
1 | #ifndef LOGUTIL_H
2 | #define LOGUTIL_H
3 |
4 | void logd(const TCHAR * szFormat, ...);
5 | void logi(const TCHAR * szFormat, ...);
6 | void loge(const TCHAR * szFormat, ...);
7 | void logdA(const char * szFormat, ...);
8 | void logiA(const char * szFormat, ...);
9 | void logeA(const char * szFormat, ...);
10 | //void logdW(const TCHAR * szFormat, ...);
11 | //void logiW(const TCHAR * szFormat, ...);
12 | //void logeW(const TCHAR * szFormat, ...);
13 | extern const char * szDebugPrefixA;
14 | extern const WCHAR * szDebugPrefixW;
15 |
16 | #endif // !LOGUTIL_H
17 |
--------------------------------------------------------------------------------
/Login/Login.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code4lala/dr-jlu-win32/6568d479300575215adee5813801726aa47f19d3/Login/Login.rc
--------------------------------------------------------------------------------
/Login/Login.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | Win32
7 |
8 |
9 | Release
10 | Win32
11 |
12 |
13 | Debug
14 | x64
15 |
16 |
17 | Release
18 | x64
19 |
20 |
21 |
22 | 15.0
23 | {81A03759-5A78-419E-B2B7-6010CB1E74E2}
24 | Win32Proj
25 | Login
26 | 10.0.17134.0
27 |
28 |
29 |
30 | Application
31 | true
32 | v141
33 | Unicode
34 |
35 |
36 | Application
37 | false
38 | v141
39 | true
40 | Unicode
41 |
42 |
43 | Application
44 | true
45 | v141
46 | Unicode
47 |
48 |
49 | Application
50 | false
51 | v141
52 | true
53 | Unicode
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 | true
75 |
76 |
77 | true
78 |
79 |
80 | false
81 |
82 |
83 | false
84 |
85 |
86 |
87 | Level4
88 | Disabled
89 | WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)
90 | true
91 |
92 |
93 | true
94 | Windows
95 | type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'
96 | Ws2_32.lib;%(AdditionalDependencies)
97 |
98 |
99 |
100 |
101 | Level3
102 | Disabled
103 | _DEBUG;_WINDOWS;%(PreprocessorDefinitions)
104 | true
105 |
106 |
107 | true
108 | Windows
109 |
110 |
111 |
112 |
113 | Level3
114 | MaxSpeed
115 | true
116 | true
117 | WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
118 | true
119 |
120 |
121 | true
122 | true
123 | true
124 | Windows
125 | Ws2_32.lib;%(AdditionalDependencies)
126 | type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*';%(AdditionalManifestDependencies)
127 |
128 |
129 |
130 |
131 | Level3
132 | MaxSpeed
133 | true
134 | true
135 | NDEBUG;_WINDOWS;%(PreprocessorDefinitions)
136 | true
137 |
138 |
139 | true
140 | true
141 | true
142 | Windows
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 |
--------------------------------------------------------------------------------
/Login/Login.vcxproj.filters:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | {4FC737F1-C7A5-4376-A066-2A32D752A2FF}
6 | cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx
7 |
8 |
9 | {93995380-89BD-4b04-88EB-625FBE52EBFB}
10 | h;hh;hpp;hxx;hm;inl;inc;ipp;xsd
11 |
12 |
13 | {67DA6AB6-F800-4c08-8B7A-83BB121AAD01}
14 | rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms
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 |
--------------------------------------------------------------------------------
/Login/WinMain.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code4lala/dr-jlu-win32/6568d479300575215adee5813801726aa47f19d3/Login/WinMain.cpp
--------------------------------------------------------------------------------
/Login/dogcom/auth.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code4lala/dr-jlu-win32/6568d479300575215adee5813801726aa47f19d3/Login/dogcom/auth.cpp
--------------------------------------------------------------------------------
/Login/dogcom/auth.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code4lala/dr-jlu-win32/6568d479300575215adee5813801726aa47f19d3/Login/dogcom/auth.h
--------------------------------------------------------------------------------
/Login/dogcom/configparse.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "configparse.h"
3 |
4 | char *log_path = nullptr;
5 |
6 |
7 | void fillConfig(const char *username,
8 | const char *password,
9 | const unsigned char mac[6]) {
10 | strcpy(drcom_config.server, "10.100.61.3");
11 | strcpy(drcom_config.username, username);
12 | strcpy(drcom_config.password, password);
13 | drcom_config.CONTROLCHECKSTATUS = 0x20;
14 | drcom_config.ADAPTERNUM = 0x03;
15 | strcpy(drcom_config.host_ip, "0.0.0.0");
16 | drcom_config.IPDOG = 0x01;
17 | strcpy(drcom_config.host_name, "LIYUANYUAN");
18 | strcpy(drcom_config.PRIMARY_DNS, "10.10.10.10");
19 | strcpy(drcom_config.dhcp_server, "0.0.0.0");
20 | drcom_config.AUTH_VERSION[0] = 0x68;
21 | drcom_config.AUTH_VERSION[1] = 0x00;
22 | for (int i = 0; i < 6; i++) {
23 | drcom_config.mac[i] = mac[i];
24 | }
25 | strcpy(drcom_config.host_os, "Windows 10");
26 | drcom_config.KEEP_ALIVE_VERSION[0] = 0xDC;
27 | drcom_config.KEEP_ALIVE_VERSION[1] = 0x02;
28 | }
--------------------------------------------------------------------------------
/Login/dogcom/configparse.h:
--------------------------------------------------------------------------------
1 | #ifndef CONFIGPARSE_H_
2 | #define CONFIGPARSE_H_
3 |
4 | struct config {
5 | char server[20];
6 | char username[36];
7 | char password[20];
8 | unsigned char CONTROLCHECKSTATUS;
9 | unsigned char ADAPTERNUM;
10 | char host_ip[20];
11 | unsigned char IPDOG;
12 | char host_name[20];
13 | char PRIMARY_DNS[20];
14 | char dhcp_server[20];
15 | unsigned char AUTH_VERSION[2];
16 | unsigned char mac[6];
17 | char host_os[20];
18 | unsigned char KEEP_ALIVE_VERSION[2];
19 | };
20 |
21 | extern struct config drcom_config;
22 | extern char *log_path;
23 |
24 |
25 | void fillConfig(const char *username,
26 | const char *password,
27 | const unsigned char mac[6]);
28 |
29 | #endif // CONFIGPARSE_H_
--------------------------------------------------------------------------------
/Login/dogcom/keepalive.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include
6 | typedef int socklen_t;
7 |
8 | #include "keepalive.h"
9 | #include "configparse.h"
10 | #include "auth.h"
11 | #include "md5.h"
12 | #include "md4.h"
13 | #include "sha1.h"
14 |
15 | #include "../LogUtil.h"
16 |
17 | void gen_crc(unsigned char seed[], int encrypt_type, unsigned char crc[]) {
18 | if (encrypt_type == 0) {
19 | char DRCOM_DIAL_EXT_PROTO_CRC_INIT[4] = { (char)0xc7, (char)0x2f, (char)0x31, (char)0x01 };
20 | char gencrc_tmp[4] = { 0x7e };
21 | memcpy(crc, DRCOM_DIAL_EXT_PROTO_CRC_INIT, 4);
22 | memcpy(crc + 4, gencrc_tmp, 4);
23 | }
24 | else if (encrypt_type == 1) {
25 | unsigned char hash[32] = { 0 };
26 | MD5(seed, 4, hash);
27 | crc[0] = hash[2];
28 | crc[1] = hash[3];
29 | crc[2] = hash[8];
30 | crc[3] = hash[9];
31 | crc[4] = hash[5];
32 | crc[5] = hash[6];
33 | crc[6] = hash[13];
34 | crc[7] = hash[14];
35 | }
36 | else if (encrypt_type == 2) {
37 | unsigned char hash[32] = { 0 };
38 | MD4(seed, 4, hash);
39 | crc[0] = hash[1];
40 | crc[1] = hash[2];
41 | crc[2] = hash[8];
42 | crc[3] = hash[9];
43 | crc[4] = hash[4];
44 | crc[5] = hash[5];
45 | crc[6] = hash[11];
46 | crc[7] = hash[12];
47 | }
48 | else if (encrypt_type == 3) {
49 | unsigned char hash[32] = { 0 };
50 | SHA1(seed, 4, hash);
51 | crc[0] = hash[2];
52 | crc[1] = hash[3];
53 | crc[2] = hash[9];
54 | crc[3] = hash[10];
55 | crc[4] = hash[5];
56 | crc[5] = hash[6];
57 | crc[6] = hash[15];
58 | crc[7] = hash[16];
59 | }
60 | }
61 |
62 |
63 | int keepalive_1(int sockfd, struct sockaddr_in addr, unsigned char seed[], unsigned char auth_information[]) {
64 | unsigned char keepalive_1_packet1[8] = { 0x07, 0x01, 0x08, 0x00, 0x01, 0x00, 0x00, 0x00 };
65 | unsigned char recv_packet1[1024], keepalive_1_packet2[38], recv_packet2[1024];
66 | memset(keepalive_1_packet2, 0, 38);
67 | sendto(sockfd, (const char *)keepalive_1_packet1, 8, 0, (struct sockaddr *) &addr, sizeof(addr));
68 | print_packet("[Keepalive1 sent] ", keepalive_1_packet1, 42);
69 | socklen_t addrlen = sizeof(addr);
70 | while (1) {
71 | if (recvfrom(sockfd, (char *)recv_packet1, 1024, 0, (struct sockaddr *) &addr, &addrlen) < 0) {
72 | get_lasterror("Failed to recv data");
73 | return 1;
74 | }
75 | else {
76 | print_packet("[Keepalive1 challenge_recv] ", recv_packet1, 100);
77 |
78 | if (recv_packet1[0] == 0x07) {
79 | break;
80 | }
81 | else if (recv_packet1[0] == 0x4d) {
82 | logiA("Get notice packet.\n");
83 | continue;
84 | }
85 | else {
86 | logiA("Bad keepalive1 challenge response received.\n");
87 | return 1;
88 | }
89 | }
90 | }
91 |
92 | unsigned char keepalive1_seed[4] = { 0 };
93 | int encrypt_type;
94 | unsigned char crc[8] = { 0 };
95 | memcpy(keepalive1_seed, &recv_packet1[8], 4);
96 | encrypt_type = keepalive1_seed[0] & 3;
97 | gen_crc(keepalive1_seed, encrypt_type, crc);
98 | keepalive_1_packet2[0] = 0xff;
99 | memcpy(keepalive_1_packet2 + 8, keepalive1_seed, 4);
100 | memcpy(keepalive_1_packet2 + 12, crc, 8);
101 | memcpy(keepalive_1_packet2 + 20, auth_information, 16);
102 | keepalive_1_packet2[36] = rand() & 0xff;
103 | keepalive_1_packet2[37] = rand() & 0xff;
104 |
105 | sendto(sockfd, (const char *)keepalive_1_packet2, 42, 0, (struct sockaddr *) &addr, sizeof(addr));
106 |
107 | if (recvfrom(sockfd, (char *)recv_packet2, 1024, 0, (struct sockaddr *) &addr, &addrlen) < 0) {
108 | get_lasterror("Failed to recv data");
109 | return 1;
110 | }
111 | else {
112 | print_packet("[Keepalive1 recv] ", recv_packet2, 100);
113 |
114 | if (recv_packet2[0] != 0x07) {
115 | logiA("Bad keepalive1 response received.\n");
116 | return 1;
117 | }
118 | }
119 |
120 |
121 | return 0;
122 | }
123 |
124 |
125 | void keepalive_2_packetbuilder(unsigned char keepalive_2_packet[], int keepalive_counter, int filepacket, int type, int encrypt_type) {
126 | keepalive_2_packet[0] = 0x07;
127 | keepalive_2_packet[1] = keepalive_counter;
128 | keepalive_2_packet[2] = 0x28;
129 | keepalive_2_packet[4] = 0x0b;
130 | keepalive_2_packet[5] = type;
131 | if (filepacket) {
132 | keepalive_2_packet[6] = 0x0f;
133 | keepalive_2_packet[7] = 0x27;
134 | }
135 | else {
136 | memcpy(keepalive_2_packet + 6, drcom_config.KEEP_ALIVE_VERSION, 2);
137 | }
138 | keepalive_2_packet[8] = 0x2f;
139 | keepalive_2_packet[9] = 0x12;
140 | if (type == 3) {
141 | unsigned char host_ip[4] = { 0 };
142 | sscanf(drcom_config.host_ip, "%hhd.%hhd.%hhd.%hhd",
143 | &host_ip[0],
144 | &host_ip[1],
145 | &host_ip[2],
146 | &host_ip[3]);
147 | memcpy(keepalive_2_packet + 28, host_ip, 4);
148 | }
149 | }
150 |
151 | int keepalive_2(int sockfd, struct sockaddr_in addr, int *keepalive_counter, int *first, int *encrypt_type) {
152 | unsigned char keepalive_2_packet[40], recv_packet[1024], tail[4];
153 | socklen_t addrlen = sizeof(addr);
154 |
155 | if (*first) {
156 | // send the file packet
157 | memset(keepalive_2_packet, 0, 40);
158 | keepalive_2_packetbuilder(keepalive_2_packet, *keepalive_counter % 0xFF, *first, 1, 0);
159 | (*keepalive_counter)++;
160 |
161 | sendto(sockfd, (const char*)keepalive_2_packet, 40, 0, (struct sockaddr *)&addr, sizeof(addr));
162 |
163 | print_packet("[Keepalive2_file sent] ", keepalive_2_packet, 40);
164 | if (recvfrom(sockfd, (char*)recv_packet, 1024, 0, (struct sockaddr *)&addr, &addrlen) < 0) {
165 | get_lasterror("Failed to recv data");
166 | return 1;
167 | }
168 | print_packet("[Keepalive2_file recv] ", recv_packet, 40);
169 |
170 | if (recv_packet[0] == 0x07) {
171 | if (recv_packet[2] == 0x10) {
172 | logiA("Filepacket received.\n");
173 | }
174 | else if (recv_packet[2] != 0x28) {
175 | logiA("Bad keepalive2 response received.\n");
176 | return 1;
177 | }
178 | }
179 | else {
180 | logiA("Bad keepalive2 response received.\n");
181 | return 1;
182 | }
183 | }
184 |
185 | // send the first packet
186 | *first = 0;
187 | memset(keepalive_2_packet, 0, 40);
188 | keepalive_2_packetbuilder(keepalive_2_packet, *keepalive_counter % 0xFF, *first, 1, 0);
189 | (*keepalive_counter)++;
190 | sendto(sockfd, (const char*)keepalive_2_packet, 40, 0, (struct sockaddr *)&addr, sizeof(addr));
191 |
192 | print_packet("[Keepalive2_A sent] ", keepalive_2_packet, 40);
193 |
194 | if (recvfrom(sockfd, (char*)recv_packet, 1024, 0, (struct sockaddr *)&addr, &addrlen) < 0) {
195 | get_lasterror("Failed to recv data");
196 | return 1;
197 | }
198 | print_packet("[Keepalive2_B recv] ", recv_packet, 40);
199 |
200 | if (recv_packet[0] == 0x07) {
201 | if (recv_packet[2] != 0x28) {
202 | logiA("Bad keepalive2 response received.\n");
203 | return 1;
204 | }
205 | }
206 | else {
207 | logiA("Bad keepalive2 response received.\n");
208 | return 1;
209 | }
210 | memcpy(tail, &recv_packet[16], 4);
211 |
212 | // send the third packet
213 | memset(keepalive_2_packet, 0, 40);
214 | keepalive_2_packetbuilder(keepalive_2_packet, *keepalive_counter % 0xFF, *first, 3, 0);
215 | memcpy(keepalive_2_packet + 16, tail, 4);
216 | (*keepalive_counter)++;
217 | sendto(sockfd, (const char*)keepalive_2_packet, 40, 0, (struct sockaddr *)&addr, sizeof(addr));
218 |
219 | print_packet("[Keepalive2_C sent] ", keepalive_2_packet, 40);
220 |
221 |
222 | if (recvfrom(sockfd, (char*)recv_packet, 1024, 0, (struct sockaddr *)&addr, &addrlen) < 0) {
223 | get_lasterror("Failed to recv data");
224 | return 1;
225 | }
226 | print_packet("[Keepalive2_D recv] ", recv_packet, 40);
227 |
228 | if (recv_packet[0] == 0x07) {
229 | if (recv_packet[2] != 0x28) {
230 | logiA("Bad keepalive2 response received.\n");
231 | return 1;
232 | }
233 | }
234 | else {
235 | logiA("Bad keepalive2 response received.\n");
236 | return 1;
237 | }
238 |
239 | return 0;
240 | }
--------------------------------------------------------------------------------
/Login/dogcom/keepalive.h:
--------------------------------------------------------------------------------
1 | #ifndef KEEPALIVE_H_
2 | #define KEEPALIVE_H_
3 |
4 | int keepalive_1(int sockfd, struct sockaddr_in addr, unsigned char seed[], unsigned char auth_information[]);
5 | int keepalive_2(int sockfd, struct sockaddr_in addr, int *keepalive_counter, int *first, int *encrypt_type);
6 |
7 | #endif // KEEPALIVE_H_
--------------------------------------------------------------------------------
/Login/dogcom/login.cpp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code4lala/dr-jlu-win32/6568d479300575215adee5813801726aa47f19d3/Login/dogcom/login.cpp
--------------------------------------------------------------------------------
/Login/dogcom/login.h:
--------------------------------------------------------------------------------
1 | #ifndef LOGIN_H
2 | #define LOGIN_H
3 | #include
4 | #include
5 | #include
6 | #include
7 | #include
8 |
9 | void login(const char *account, const char *password, const unsigned char mac[6]);
10 | void logout();
11 |
12 | struct tagLogInfo {
13 | char account[48];
14 | char pass[48];
15 | unsigned char mac[6];
16 | };
17 |
18 | class InterruptibleSleeper {
19 | public:
20 | // returns false if killed:
21 | template
22 | bool wait_for(std::chrono::duration const& time) {
23 | std::unique_lock lock(m);
24 | return !cv.wait_for(lock, time, [&] {return terminate; });
25 | }
26 | void interrupt() {
27 | std::unique_lock lock(m);
28 | terminate = true;
29 | cv.notify_all();
30 | }
31 | void reset() {
32 | terminate = false;
33 | }
34 | private:
35 | std::condition_variable cv;
36 | std::mutex m;
37 | bool terminate = false;
38 | };
39 |
40 | extern InterruptibleSleeper sleeper;
41 |
42 | extern struct tagLogInfo logInfo;
43 | extern int status;
44 | extern TCHAR *err_msg;
45 | extern unsigned char receivedIp[4];
46 |
47 | enum {
48 | OFFLINE = 1,
49 | LOGGING = 2,
50 | LOGGEDIN = 3
51 | };
52 |
53 | extern const TCHAR szAppName[];
54 | extern const TCHAR szTitle[];
55 | extern const TCHAR szHiddenName[];
56 | extern const TCHAR szHiddenTitle[];
57 |
58 | #define WM_USER_SHOWLOGINWINDOW (WM_USER + 1)
59 | #define WM_USER_HIDELOGINWINDOW (WM_USER + 2)
60 | #define WM_USER_QUIT (WM_USER + 3)
61 | #define WM_USER_LOGIN (WM_USER + 4)
62 | #define WM_USER_LOGIN_FAILED (WM_USER + 5)
63 | #define WM_USER_LOGIN_SUCCEED (WM_USER + 6)
64 | #define WM_USER_DISABLE_BUTTON (WM_USER + 7)
65 | #define WM_USER_ENABLE_BUTTON (WM_USER + 8)
66 | #define WM_USER_GET_IP (WM_USER + 9)
67 | #define WM_USER_FILL_BLANKS (WM_USER + 10)
68 | #define WM_USER_CLEAR_IP (WM_USER + 11)
69 |
70 | #endif // LOGIN_H
71 |
--------------------------------------------------------------------------------
/Login/dogcom/md4.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
3 | * MD4 Message-Digest Algorithm (RFC 1320).
4 | *
5 | * Homepage:
6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md4
7 | *
8 | * Author:
9 | * Alexander Peslyak, better known as Solar Designer
10 | *
11 | * This software was written by Alexander Peslyak in 2001. No copyright is
12 | * claimed, and the software is hereby placed in the public domain.
13 | * In case this attempt to disclaim copyright and place the software in the
14 | * public domain is deemed null and void, then the software is
15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
16 | * general public under the following terms:
17 | *
18 | * Redistribution and use in source and binary forms, with or without
19 | * modification, are permitted.
20 | *
21 | * There's ABSOLUTELY NO WARRANTY, express or implied.
22 | *
23 | * (This is a heavily cut-down "BSD license".)
24 | *
25 | * This differs from Colin Plumb's older public domain implementation in that
26 | * no exactly 32-bit integer data type is required (any 32-bit or wider
27 | * unsigned integer data type will do), there's no compile-time endianness
28 | * configuration, and the function prototypes match OpenSSL's. No code from
29 | * Colin Plumb's implementation has been reused; this comment merely compares
30 | * the properties of the two independent implementations.
31 | *
32 | * The primary goals of this implementation are portability and ease of use.
33 | * It is meant to be fast, but not as fast as possible. Some known
34 | * optimizations are not included to reduce source code size and avoid
35 | * compile-time configuration.
36 | */
37 |
38 | #ifndef HAVE_OPENSSL
39 |
40 | #include
41 |
42 | #include "md4.h"
43 |
44 | /*
45 | * The basic MD4 functions.
46 | *
47 | * F and G are optimized compared to their RFC 1320 definitions, with the
48 | * optimization for F borrowed from Colin Plumb's MD5 implementation.
49 | */
50 | #define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
51 | #define G(x, y, z) (((x) & ((y) | (z))) | ((y) & (z)))
52 | #define H(x, y, z) ((x) ^ (y) ^ (z))
53 |
54 | /*
55 | * The MD4 transformation for all three rounds.
56 | */
57 | #define STEP(f, a, b, c, d, x, s) \
58 | (a) += f((b), (c), (d)) + (x); \
59 | (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s))));
60 |
61 | /*
62 | * SET reads 4 input bytes in little-endian byte order and stores them in a
63 | * properly aligned word in host byte order.
64 | *
65 | * The check for little-endian architectures that tolerate unaligned memory
66 | * accesses is just an optimization. Nothing will break if it fails to detect
67 | * a suitable architecture.
68 | *
69 | * Unfortunately, this optimization may be a C strict aliasing rules violation
70 | * if the caller's data buffer has effective type that cannot be aliased by
71 | * MD4_u32plus. In practice, this problem may occur if these MD4 routines are
72 | * inlined into a calling function, or with future and dangerously advanced
73 | * link-time optimizations. For the time being, keeping these MD4 routines in
74 | * their own translation unit avoids the problem.
75 | */
76 | #if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
77 | #define SET(n) \
78 | (*(MD4_u32plus *)&ptr[(n) * 4])
79 | #define GET(n) \
80 | SET(n)
81 | #else
82 | #define SET(n) \
83 | (ctx->block[(n)] = \
84 | (MD4_u32plus)ptr[(n) * 4] | \
85 | ((MD4_u32plus)ptr[(n) * 4 + 1] << 8) | \
86 | ((MD4_u32plus)ptr[(n) * 4 + 2] << 16) | \
87 | ((MD4_u32plus)ptr[(n) * 4 + 3] << 24))
88 | #define GET(n) \
89 | (ctx->block[(n)])
90 | #endif
91 |
92 | /*
93 | * This processes one or more 64-byte data blocks, but does NOT update the bit
94 | * counters. There are no alignment requirements.
95 | */
96 | static const void *body(MD4_CTX *ctx, const void *data, unsigned long size)
97 | {
98 | const unsigned char *ptr;
99 | MD4_u32plus a, b, c, d;
100 | MD4_u32plus saved_a, saved_b, saved_c, saved_d;
101 | const MD4_u32plus ac1 = 0x5a827999, ac2 = 0x6ed9eba1;
102 |
103 | ptr = (const unsigned char *)data;
104 |
105 | a = ctx->a;
106 | b = ctx->b;
107 | c = ctx->c;
108 | d = ctx->d;
109 |
110 | do {
111 | saved_a = a;
112 | saved_b = b;
113 | saved_c = c;
114 | saved_d = d;
115 |
116 | /* Round 1 */
117 | STEP(F, a, b, c, d, SET(0), 3)
118 | STEP(F, d, a, b, c, SET(1), 7)
119 | STEP(F, c, d, a, b, SET(2), 11)
120 | STEP(F, b, c, d, a, SET(3), 19)
121 | STEP(F, a, b, c, d, SET(4), 3)
122 | STEP(F, d, a, b, c, SET(5), 7)
123 | STEP(F, c, d, a, b, SET(6), 11)
124 | STEP(F, b, c, d, a, SET(7), 19)
125 | STEP(F, a, b, c, d, SET(8), 3)
126 | STEP(F, d, a, b, c, SET(9), 7)
127 | STEP(F, c, d, a, b, SET(10), 11)
128 | STEP(F, b, c, d, a, SET(11), 19)
129 | STEP(F, a, b, c, d, SET(12), 3)
130 | STEP(F, d, a, b, c, SET(13), 7)
131 | STEP(F, c, d, a, b, SET(14), 11)
132 | STEP(F, b, c, d, a, SET(15), 19)
133 |
134 | /* Round 2 */
135 | STEP(G, a, b, c, d, GET(0) + ac1, 3)
136 | STEP(G, d, a, b, c, GET(4) + ac1, 5)
137 | STEP(G, c, d, a, b, GET(8) + ac1, 9)
138 | STEP(G, b, c, d, a, GET(12) + ac1, 13)
139 | STEP(G, a, b, c, d, GET(1) + ac1, 3)
140 | STEP(G, d, a, b, c, GET(5) + ac1, 5)
141 | STEP(G, c, d, a, b, GET(9) + ac1, 9)
142 | STEP(G, b, c, d, a, GET(13) + ac1, 13)
143 | STEP(G, a, b, c, d, GET(2) + ac1, 3)
144 | STEP(G, d, a, b, c, GET(6) + ac1, 5)
145 | STEP(G, c, d, a, b, GET(10) + ac1, 9)
146 | STEP(G, b, c, d, a, GET(14) + ac1, 13)
147 | STEP(G, a, b, c, d, GET(3) + ac1, 3)
148 | STEP(G, d, a, b, c, GET(7) + ac1, 5)
149 | STEP(G, c, d, a, b, GET(11) + ac1, 9)
150 | STEP(G, b, c, d, a, GET(15) + ac1, 13)
151 |
152 | /* Round 3 */
153 | STEP(H, a, b, c, d, GET(0) + ac2, 3)
154 | STEP(H, d, a, b, c, GET(8) + ac2, 9)
155 | STEP(H, c, d, a, b, GET(4) + ac2, 11)
156 | STEP(H, b, c, d, a, GET(12) + ac2, 15)
157 | STEP(H, a, b, c, d, GET(2) + ac2, 3)
158 | STEP(H, d, a, b, c, GET(10) + ac2, 9)
159 | STEP(H, c, d, a, b, GET(6) + ac2, 11)
160 | STEP(H, b, c, d, a, GET(14) + ac2, 15)
161 | STEP(H, a, b, c, d, GET(1) + ac2, 3)
162 | STEP(H, d, a, b, c, GET(9) + ac2, 9)
163 | STEP(H, c, d, a, b, GET(5) + ac2, 11)
164 | STEP(H, b, c, d, a, GET(13) + ac2, 15)
165 | STEP(H, a, b, c, d, GET(3) + ac2, 3)
166 | STEP(H, d, a, b, c, GET(11) + ac2, 9)
167 | STEP(H, c, d, a, b, GET(7) + ac2, 11)
168 | STEP(H, b, c, d, a, GET(15) + ac2, 15)
169 |
170 | a += saved_a;
171 | b += saved_b;
172 | c += saved_c;
173 | d += saved_d;
174 |
175 | ptr += 64;
176 | } while (size -= 64);
177 |
178 | ctx->a = a;
179 | ctx->b = b;
180 | ctx->c = c;
181 | ctx->d = d;
182 |
183 | return ptr;
184 | }
185 |
186 | void MD4_Init(MD4_CTX *ctx)
187 | {
188 | ctx->a = 0x67452301;
189 | ctx->b = 0xefcdab89;
190 | ctx->c = 0x98badcfe;
191 | ctx->d = 0x10325476;
192 |
193 | ctx->lo = 0;
194 | ctx->hi = 0;
195 | }
196 |
197 | void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size)
198 | {
199 | MD4_u32plus saved_lo;
200 | unsigned long used, available;
201 |
202 | saved_lo = ctx->lo;
203 | if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
204 | ctx->hi++;
205 | ctx->hi += size >> 29;
206 |
207 | used = saved_lo & 0x3f;
208 |
209 | if (used) {
210 | available = 64 - used;
211 |
212 | if (size < available) {
213 | memcpy(&ctx->buffer[used], data, size);
214 | return;
215 | }
216 |
217 | memcpy(&ctx->buffer[used], data, available);
218 | data = (const unsigned char *)data + available;
219 | size -= available;
220 | body(ctx, ctx->buffer, 64);
221 | }
222 |
223 | if (size >= 64) {
224 | data = body(ctx, data, size & ~(unsigned long)0x3f);
225 | size &= 0x3f;
226 | }
227 |
228 | memcpy(ctx->buffer, data, size);
229 | }
230 |
231 | #define OUT(dst, src) \
232 | (dst)[0] = (unsigned char)(src); \
233 | (dst)[1] = (unsigned char)((src) >> 8); \
234 | (dst)[2] = (unsigned char)((src) >> 16); \
235 | (dst)[3] = (unsigned char)((src) >> 24);
236 |
237 | void MD4_Final(unsigned char *result, MD4_CTX *ctx)
238 | {
239 | unsigned long used, available;
240 |
241 | used = ctx->lo & 0x3f;
242 |
243 | ctx->buffer[used++] = 0x80;
244 |
245 | available = 64 - used;
246 |
247 | if (available < 8) {
248 | memset(&ctx->buffer[used], 0, available);
249 | body(ctx, ctx->buffer, 64);
250 | used = 0;
251 | available = 64;
252 | }
253 |
254 | memset(&ctx->buffer[used], 0, available - 8);
255 |
256 | ctx->lo <<= 3;
257 | OUT(&ctx->buffer[56], ctx->lo)
258 | OUT(&ctx->buffer[60], ctx->hi)
259 |
260 | body(ctx, ctx->buffer, 64);
261 |
262 | OUT(&result[0], ctx->a)
263 | OUT(&result[4], ctx->b)
264 | OUT(&result[8], ctx->c)
265 | OUT(&result[12], ctx->d)
266 |
267 | memset(ctx, 0, sizeof(*ctx));
268 | }
269 |
270 | void MD4(const void *data, unsigned long size, unsigned char *result) {
271 | MD4_CTX ctx;
272 | MD4_Init(&ctx);
273 | MD4_Update(&ctx, data, size);
274 | MD4_Final(result, &ctx);
275 | }
276 |
277 | #endif
278 |
--------------------------------------------------------------------------------
/Login/dogcom/md4.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
3 | * MD4 Message-Digest Algorithm (RFC 1320).
4 | *
5 | * Homepage:
6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md4
7 | *
8 | * Author:
9 | * Alexander Peslyak, better known as Solar Designer
10 | *
11 | * This software was written by Alexander Peslyak in 2001. No copyright is
12 | * claimed, and the software is hereby placed in the public domain.
13 | * In case this attempt to disclaim copyright and place the software in the
14 | * public domain is deemed null and void, then the software is
15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
16 | * general public under the following terms:
17 | *
18 | * Redistribution and use in source and binary forms, with or without
19 | * modification, are permitted.
20 | *
21 | * There's ABSOLUTELY NO WARRANTY, express or implied.
22 | *
23 | * See md4.c for more information.
24 | */
25 |
26 | #ifdef HAVE_OPENSSL
27 | #include
28 | #elif !defined(_MD4_H)
29 | #define _MD4_H
30 |
31 | /* Any 32-bit or wider unsigned integer data type will do */
32 | typedef unsigned int MD4_u32plus;
33 |
34 | typedef struct {
35 | MD4_u32plus lo, hi;
36 | MD4_u32plus a, b, c, d;
37 | unsigned char buffer[64];
38 | MD4_u32plus block[16];
39 | } MD4_CTX;
40 |
41 | extern void MD4_Init(MD4_CTX *ctx);
42 | extern void MD4_Update(MD4_CTX *ctx, const void *data, unsigned long size);
43 | extern void MD4_Final(unsigned char *result, MD4_CTX *ctx);
44 |
45 | void MD4(const void *data, unsigned long size, unsigned char *result);
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/Login/dogcom/md5.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
3 | * MD5 Message-Digest Algorithm (RFC 1321).
4 | *
5 | * Homepage:
6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
7 | *
8 | * Author:
9 | * Alexander Peslyak, better known as Solar Designer
10 | *
11 | * This software was written by Alexander Peslyak in 2001. No copyright is
12 | * claimed, and the software is hereby placed in the public domain.
13 | * In case this attempt to disclaim copyright and place the software in the
14 | * public domain is deemed null and void, then the software is
15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
16 | * general public under the following terms:
17 | *
18 | * Redistribution and use in source and binary forms, with or without
19 | * modification, are permitted.
20 | *
21 | * There's ABSOLUTELY NO WARRANTY, express or implied.
22 | *
23 | * (This is a heavily cut-down "BSD license".)
24 | *
25 | * This differs from Colin Plumb's older public domain implementation in that
26 | * no exactly 32-bit integer data type is required (any 32-bit or wider
27 | * unsigned integer data type will do), there's no compile-time endianness
28 | * configuration, and the function prototypes match OpenSSL's. No code from
29 | * Colin Plumb's implementation has been reused; this comment merely compares
30 | * the properties of the two independent implementations.
31 | *
32 | * The primary goals of this implementation are portability and ease of use.
33 | * It is meant to be fast, but not as fast as possible. Some known
34 | * optimizations are not included to reduce source code size and avoid
35 | * compile-time configuration.
36 | */
37 |
38 | #ifndef HAVE_OPENSSL
39 |
40 | #include
41 |
42 | #include "md5.h"
43 |
44 | /*
45 | * The basic MD5 functions.
46 | *
47 | * F and G are optimized compared to their RFC 1321 definitions for
48 | * architectures that lack an AND-NOT instruction, just like in Colin Plumb's
49 | * implementation.
50 | */
51 | #define F(x, y, z) ((z) ^ ((x) & ((y) ^ (z))))
52 | #define G(x, y, z) ((y) ^ ((z) & ((x) ^ (y))))
53 | #define H(x, y, z) (((x) ^ (y)) ^ (z))
54 | #define H2(x, y, z) ((x) ^ ((y) ^ (z)))
55 | #define I(x, y, z) ((y) ^ ((x) | ~(z)))
56 |
57 | /*
58 | * The MD5 transformation for all four rounds.
59 | */
60 | #define STEP(f, a, b, c, d, x, t, s) \
61 | (a) += f((b), (c), (d)) + (x) + (t); \
62 | (a) = (((a) << (s)) | (((a) & 0xffffffff) >> (32 - (s)))); \
63 | (a) += (b);
64 |
65 | /*
66 | * SET reads 4 input bytes in little-endian byte order and stores them in a
67 | * properly aligned word in host byte order.
68 | *
69 | * The check for little-endian architectures that tolerate unaligned memory
70 | * accesses is just an optimization. Nothing will break if it fails to detect
71 | * a suitable architecture.
72 | *
73 | * Unfortunately, this optimization may be a C strict aliasing rules violation
74 | * if the caller's data buffer has effective type that cannot be aliased by
75 | * MD5_u32plus. In practice, this problem may occur if these MD5 routines are
76 | * inlined into a calling function, or with future and dangerously advanced
77 | * link-time optimizations. For the time being, keeping these MD5 routines in
78 | * their own translation unit avoids the problem.
79 | */
80 | #if defined(__i386__) || defined(__x86_64__) || defined(__vax__)
81 | #define SET(n) \
82 | (*(MD5_u32plus *)&ptr[(n) * 4])
83 | #define GET(n) \
84 | SET(n)
85 | #else
86 | #define SET(n) \
87 | (ctx->block[(n)] = \
88 | (MD5_u32plus)ptr[(n) * 4] | \
89 | ((MD5_u32plus)ptr[(n) * 4 + 1] << 8) | \
90 | ((MD5_u32plus)ptr[(n) * 4 + 2] << 16) | \
91 | ((MD5_u32plus)ptr[(n) * 4 + 3] << 24))
92 | #define GET(n) \
93 | (ctx->block[(n)])
94 | #endif
95 |
96 | /*
97 | * This processes one or more 64-byte data blocks, but does NOT update the bit
98 | * counters. There are no alignment requirements.
99 | */
100 | static const void *body(MD5_CTX *ctx, const void *data, unsigned long size)
101 | {
102 | const unsigned char *ptr;
103 | MD5_u32plus a, b, c, d;
104 | MD5_u32plus saved_a, saved_b, saved_c, saved_d;
105 |
106 | ptr = (const unsigned char *)data;
107 |
108 | a = ctx->a;
109 | b = ctx->b;
110 | c = ctx->c;
111 | d = ctx->d;
112 |
113 | do {
114 | saved_a = a;
115 | saved_b = b;
116 | saved_c = c;
117 | saved_d = d;
118 |
119 | /* Round 1 */
120 | STEP(F, a, b, c, d, SET(0), 0xd76aa478, 7)
121 | STEP(F, d, a, b, c, SET(1), 0xe8c7b756, 12)
122 | STEP(F, c, d, a, b, SET(2), 0x242070db, 17)
123 | STEP(F, b, c, d, a, SET(3), 0xc1bdceee, 22)
124 | STEP(F, a, b, c, d, SET(4), 0xf57c0faf, 7)
125 | STEP(F, d, a, b, c, SET(5), 0x4787c62a, 12)
126 | STEP(F, c, d, a, b, SET(6), 0xa8304613, 17)
127 | STEP(F, b, c, d, a, SET(7), 0xfd469501, 22)
128 | STEP(F, a, b, c, d, SET(8), 0x698098d8, 7)
129 | STEP(F, d, a, b, c, SET(9), 0x8b44f7af, 12)
130 | STEP(F, c, d, a, b, SET(10), 0xffff5bb1, 17)
131 | STEP(F, b, c, d, a, SET(11), 0x895cd7be, 22)
132 | STEP(F, a, b, c, d, SET(12), 0x6b901122, 7)
133 | STEP(F, d, a, b, c, SET(13), 0xfd987193, 12)
134 | STEP(F, c, d, a, b, SET(14), 0xa679438e, 17)
135 | STEP(F, b, c, d, a, SET(15), 0x49b40821, 22)
136 |
137 | /* Round 2 */
138 | STEP(G, a, b, c, d, GET(1), 0xf61e2562, 5)
139 | STEP(G, d, a, b, c, GET(6), 0xc040b340, 9)
140 | STEP(G, c, d, a, b, GET(11), 0x265e5a51, 14)
141 | STEP(G, b, c, d, a, GET(0), 0xe9b6c7aa, 20)
142 | STEP(G, a, b, c, d, GET(5), 0xd62f105d, 5)
143 | STEP(G, d, a, b, c, GET(10), 0x02441453, 9)
144 | STEP(G, c, d, a, b, GET(15), 0xd8a1e681, 14)
145 | STEP(G, b, c, d, a, GET(4), 0xe7d3fbc8, 20)
146 | STEP(G, a, b, c, d, GET(9), 0x21e1cde6, 5)
147 | STEP(G, d, a, b, c, GET(14), 0xc33707d6, 9)
148 | STEP(G, c, d, a, b, GET(3), 0xf4d50d87, 14)
149 | STEP(G, b, c, d, a, GET(8), 0x455a14ed, 20)
150 | STEP(G, a, b, c, d, GET(13), 0xa9e3e905, 5)
151 | STEP(G, d, a, b, c, GET(2), 0xfcefa3f8, 9)
152 | STEP(G, c, d, a, b, GET(7), 0x676f02d9, 14)
153 | STEP(G, b, c, d, a, GET(12), 0x8d2a4c8a, 20)
154 |
155 | /* Round 3 */
156 | STEP(H, a, b, c, d, GET(5), 0xfffa3942, 4)
157 | STEP(H2, d, a, b, c, GET(8), 0x8771f681, 11)
158 | STEP(H, c, d, a, b, GET(11), 0x6d9d6122, 16)
159 | STEP(H2, b, c, d, a, GET(14), 0xfde5380c, 23)
160 | STEP(H, a, b, c, d, GET(1), 0xa4beea44, 4)
161 | STEP(H2, d, a, b, c, GET(4), 0x4bdecfa9, 11)
162 | STEP(H, c, d, a, b, GET(7), 0xf6bb4b60, 16)
163 | STEP(H2, b, c, d, a, GET(10), 0xbebfbc70, 23)
164 | STEP(H, a, b, c, d, GET(13), 0x289b7ec6, 4)
165 | STEP(H2, d, a, b, c, GET(0), 0xeaa127fa, 11)
166 | STEP(H, c, d, a, b, GET(3), 0xd4ef3085, 16)
167 | STEP(H2, b, c, d, a, GET(6), 0x04881d05, 23)
168 | STEP(H, a, b, c, d, GET(9), 0xd9d4d039, 4)
169 | STEP(H2, d, a, b, c, GET(12), 0xe6db99e5, 11)
170 | STEP(H, c, d, a, b, GET(15), 0x1fa27cf8, 16)
171 | STEP(H2, b, c, d, a, GET(2), 0xc4ac5665, 23)
172 |
173 | /* Round 4 */
174 | STEP(I, a, b, c, d, GET(0), 0xf4292244, 6)
175 | STEP(I, d, a, b, c, GET(7), 0x432aff97, 10)
176 | STEP(I, c, d, a, b, GET(14), 0xab9423a7, 15)
177 | STEP(I, b, c, d, a, GET(5), 0xfc93a039, 21)
178 | STEP(I, a, b, c, d, GET(12), 0x655b59c3, 6)
179 | STEP(I, d, a, b, c, GET(3), 0x8f0ccc92, 10)
180 | STEP(I, c, d, a, b, GET(10), 0xffeff47d, 15)
181 | STEP(I, b, c, d, a, GET(1), 0x85845dd1, 21)
182 | STEP(I, a, b, c, d, GET(8), 0x6fa87e4f, 6)
183 | STEP(I, d, a, b, c, GET(15), 0xfe2ce6e0, 10)
184 | STEP(I, c, d, a, b, GET(6), 0xa3014314, 15)
185 | STEP(I, b, c, d, a, GET(13), 0x4e0811a1, 21)
186 | STEP(I, a, b, c, d, GET(4), 0xf7537e82, 6)
187 | STEP(I, d, a, b, c, GET(11), 0xbd3af235, 10)
188 | STEP(I, c, d, a, b, GET(2), 0x2ad7d2bb, 15)
189 | STEP(I, b, c, d, a, GET(9), 0xeb86d391, 21)
190 |
191 | a += saved_a;
192 | b += saved_b;
193 | c += saved_c;
194 | d += saved_d;
195 |
196 | ptr += 64;
197 | } while (size -= 64);
198 |
199 | ctx->a = a;
200 | ctx->b = b;
201 | ctx->c = c;
202 | ctx->d = d;
203 |
204 | return ptr;
205 | }
206 |
207 | void MD5_Init(MD5_CTX *ctx)
208 | {
209 | ctx->a = 0x67452301;
210 | ctx->b = 0xefcdab89;
211 | ctx->c = 0x98badcfe;
212 | ctx->d = 0x10325476;
213 |
214 | ctx->lo = 0;
215 | ctx->hi = 0;
216 | }
217 |
218 | void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size)
219 | {
220 | MD5_u32plus saved_lo;
221 | unsigned long used, available;
222 |
223 | saved_lo = ctx->lo;
224 | if ((ctx->lo = (saved_lo + size) & 0x1fffffff) < saved_lo)
225 | ctx->hi++;
226 | ctx->hi += size >> 29;
227 |
228 | used = saved_lo & 0x3f;
229 |
230 | if (used) {
231 | available = 64 - used;
232 |
233 | if (size < available) {
234 | memcpy(&ctx->buffer[used], data, size);
235 | return;
236 | }
237 |
238 | memcpy(&ctx->buffer[used], data, available);
239 | data = (const unsigned char *)data + available;
240 | size -= available;
241 | body(ctx, ctx->buffer, 64);
242 | }
243 |
244 | if (size >= 64) {
245 | data = body(ctx, data, size & ~(unsigned long)0x3f);
246 | size &= 0x3f;
247 | }
248 |
249 | memcpy(ctx->buffer, data, size);
250 | }
251 |
252 | #define OUT(dst, src) \
253 | (dst)[0] = (unsigned char)(src); \
254 | (dst)[1] = (unsigned char)((src) >> 8); \
255 | (dst)[2] = (unsigned char)((src) >> 16); \
256 | (dst)[3] = (unsigned char)((src) >> 24);
257 |
258 | void MD5_Final(unsigned char *result, MD5_CTX *ctx)
259 | {
260 | unsigned long used, available;
261 |
262 | used = ctx->lo & 0x3f;
263 |
264 | ctx->buffer[used++] = 0x80;
265 |
266 | available = 64 - used;
267 |
268 | if (available < 8) {
269 | memset(&ctx->buffer[used], 0, available);
270 | body(ctx, ctx->buffer, 64);
271 | used = 0;
272 | available = 64;
273 | }
274 |
275 | memset(&ctx->buffer[used], 0, available - 8);
276 |
277 | ctx->lo <<= 3;
278 | OUT(&ctx->buffer[56], ctx->lo)
279 | OUT(&ctx->buffer[60], ctx->hi)
280 |
281 | body(ctx, ctx->buffer, 64);
282 |
283 | OUT(&result[0], ctx->a)
284 | OUT(&result[4], ctx->b)
285 | OUT(&result[8], ctx->c)
286 | OUT(&result[12], ctx->d)
287 |
288 | memset(ctx, 0, sizeof(*ctx));
289 | }
290 |
291 | void MD5(const void *data, unsigned long size, unsigned char *result) {
292 | MD5_CTX ctx;
293 | MD5_Init(&ctx);
294 | MD5_Update(&ctx, data, size);
295 | MD5_Final(result, &ctx);
296 | }
297 |
298 | #endif
299 |
--------------------------------------------------------------------------------
/Login/dogcom/md5.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
3 | * MD5 Message-Digest Algorithm (RFC 1321).
4 | *
5 | * Homepage:
6 | * http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
7 | *
8 | * Author:
9 | * Alexander Peslyak, better known as Solar Designer
10 | *
11 | * This software was written by Alexander Peslyak in 2001. No copyright is
12 | * claimed, and the software is hereby placed in the public domain.
13 | * In case this attempt to disclaim copyright and place the software in the
14 | * public domain is deemed null and void, then the software is
15 | * Copyright (c) 2001 Alexander Peslyak and it is hereby released to the
16 | * general public under the following terms:
17 | *
18 | * Redistribution and use in source and binary forms, with or without
19 | * modification, are permitted.
20 | *
21 | * There's ABSOLUTELY NO WARRANTY, express or implied.
22 | *
23 | * See md5.c for more information.
24 | */
25 |
26 | #ifdef HAVE_OPENSSL
27 | #include
28 | #elif !defined(_MD5_H)
29 | #define _MD5_H
30 |
31 | /* Any 32-bit or wider unsigned integer data type will do */
32 | typedef unsigned int MD5_u32plus;
33 |
34 | typedef struct {
35 | MD5_u32plus lo, hi;
36 | MD5_u32plus a, b, c, d;
37 | unsigned char buffer[64];
38 | MD5_u32plus block[16];
39 | } MD5_CTX;
40 |
41 | extern void MD5_Init(MD5_CTX *ctx);
42 | extern void MD5_Update(MD5_CTX *ctx, const void *data, unsigned long size);
43 | extern void MD5_Final(unsigned char *result, MD5_CTX *ctx);
44 |
45 | void MD5(const void *data, unsigned long size, unsigned char *result);
46 |
47 | #endif
48 |
--------------------------------------------------------------------------------
/Login/dogcom/sha1.cpp:
--------------------------------------------------------------------------------
1 |
2 | /* from valgrind tests */
3 |
4 | /* ================ sha1.c ================ */
5 | /*
6 | SHA-1 in C
7 | By Steve Reid
8 | 100% Public Domain
9 |
10 | Test Vectors (from FIPS PUB 180-1)
11 | "abc"
12 | A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D
13 | "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"
14 | 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1
15 | A million repetitions of "a"
16 | 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F
17 | */
18 |
19 | /* #define LITTLE_ENDIAN * This should be #define'd already, if true. */
20 | /* #define SHA1HANDSOFF * Copies data before messing with it. */
21 |
22 | #define SHA1HANDSOFF
23 |
24 | #include
25 | #include
26 | #include
27 | #include "sha1.h"
28 |
29 | #define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
30 |
31 | /* blk0() and blk() perform the initial expand. */
32 | /* I got the idea of expanding during the round function from SSLeay */
33 | #if BYTE_ORDER == LITTLE_ENDIAN
34 | #define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \
35 | |(rol(block->l[i],8)&0x00FF00FF))
36 | #elif BYTE_ORDER == BIG_ENDIAN
37 | #define blk0(i) block->l[i]
38 | #else
39 | #error "Endianness not defined!"
40 | #endif
41 | #define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \
42 | ^block->l[(i+2)&15]^block->l[i&15],1))
43 |
44 | /* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */
45 | #define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30);
46 | #define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30);
47 | #define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30);
48 | #define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30);
49 | #define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30);
50 |
51 |
52 | /* Hash a single 512-bit block. This is the core of the algorithm. */
53 |
54 | void SHA1Transform(uint32_t state[5], const unsigned char buffer[64])
55 | {
56 | uint32_t a, b, c, d, e;
57 | typedef union {
58 | unsigned char c[64];
59 | uint32_t l[16];
60 | } CHAR64LONG16;
61 | #ifdef SHA1HANDSOFF
62 | CHAR64LONG16 block[1]; /* use array to appear as a pointer */
63 | memcpy(block, buffer, 64);
64 | #else
65 | /* The following had better never be used because it causes the
66 | * pointer-to-const buffer to be cast into a pointer to non-const.
67 | * And the result is written through. I threw a "const" in, hoping
68 | * this will cause a diagnostic.
69 | */
70 | CHAR64LONG16* block = (const CHAR64LONG16*)buffer;
71 | #endif
72 | /* Copy context->state[] to working vars */
73 | a = state[0];
74 | b = state[1];
75 | c = state[2];
76 | d = state[3];
77 | e = state[4];
78 | /* 4 rounds of 20 operations each. Loop unrolled. */
79 | R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3);
80 | R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7);
81 | R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11);
82 | R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15);
83 | R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19);
84 | R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23);
85 | R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27);
86 | R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31);
87 | R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35);
88 | R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39);
89 | R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43);
90 | R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47);
91 | R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51);
92 | R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55);
93 | R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59);
94 | R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63);
95 | R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67);
96 | R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71);
97 | R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75);
98 | R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79);
99 | /* Add the working vars back into context.state[] */
100 | state[0] += a;
101 | state[1] += b;
102 | state[2] += c;
103 | state[3] += d;
104 | state[4] += e;
105 | /* Wipe variables */
106 | a = b = c = d = e = 0;
107 | #ifdef SHA1HANDSOFF
108 | memset(block, '\0', sizeof(block));
109 | #endif
110 | }
111 |
112 |
113 | /* SHA1Init - Initialize new context */
114 |
115 | void SHA1Init(SHA1_CTX* context)
116 | {
117 | /* SHA1 initialization constants */
118 | context->state[0] = 0x67452301;
119 | context->state[1] = 0xEFCDAB89;
120 | context->state[2] = 0x98BADCFE;
121 | context->state[3] = 0x10325476;
122 | context->state[4] = 0xC3D2E1F0;
123 | context->count[0] = context->count[1] = 0;
124 | }
125 |
126 |
127 | /* Run your data through this. */
128 |
129 | void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len)
130 | {
131 | uint32_t i, j;
132 |
133 | j = context->count[0];
134 | if ((context->count[0] += len << 3) < j)
135 | context->count[1]++;
136 | context->count[1] += (len>>29);
137 | j = (j >> 3) & 63;
138 | if ((j + len) > 63) {
139 | memcpy(&context->buffer[j], data, (i = 64-j));
140 | SHA1Transform(context->state, context->buffer);
141 | for ( ; i + 63 < len; i += 64) {
142 | SHA1Transform(context->state, &data[i]);
143 | }
144 | j = 0;
145 | }
146 | else i = 0;
147 | memcpy(&context->buffer[j], &data[i], len - i);
148 | }
149 |
150 |
151 | /* Add padding and return the message digest. */
152 |
153 | void SHA1Final(unsigned char digest[20], SHA1_CTX* context)
154 | {
155 | unsigned i;
156 | unsigned char finalcount[8];
157 | unsigned char c;
158 |
159 | #if 0 /* untested "improvement" by DHR */
160 | /* Convert context->count to a sequence of bytes
161 | * in finalcount. Second element first, but
162 | * big-endian order within element.
163 | * But we do it all backwards.
164 | */
165 | unsigned char *fcp = &finalcount[8];
166 |
167 | for (i = 0; i < 2; i++)
168 | {
169 | uint32_t t = context->count[i];
170 | int j;
171 |
172 | for (j = 0; j < 4; t >>= 8, j++)
173 | *--fcp = (unsigned char) t;
174 | }
175 | #else
176 | for (i = 0; i < 8; i++) {
177 | finalcount[i] = (unsigned char)((context->count[(i >= 4 ? 0 : 1)]
178 | >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */
179 | }
180 | #endif
181 | c = 0200;
182 | SHA1Update(context, &c, 1);
183 | while ((context->count[0] & 504) != 448) {
184 | c = 0000;
185 | SHA1Update(context, &c, 1);
186 | }
187 | SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */
188 | for (i = 0; i < 20; i++) {
189 | digest[i] = (unsigned char)
190 | ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255);
191 | }
192 | /* Wipe variables */
193 | memset(context, '\0', sizeof(*context));
194 | memset(&finalcount, '\0', sizeof(finalcount));
195 | }
196 | /* ================ end of sha1.c ================ */
197 |
198 | void SHA1(const unsigned char* data, uint32_t len, unsigned char digest[20]) {
199 | SHA1_CTX ctx;
200 | SHA1Init(&ctx);
201 | SHA1Update(&ctx, data, len);
202 | SHA1Final(digest, &ctx);
203 | }
--------------------------------------------------------------------------------
/Login/dogcom/sha1.h:
--------------------------------------------------------------------------------
1 | #ifndef SHA1_H
2 | #define SHA1_H
3 | /* ================ sha1.h ================ */
4 | /*
5 | SHA-1 in C
6 | By Steve Reid
7 | 100% Public Domain
8 | */
9 | #include
10 |
11 | typedef struct {
12 | uint32_t state[5];
13 | uint32_t count[2];
14 | unsigned char buffer[64];
15 | } SHA1_CTX;
16 |
17 | void SHA1Transform(uint32_t state[5], const unsigned char buffer[64]);
18 | void SHA1Init(SHA1_CTX* context);
19 | void SHA1Update(SHA1_CTX* context, const unsigned char* data, uint32_t len);
20 | void SHA1Final(unsigned char digest[20], SHA1_CTX* context);
21 |
22 | void SHA1(const unsigned char* data, uint32_t len, unsigned char digest[20]);
23 |
24 | #endif
25 |
--------------------------------------------------------------------------------
/Login/resource.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/code4lala/dr-jlu-win32/6568d479300575215adee5813801726aa47f19d3/Login/resource.h
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # dr-jlu-win32
2 | 吉大windows带用户界面版Dr校园网登录客户端
3 |
4 | 下载地址 https://github.com/code4lala/dr-jlu-win32/releases
5 |
6 | 需要开机自启的同学请复制一份快捷方式到
7 |
8 | C:\Users\\<用户名\>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\
9 |
10 | 目录即可
11 |
12 | 特别感谢 https://github.com/mchome/dogcom 网络通信部分代码复制粘贴过来的
13 |
14 | 感谢 https://github.com/drcoms/jlu-drcom-client/tree/master/jlu-drcom-java
15 |
--------------------------------------------------------------------------------