Repository: WXjzcccc/ForensicsTool Branch: go-version Commit: 5ed566613ba1 Files: 105 Total size: 360.2 KB Directory structure: gitextract_dz6g7xju/ ├── .gitignore ├── LICENSE ├── README.md ├── analyzers/ │ ├── database/ │ │ └── decryptDatabaseAnalyzer.go │ ├── extractor/ │ │ ├── infoExtractAnalyzer.go │ │ └── tool/ │ │ ├── dbeaverTool.go │ │ ├── finalshellTool.go │ │ ├── hawkTool.go │ │ ├── javaRandom.go │ │ ├── metamaskTool.go │ │ ├── mobaTool.go │ │ ├── navicatTool.go │ │ └── xshellTool.go │ ├── passwdCalc/ │ │ └── passwdCalcAnalyzer.go │ ├── reader/ │ │ ├── fileReader.go │ │ └── readers/ │ │ ├── leveldbReader.go │ │ └── mmkvReader.go │ └── winreg/ │ ├── structs/ │ │ ├── domainAccountF.go │ │ ├── domainAccountV.go │ │ ├── nthash.go │ │ ├── userF.go │ │ └── userV.go │ └── winRegAnalyzer.go ├── app.go ├── build/ │ ├── README.md │ ├── darwin/ │ │ ├── Info.dev.plist │ │ └── Info.plist │ └── windows/ │ ├── info.json │ ├── installer/ │ │ ├── project.nsi │ │ └── wails_tools.nsh │ └── wails.exe.manifest ├── frontend/ │ ├── .gitignore │ ├── README.md │ ├── components.d.ts │ ├── env.d.ts │ ├── index.html │ ├── package.json │ ├── package.json.md5 │ ├── pnpm-workspace.yaml │ ├── src/ │ │ ├── App.vue │ │ ├── assets/ │ │ │ └── styles/ │ │ │ └── main.css │ │ ├── components/ │ │ │ ├── AppConfig.vue │ │ │ ├── AppFooter.vue │ │ │ ├── AppSidebar.vue │ │ │ ├── AppTopbar.vue │ │ │ └── Empty.vue │ │ ├── composables/ │ │ │ ├── useLayout.js │ │ │ └── useTableHeight.js │ │ ├── main.ts │ │ ├── router/ │ │ │ └── index.ts │ │ ├── store/ │ │ │ ├── index.ts │ │ │ └── modules/ │ │ │ └── page.ts │ │ ├── utils.js │ │ └── views/ │ │ ├── About.vue │ │ ├── BruteForce.vue │ │ ├── DataExtraction.vue │ │ ├── DatabaseDecrypt.vue │ │ ├── FileReader.vue │ │ ├── IPLocation.vue │ │ ├── KeyCalculation.vue │ │ ├── RegistryAnalysis.vue │ │ └── TimestampParser.vue │ ├── tsconfig.json │ ├── tsconfig.node.json │ ├── vite.config.ts │ └── wailsjs/ │ ├── go/ │ │ ├── cracker/ │ │ │ ├── ForensicsCracker.d.ts │ │ │ └── ForensicsCracker.js │ │ ├── database/ │ │ │ ├── DecryptDatabase.d.ts │ │ │ └── DecryptDatabase.js │ │ ├── extractor/ │ │ │ ├── InfoExtractor.d.ts │ │ │ └── InfoExtractor.js │ │ ├── ip/ │ │ │ ├── IP.d.ts │ │ │ └── IP.js │ │ ├── main/ │ │ │ ├── App.d.ts │ │ │ └── App.js │ │ ├── models.ts │ │ ├── passwdCalc/ │ │ │ ├── PasswdCalc.d.ts │ │ │ └── PasswdCalc.js │ │ ├── reader/ │ │ │ ├── FileReader.d.ts │ │ │ └── FileReader.js │ │ ├── timestamp/ │ │ │ ├── TimeStampParser.d.ts │ │ │ └── TimeStampParser.js │ │ └── winreg/ │ │ ├── Reg.d.ts │ │ └── Reg.js │ └── runtime/ │ ├── package.json │ ├── runtime.d.ts │ └── runtime.js ├── go.mod ├── go.sum ├── main.go ├── scripts/ │ ├── build-macos-arm.sh │ ├── build-macos-intel.sh │ ├── build-macos.sh │ ├── build-windows.sh │ ├── build.sh │ └── install-wails-cli.sh ├── tools/ │ ├── cracker/ │ │ ├── airdrop.go │ │ ├── cracker.go │ │ └── wxuin.go │ ├── ip/ │ │ └── cz.go │ └── timestamp/ │ └── time.go ├── utils/ │ ├── hash.go │ ├── timestamp.go │ └── utf16.go └── wails.json ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ frontend/node_modules frontend/dist build/bin .idea *_test.go logs *.log .trae *.ipdb AGENTS.md ================================================ FILE: LICENSE ================================================ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . ================================================ FILE: README.md ================================================ # 说明 这是ForensicsTool的Go版本,使用`Wails V2`进行了重构,使用方式和之前一致,有需要的可以自己编译,`wails build`即可 包含安卓端(SQLite数据库等)、windows端(注册表、远程管理工具等)、时间戳、暴力破解等功能。 ![alt text](imgs/image.png) 菜单栏现在可以收缩,小提示现在从右侧弹出 ![alt text](imgs/image-1.png) 为了完成这个项目,fork并修改了几个库,用于适配分析 * https://github.com/WXjzcccc/registry * https://github.com/WXjzcccc/go-sqlcipher * https://github.com/WXjzcccc/go-mmkv # 声明 本工具仅用于电子数据取证的学习与研究,请勿用于非法用途,否则后果自负。 ================================================ FILE: analyzers/database/decryptDatabaseAnalyzer.go ================================================ package database import ( "ForensicsTool/utils" "bytes" "context" "database/sql" "encoding/hex" "fmt" "io" "net/url" "os" "path/filepath" "strings" _ "github.com/WXjzcccc/go-sqlcipher" "github.com/deatil/go-cryptobin/cryptobin/crypto" ) const ( EnMicroMsgDecryptPragma = "_pragma_cipher_compatibility=1" FTSIndexDecryptPragma = "_pragma_kdf_iter=64000&_pragma_cipher_kdf_algorithm=PBKDF2_HMAC_SHA1&_pragma_cipher_hmac_algorithm=HMAC_SHA1" SQLCipher4Pragma = "" SQLCipher3Pragma = "_pragma_cipher_page_size=1024&_pragma_kdf_iter=64000&_pragma_cipher_kdf_algorithm=PBKDF2_HMAC_SHA1&_pragma_cipher_hmac_algorithm=HMAC_SHA1" WcdbPragma = "_pragma_cipher_page_size=4096&_pragma_kdf_iter=64000&_pragma_cipher_kdf_algorithm=PBKDF2_HMAC_SHA1&_pragma_cipher_hmac_algorithm=HMAC_SHA1" NtqqPragma = "_pragma_cipher_page_size=4096&_pragma_kdf_iter=4000&_pragma_cipher_kdf_algorithm=PBKDF2_HMAC_SHA512" FTSIndexDB = 0 SQLCipher4DB = 1 SQLCipher3DB = 2 WCdbDB = 3 ) type DecryptDatabase struct { ctx context.Context } func NewDecryptDatabase() *DecryptDatabase { return &DecryptDatabase{} } type DecryptResult struct { SavePath string `json:"save_path"` Wxid string `json:"wxid"` Err string `json:"err"` } func (d *DecryptDatabase) InitCtx(ctx context.Context) { d.ctx = ctx } func moveElementToFirst(slice []string, element string) []string { idx := 0 for i, v := range slice { if v == element { idx = i break } } // 创建一个新的切片,长度为原切片长度 newSlice := make([]string, len(slice)) // 将目标元素放到新切片的第一个位置 newSlice[0] = slice[idx] copy(newSlice[1:idx+1], slice[0:idx]) copy(newSlice[1+idx:], slice[idx+1:]) return newSlice } func decryptSql(dbPath string) (string, string) { dbName := "a" + strings.Replace(filepath.Base(dbPath), ".", "", -1) //数字开头的变量不被接受 savePath := dbPath + "_dec.db" return fmt.Sprintf("ATTACH DATABASE '%s' AS '%s_dec' KEY '';SELECT sqlcipher_export('%s_dec');DETACH DATABASE '%s_dec';", savePath, dbName, dbName, dbName), savePath } func (d *DecryptDatabase) DecryptEnMicroMsg(dbPath, password string) *DecryptResult { /* @param dbPath : 数据库路径 @param password : 解密密码 @return : 解密后的数据库路径、wxid、error */ fileInfo, err := os.Stat(dbPath) if err != nil { return &DecryptResult{"", "", err.Error()} } if fileInfo.IsDir() { return &DecryptResult{"", "", fmt.Sprintf("%s is not a file", dbPath)} } pwd := url.QueryEscape(password) dbName := fmt.Sprintf("%s?_key=%s&%s", dbPath, pwd, EnMicroMsgDecryptPragma) db, err := sql.Open("sqlite3", dbName) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("打开%s失败:%v", dbPath, err)} } defer db.Close() // 获取wxid selectSql := "select value from userinfo where id = 2;" cur, err := db.Prepare(selectSql) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("准备SQL【%s】失败:%v", selectSql, err)} } var wxid string err = cur.QueryRow().Scan(&wxid) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("读取wxid失败: %v", err)} } decCmd, savePath := decryptSql(dbPath) _, err = db.Exec(decCmd) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("解密数据库失败:%v", err)} } return &DecryptResult{savePath, wxid, ""} } func (d *DecryptDatabase) decryptNormal(dbPath, password string, dbType int) *DecryptResult { /* @param dbPath : 数据库路径 @param password : 解密密码 @return : 解密后的数据库路径、wxid(恒定为空字符串)、error */ fileInfo, err := os.Stat(dbPath) if err != nil { return &DecryptResult{"", "", err.Error()} } if fileInfo.IsDir() { return &DecryptResult{"", "", fmt.Sprintf("%s is not a file", dbPath)} } var dbName string pwd := url.QueryEscape(password) switch dbType { case FTSIndexDB: dbName = fmt.Sprintf("%s?_key=%s&%s", dbPath, pwd, FTSIndexDecryptPragma) case SQLCipher4DB: dbName = fmt.Sprintf("%s?_key=%s", dbPath, pwd) case SQLCipher3DB: dbName = fmt.Sprintf("%s?_key=%s&%s", dbPath, pwd, SQLCipher3Pragma) case WCdbDB: dbName = fmt.Sprintf("%s?_key=%s&%s", dbPath, pwd, WcdbPragma) default: return &DecryptResult{"", "", fmt.Sprintf("不支持的数据库类型:%d", dbType)} } db, err := sql.Open("sqlite3", dbName) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("打开%s失败:%v", dbPath, err)} } defer db.Close() decCmd, savePath := decryptSql(dbPath) _, err = db.Exec(decCmd) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("解密数据库失败:%v", err)} } return &DecryptResult{savePath, "", ""} } func (d *DecryptDatabase) DecryptFTSIndexDB(dbPath, password string) *DecryptResult { return d.decryptNormal(dbPath, password, FTSIndexDB) } func (d *DecryptDatabase) DecryptSQLCipher4DB(dbPath, password string) *DecryptResult { return d.decryptNormal(dbPath, password, SQLCipher4DB) } func (d *DecryptDatabase) DecryptSQLCipher3DB(dbPath, password string) *DecryptResult { return d.decryptNormal(dbPath, password, SQLCipher3DB) } func (d *DecryptDatabase) DecryptWCDB(dbPath, password string) *DecryptResult { return d.decryptNormal(dbPath, password, WCdbDB) } func (d *DecryptDatabase) DecryptNtqqDB(dbPath, password string) *DecryptResult { /* @param dbPath : 数据库路径 @param password : 解密密码 @return : 解密后的数据库路径、wxid(恒定为空字符串)、error */ fileInfo, err := os.Stat(dbPath) if err != nil { return &DecryptResult{"", "", err.Error()} } if fileInfo.IsDir() { return &DecryptResult{"", "", fmt.Sprintf("%s is not a file", dbPath)} } pathBak := dbPath + ".bak" fr, err := os.OpenFile(dbPath, os.O_RDWR, 0666) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("打开文件%s失败:%v", dbPath, err)} } defer fr.Close() _, err = os.Stat(pathBak) // 读取源文件内容 data, err := os.ReadFile(dbPath) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("读取文件%s失败:%v", dbPath, err)} } if os.IsNotExist(err) { // 备份不存在就写备份,否则不再备份,以免原始数据被修改 fw, err := os.Create(pathBak) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("创建文件%s失败:%v", pathBak, err)} } defer fw.Close() // 写入备份文件 _, err = fw.Write(data) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("写入文件%s失败:%v", pathBak, err)} } } // 提取头部和加密内容 head := data[:1024] encryptedContent := data[1024:] // 查找 salt 的起始和结束位置 saltStart := bytes.Index(head, []byte{0x12, 0x08}) + 2 if saltStart < 2 { return &DecryptResult{"", "", "Salt start not found"} } saltEnd := bytes.Index(head, []byte{0x1a, 0x07}) if saltEnd == -1 { return &DecryptResult{"", "", "Salt end not found"} } salt := string(head[saltStart:saltEnd]) _, err = fr.Seek(0, io.SeekStart) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("Error seeking in source file:%v", err)} } _, err = fr.Write(encryptedContent) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("Error writing in source file:%v", err)} } key := url.QueryEscape(utils.MD5HashHex(utils.MD5HashHex(password) + salt)) methods := []string{"HMAC_SHA1", "HMAC_SHA256", "HMAC_SHA512"} for _, method := range methods { pragma := NtqqPragma + fmt.Sprintf("&_pragma_cipher_hmac_algorithm=%s", method) dbName := fmt.Sprintf("%s?_key=%s&%s", dbPath, key, pragma) db, err := sql.Open("sqlite3", dbName) if err != nil { continue } decCmd, savePath := decryptSql(dbPath) _, err = db.Exec(decCmd) if err != nil { err2 := db.Close() if err2 != nil { continue } continue } err = db.Close() if err != nil { continue } return &DecryptResult{savePath, "", ""} } return &DecryptResult{"", "", "解密数据库失败"} } func (d *DecryptDatabase) DecryptAMapDB(dbPath string) *DecryptResult { /* @param dbPath : 数据库路径 @return : 解密后的数据库路径、wxid(恒定为空字符串)、error */ // 获取文件大小并格式化 fileInfo, err := os.Stat(dbPath) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("获取文件%s状态失败:%v", dbPath, err)} } if fileInfo.IsDir() { return &DecryptResult{"", "", fmt.Sprintf("%s is not a file", dbPath)} } size := fileInfo.Size() / 1024 uintNum := uint32(size) // 创建一个4字节的字节切片 byteSlice := make([]byte, 4) // 将uint32转换为字节切片 byteSlice[0] = byte(uintNum >> 24) byteSlice[1] = byte(uintNum >> 16) byteSlice[2] = byte(uintNum >> 8) byteSlice[3] = byte(uintNum) // 将字节切片转换为hex字符串 sizeHex := hex.EncodeToString(byteSlice) // 固定解密密钥 key := "a4a11bb9ef4b2f4c" // SQLite3固定文件头,16字节 head := "53514C69746520666F726D6174203300" // 输出解密后的文件路径 outPath := strings.Replace(dbPath, "girf_sync.db", "girf_sync_dec.db", -1) data, err := os.ReadFile(dbPath) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("读取文件%s失败:%v", dbPath, err)} } // 获取页大小,读写、缓存等信息,原数据明文,非加密,在第3个8字节数据中给出 prop := hex.EncodeToString(data[16:24]) // AES解密 decData := crypto. FromBytes(data). SetKey(key). Decrypt(). ToBytes() // 在第93-96字节存在第25-28字节的备份数据,拿来即可 magic := hex.EncodeToString(decData[92:96]) + sizeHex // 拼出新的32字节文件头 trueHead, err := hex.DecodeString(head + prop + magic) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("拼接文件头失败:%v", err)} } // 写入新文件 newFileData := append(trueHead, decData[32:]...) err = os.WriteFile(outPath, newFileData, 0644) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("写入文件%s失败:%v", outPath, err)} } return &DecryptResult{outPath, "", ""} } func (d *DecryptDatabase) DecryptDingTalkDB(dbPath, password string) *DecryptResult { /* @param dbPath : 数据库路径 @param password : 解密密码 @return : 解密后的数据库路径、wxid(恒定为空字符串)、error */ fileInfo, err := os.Stat(dbPath) if err != nil { return &DecryptResult{"", "", err.Error()} } if fileInfo.IsDir() { return &DecryptResult{"", "", fmt.Sprintf("%s is not a file", dbPath)} } cpus := []string{"armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64", "mips", "mips64"} device := strings.Split(password, "/") if len(device) != 5 { return &DecryptResult{"", "", "密码组成不正确"} } inCpu := device[1] // 将cpus中与device[1]相同的元素位置移到第一个 newCpus := moveElementToFirst(cpus, inCpu) outPath := strings.Replace(dbPath, ".db", "_dec.db", -1) // 读取文件内容 data, err := os.ReadFile(dbPath) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("读取文件%s失败:%v", dbPath, err)} } sqliteHead := "53514C69746520666F726D6174203300" for _, cpu := range newCpus { device[1] = cpu newDevice := strings.Join(device, "/") key := utils.MD5HashHex(newDevice)[:16] decData := crypto. FromBytes(data). SetKey(key). Decrypt(). ToBytes() if hex.EncodeToString(decData[:16]) == strings.ToLower(sqliteHead) { err = os.WriteFile(outPath, decData, 0644) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("写入文件%s失败: %v", outPath, err)} } return &DecryptResult{outPath, "", ""} } } return &DecryptResult{"", "", "解密数据库失败"} } func (d *DecryptDatabase) DecryptSystemDataSQLite(dbPath, password string) *DecryptResult { /* @param dbPath : 数据库路径 @param password : 解密密码 @return : 解密后的数据库路径、wxid(恒定为空字符串)、error */ fileInfo, err := os.Stat(dbPath) if err != nil { return &DecryptResult{"", "", err.Error()} } if fileInfo.IsDir() { return &DecryptResult{"", "", fmt.Sprintf("%s is not a file", dbPath)} } file, err := os.Open(dbPath) savePath := dbPath + "_dec" decFile, err := os.Create(savePath) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("打开文件%s失败:%v", dbPath, err)} } defer file.Close() defer decFile.Close() // 每1024字节进行解密 buffer := make([]byte, 1024) chunkCount := 0 for { // 读取数据到缓冲区 _, err := file.Read(buffer) if err != nil { if err != io.EOF { return &DecryptResult{"", "", fmt.Sprintf("读取%s失败:%v", dbPath, err)} } break } chunkCount++ key := utils.SHA1Hash(password)[:16] // 计算密钥,sha1的前16个字节 _, err = decFile.Write(crypto.FromBytes(buffer).WithKey(key).RC4().Decrypt().ToBytes()) // 解密,写入数据 if err != nil { return &DecryptResult{"", "", fmt.Sprintf("解密失败:%v", err)} } } data, err := os.ReadFile(savePath) if err != nil { return &DecryptResult{"", "", fmt.Sprintf("打开%s失败:%v", savePath, err)} } if hex.EncodeToString(data[:16]) != hex.EncodeToString([]byte("SQLite format 3\x00")) { // 校验前16个字节 return &DecryptResult{"", "", "解密失败,密钥不正确"} } return &DecryptResult{savePath, "", ""} } ================================================ FILE: analyzers/extractor/infoExtractAnalyzer.go ================================================ package extractor import ( "ForensicsTool/analyzers/extractor/tool" "context" "fmt" "github.com/iancoleman/orderedmap" ) type InfoExtractor struct { ctx context.Context } func NewInfoExtractor() *InfoExtractor { return &InfoExtractor{} } type ExtractResult struct { Data []map[string]string `json:"data"` Err string `json:"err"` } type ExtractMapResult struct { Data *orderedmap.OrderedMap `json:"data"` Err string `json:"err"` } func (p *InfoExtractor) InitCtx(ctx context.Context) { p.ctx = ctx } func (p *InfoExtractor) ExtractXShell(folder, sid string) *ExtractMapResult { /* @param folder: 配置文件目录 @param sid: 用户的用户名+sid @return: 解析结果 */ info, err := tool.AnalyzeXshell(folder, sid) if err != nil { return &ExtractMapResult{nil, fmt.Sprintf("解析失败:%v", err)} } return &ExtractMapResult{info, ""} } func (p *InfoExtractor) ExtractNavicat(refPath string) *ExtractMapResult { /* @param refPath: NTUSER.DAT注册表文件路径 @return: 解析结果 */ info, err := tool.AnalyzeNavicat(refPath) if err != nil { return &ExtractMapResult{nil, fmt.Sprintf("解析失败:%v", err)} } return &ExtractMapResult{info, ""} } func (p *InfoExtractor) ExtractMobaXterm(filePath, masterPwd string) *ExtractMapResult { /* @param filePath: 注册表或配置文件路径 @param masterPwd: 主密码 @return: 解析结果 */ info, err := tool.AnalyzeMobaXterm(filePath, masterPwd) if err != nil { return &ExtractMapResult{nil, fmt.Sprintf("解析失败:%v", err)} } return &ExtractMapResult{info, ""} } func (p *InfoExtractor) ExtractDbeaver(folder string) *ExtractMapResult { /* @param folder: 包含credentials-config.json和data-sources.json的文件夹 @return: 解析结果 */ info, err := tool.AnalyzeDbeaver(folder) if err != nil { return &ExtractMapResult{nil, fmt.Sprintf("解析失败:%v", err)} } return &ExtractMapResult{info, ""} } func (p *InfoExtractor) ExtractFinalShell(folder string) *ExtractMapResult { /* @param folder: 包含连接信息的文件夹 @return: 解析结果 */ info, err := tool.AnalyzeFinalShell(folder) if err != nil { return &ExtractMapResult{nil, fmt.Sprintf("解析失败:%v", err)} } return &ExtractMapResult{info, ""} } func (p *InfoExtractor) ExtractHawk2(filePath, pwd string) *ExtractMapResult { /* @param filePath: Hawk2.xml的文件路径 @param pwd: cipher_key,保存在crypto.KEY_256.xml或crypto.KEY_128.xml中 @return: 解析结果 */ info, err := tool.AnalyzeHawk2(filePath, pwd) if err != nil { return &ExtractMapResult{nil, fmt.Sprintf("解析失败:%v", err)} } return &ExtractMapResult{info, ""} } func (p *InfoExtractor) ExtractMetaMask(filePath string) *ExtractMapResult { /* @param filePath: persist-root文件路径 @return: 解析结果 */ info, err := tool.AnalyzeMetaMask(filePath) if err != nil { return &ExtractMapResult{nil, fmt.Sprintf("解析失败:%v", err)} } return &ExtractMapResult{info, ""} } ================================================ FILE: analyzers/extractor/tool/dbeaverTool.go ================================================ package tool import ( "encoding/hex" "fmt" "os" "path/filepath" "github.com/deatil/go-cryptobin/cryptobin/crypto" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" "github.com/tidwall/gjson" ) const ( dbeaverDecryptKey = "babb4a9f774ab853c96c2d653dfe544a" dbeaverDecryptIV = "00000000000000000000000000000000" ) func decryptDbeaver(encFileData []byte) []byte { /* @param encFileData : credentials-config.json文件的二进制数据 @return : 解密后的结果 */ key, err := hex.DecodeString(dbeaverDecryptKey) if err != nil { return nil } iv, err := hex.DecodeString(dbeaverDecryptIV) if err != nil { return nil } return crypto.FromBytes(encFileData).WithKey(key).WithIv(iv).Aes().CBC().PKCS7Padding().Decrypt().ToBytes()[16:] } func AnalyzeDbeaver(folder string) (*orderedmap.OrderedMap, error) { result := orderedmap.New() result.SetEscapeHTML(false) var tmp []*orderedmap.OrderedMap var pwdJson gjson.Result var conJson gjson.Result fileInfo, err := os.Stat(folder) if err != nil { return nil, err } if !fileInfo.IsDir() { logger.Errorf("%s is not a folder", folder) return nil, fmt.Errorf("%s is not a folder", folder) } err = filepath.Walk(folder, func(path string, info os.FileInfo, err error) error { if err != nil { return err } if info.IsDir() { return nil } filename := info.Name() if filename == "credentials-config.json" { encData, err := os.ReadFile(path) if err != nil { logger.Errorf("read %s failed: %v", path, err) return err } decData := decryptDbeaver(encData) pwdJson = gjson.Parse(string(decData)) } if filename == "data-sources.json" { conData, err := os.ReadFile(path) if err != nil { logger.Errorf("read %s failed: %v", path, err) return err } conJson = gjson.Parse(string(conData)) } return nil }) if err != nil { return nil, err } children := conJson.Get("connections") if !children.Exists() { logger.Errorf("data-sources.json is empty") return nil, fmt.Errorf("data-sources.json is empty") } children.ForEach(func(key, value gjson.Result) bool { info := orderedmap.New() info.SetEscapeHTML(false) info.Set("数据库类型", value.Get("provider").String()) info.Set("连接名", value.Get("name").String()) info.Set("地址", value.Get("configuration").Get("host").String()) info.Set("端口", value.Get("configuration").Get("port").String()) info.Set("数据库名", value.Get("configuration").Get("database").String()) info.Set("账户", pwdJson.Get(key.String()).Get("#connection").Get("user").String()) info.Set("密码", pwdJson.Get(key.String()).Get("#connection").Get("password").String()) tmp = append(tmp, info) return true }) result.Set("DBeaver连接信息", tmp) return result, nil } ================================================ FILE: analyzers/extractor/tool/finalshellTool.go ================================================ package tool import ( "bytes" "crypto/md5" "encoding/base64" "encoding/binary" "fmt" "os" "path/filepath" "strings" "github.com/deatil/go-cryptobin/cryptobin/crypto" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" "github.com/tidwall/gjson" ) func randomKey(head []byte) []byte { /* 使用Java的随机算法生成key @param head: 加密数据的前8字节 @return: 生成的key */ ks := int64(3680984568597093857) / int64(NewJavaRandom(int64(head[5])).NextInt(127)) random := NewJavaRandom(ks) t := int(head[0]) for i := 0; i < t; i++ { random.NextInt64() } n := random.NextInt64() r2 := NewJavaRandom(n) ld := []int64{int64(head[4]), r2.NextInt64(), int64(head[7]), int64(head[3]), r2.NextInt64(), int64(head[1]), random.NextInt64(), int64(head[2])} buf := new(bytes.Buffer) err := binary.Write(buf, binary.BigEndian, ld) if err != nil { logger.Errorf("binary.Write failed: %v", err) return nil } keyData := calMd5(buf.Bytes()) return keyData[:8] } func calMd5(data []byte) []byte { h := md5.New() h.Write(data) return h.Sum(nil) } func decryptFinalShell(encData string) string { /* @param encData: 加密的密文 @return: 解密结果 */ encBytes, err := base64.StdEncoding.DecodeString(encData) if err != nil { return "" } if encData == "" { return "" } return crypto.FromBytes(encBytes[8:]).WithKey(randomKey(encBytes[:8])).Des().ECB().PKCS5Padding().Decrypt().ToString() } func AnalyzeFinalShell(folder string) (*orderedmap.OrderedMap, error) { /* @param folder: 保存连接配置的文件夹路径 @return: 解析结果、错误 */ result := orderedmap.New() result.SetEscapeHTML(false) var tmp []*orderedmap.OrderedMap var conJson gjson.Result fileInfo, err := os.Stat(folder) if err != nil { return nil, err } if !fileInfo.IsDir() { return nil, fmt.Errorf("%s is not a folder", folder) } err = filepath.Walk(folder, func(path string, info os.FileInfo, err error) error { if err != nil { return err } if info.IsDir() { return nil } filename := info.Name() if strings.HasSuffix(filename, "_connect_config.json") { conData, err := os.ReadFile(path) if err != nil { return err } conJson = gjson.Parse(string(conData)) json := orderedmap.New() json.SetEscapeHTML(false) json.Set("连接名", conJson.Get("name").String()) json.Set("地址", conJson.Get("host").String()) json.Set("端口", conJson.Get("port").String()) json.Set("用户名", conJson.Get("user_name").String()) json.Set("密码", decryptFinalShell(conJson.Get("password").String())) tmp = append(tmp, json) } else if strings.HasSuffix(filename, ".json") { conData, err := os.ReadFile(path) if err != nil { return err } conJson = gjson.Parse(string(conData)) json := orderedmap.New() json.SetEscapeHTML(false) json.Set("连接名", strings.Replace(filename, ".json", "", -1)) json.Set("地址", conJson.Get("host").String()) json.Set("端口", conJson.Get("port").String()) json.Set("用户名", conJson.Get("user_name").String()) json.Set("密码", decryptFinalShell(conJson.Get("password").String())) tmp = append(tmp, json) } return nil }) if err != nil { return nil, err } result.Set("FinalShell连接信息", tmp) return result, nil } ================================================ FILE: analyzers/extractor/tool/hawkTool.go ================================================ package tool import ( "encoding/base64" "fmt" "os" "strings" "github.com/beevik/etree" "github.com/deatil/go-cryptobin/cryptobin/crypto" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" ) func decryptHawk(encData, entity, pwd string) string { /* @param encData: 文件中的##0V@后的值 @param entity: 密文对应的属性命名 @param pwd: cipher_key,保存在crypto.KEY_256.xml或crypto.KEY_128.xml中 @return: 解密结果 */ pwdBytes, err := base64.StdEncoding.DecodeString(pwd) var data []byte if err != nil { return "" } encBytes, err := base64.StdEncoding.DecodeString(encData) if err != nil { return "" } iv := encBytes[2:14] tag := encBytes[len(encBytes)-16:] data = append(data, encBytes[:2][:]...) data = append(data, []byte(entity)[:]...) encDataBytes := encBytes[14:] return crypto.FromBytes(encDataBytes).WithKey(pwdBytes).WithIv(iv).GCMWithTagSize(len(tag), data).Decrypt().ToString() } func AnalyzeHawk2(filePath, pwd string) (*orderedmap.OrderedMap, error) { /* @param filePath: Hawk2.xml的文件路径 @param pwd: cipher_key,保存在crypto.KEY_256.xml或crypto.KEY_128.xml中 @return: 解析结果、错误 */ fileInfo, err := os.Stat(filePath) if err != nil { return nil, err } if fileInfo.IsDir() { logger.Errorf("%s is not a file", filePath) return nil, fmt.Errorf("%s is not a file", filePath) } result := orderedmap.New() result.SetEscapeHTML(false) var tmp []*orderedmap.OrderedMap doc := etree.NewDocument() if err = doc.ReadFromFile(filePath); err != nil { return nil, err } root := doc.Root() for _, element := range root.ChildElements() { entity := element.SelectAttr("name").Value if strings.Contains(element.Text(), "##0V@") { info := orderedmap.New() info.SetEscapeHTML(false) encData := strings.Split(element.Text(), "##0V@")[1] info.Set("键", entity) info.Set("值", decryptHawk(encData, entity, pwd)) tmp = append(tmp, info) } } result.Set("Hawk2解析", tmp) return result, nil } ================================================ FILE: analyzers/extractor/tool/javaRandom.go ================================================ package tool import "github.com/donnie4w/go-logger/logger" // JavaRandom 模拟Java的Random类 type JavaRandom struct { seed int64 } func NewJavaRandom(seed int64) *JavaRandom { return &JavaRandom{seed: (seed ^ 0x5DEECE66D) & ((1 << 48) - 1)} } func (r *JavaRandom) next(bits int) int32 { r.seed = (r.seed*0x5DEECE66D + 0xB) & ((1 << 48) - 1) return int32(r.seed >> (48 - bits)) } func (r *JavaRandom) NextInt64() int64 { return int64(r.next(32))<<32 + int64(r.next(32)) } func (r *JavaRandom) NextInt(n int) int { if n <= 0 { logger.Errorf("n must be positive") panic("n must be positive") } // 等同于Java的Random.nextInt(n)实现 if (n & -n) == n { // n是2的幂 return int((int64(n) * int64(r.next(31))) >> 31) } var bits, val int32 for { bits = r.next(31) val = bits % int32(n) if bits-val+(int32(n)-1) >= 0 { break } } return int(val) } ================================================ FILE: analyzers/extractor/tool/metamaskTool.go ================================================ package tool import ( "ForensicsTool/utils" "fmt" "log" "os" "strconv" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" "github.com/tidwall/gjson" ) func AnalyzeMetaMask(filePath string) (*orderedmap.OrderedMap, error) { /* @param filePath: persist-root文件 @return: 解析结果、错误 */ fileInfo, err := os.Stat(filePath) if err != nil { return nil, err } if fileInfo.IsDir() { logger.Errorf("%s is not a file", filePath) return nil, fmt.Errorf("%s is not a file", filePath) } result := orderedmap.New() result.SetEscapeHTML(false) var walletInfoList []*orderedmap.OrderedMap var contactInfoList []*orderedmap.OrderedMap var transactionInfoList []*orderedmap.OrderedMap var browserHistoryList []*orderedmap.OrderedMap data, err := os.ReadFile(filePath) if err != nil { return nil, err } json := gjson.ParseBytes(data) if json.Get("engine").Exists() { engine := json.Get("engine") browser := json.Get("browser") for _, arr := range engine.Get("backgroundState.AccountTrackerController.accounts").Array() { walletInfo := orderedmap.New() walletInfo.SetEscapeHTML(false) s := engine.Get(fmt.Sprintf("backgroundState.PreferencesController.identities.%s.importTime", arr.String())).Int() //t := time.UnixMicro(s) //importTime := t.Format("2006-01-02 15:04:05") importTime := utils.DefaultTimestampToDatetime(s, "", "") balance, err := strconv.ParseInt(engine.Get(fmt.Sprintf("backgroundState.AccountTrackerController.accounts.%s.balance", arr.String())).String(), 16, 64) if err != nil { log.Println(err) continue } walletInfo.Set("添加时间", importTime) walletInfo.Set("钱包名称", engine.Get(fmt.Sprintf("backgroundState.PreferencesController.identities.%s.name", arr)).String()) walletInfo.Set("钱包地址", arr.String()) walletInfo.Set("余额(ETH)", strconv.FormatInt(balance/(10^18), 10)) walletInfoList = append(walletInfoList, walletInfo) } for _, contactId := range engine.Get("backgroundState.AccountTrackerController.addressBook").Array() { for _, contact := range contactId.Get(contactId.String()).Array() { contactInfo := orderedmap.New() contactInfo.SetEscapeHTML(false) contactInfo.Set("账户名", contact.Get("name").String()) contactInfo.Set("钱包地址", contact.Get("address").String()) contactInfoList = append(contactInfoList, contactInfo) } } for _, transaction := range engine.Get("backgroundState.TransactionController.transactions").Array() { transactionInfo := orderedmap.New() transactionInfo.SetEscapeHTML(false) s := transaction.Get("time").Int() //t := time.UnixMicro(s) transactionTime := utils.DefaultTimestampToDatetime(s, "", "") value, err := strconv.ParseInt(transaction.Get("txParams.value").String(), 16, 64) if err != nil { log.Println(err) continue } transactionValue := value / (10 ^ 18) transactionInfo.Set("交易时间", transactionTime) transactionInfo.Set("发送方", transaction.Get("txParams.from").String()) transactionInfo.Set("接收方", transaction.Get("txParams.to").String()) transactionInfo.Set("交易金额(ETH)", strconv.FormatInt(transactionValue, 10)) transactionInfo.Set("交易哈希", transaction.Get("hash").String()) transactionInfo.Set("错误", transaction.Get("error").String()) transactionInfoList = append(transactionInfoList, transactionInfo) } for _, history := range browser.Get("history").Array() { historyInfo := orderedmap.New() historyInfo.SetEscapeHTML(false) historyInfo.Set("名称", history.Get("name").String()) historyInfo.Set("URL", history.Get("url").String()) browserHistoryList = append(browserHistoryList, historyInfo) } result.Set("钱包信息", walletInfoList) result.Set("账户信息", contactInfoList) result.Set("交易信息", transactionInfoList) result.Set("浏览历史", browserHistoryList) } return result, nil } ================================================ FILE: analyzers/extractor/tool/mobaTool.go ================================================ package tool import ( "crypto/aes" "crypto/sha512" "fmt" "os" "strings" "github.com/WXjzcccc/registry" "github.com/deatil/go-cryptobin/cryptobin/crypto" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" "golang.org/x/text/encoding/simplifiedchinese" ) func decryptMoba(ciphertext, masterPasswd string) string { hasher := sha512.New() hasher.Write([]byte(masterPasswd)) pwd := hasher.Sum(nil)[:32] iv := crypto.FromHexString(strings.Repeat("00", aes.BlockSize)).WithKey(pwd).Aes().ECB().Encrypt().ToBytes() return crypto.FromBase64String(ciphertext).WithKey(pwd).WithIv(iv).Aes().CFB8().Decrypt().ToString() } func getEncFromIni(file string) ([]string, []string, error) { /* @param file : MobaXterm.ini配置文件路径 @return : 密码列表、凭据列表、错误 */ content, err := os.ReadFile(file) if err != nil { logger.Errorf("failed to read ini file: %v", err) return nil, nil, fmt.Errorf("failed to read ini file: %v", err) } decoder := simplifiedchinese.GBK.NewDecoder() utf8Content, err := decoder.Bytes(content) if err != nil { logger.Errorf("failed to convert encoding: %v", err) return nil, nil, fmt.Errorf("failed to convert encoding: %v", err) } lines := strings.Split(string(utf8Content), "\n") var passwords []string var credentials []string inPasswords := false inCredentials := false for _, line := range lines { line = strings.TrimSpace(line) switch line { case "[Passwords]": inPasswords = true inCredentials = false continue case "[Credentials]": inCredentials = true inPasswords = false continue case "": inPasswords = false inCredentials = false continue } if inPasswords { passwords = append(passwords, line) } if inCredentials { credentials = append(credentials, line) } } return passwords, credentials, nil } func getPwdOrCredential(reg *registry.Key, path string) ([]string, error) { /* @param reg : 注册表实例 @param path : key路径 @return : 提取的数据列表,错误 */ var data []string nameKey, err := reg.OpenSubKey(path) if err != nil { logger.Errorf("未找到保存的凭据或是密码: %v", err) return nil, fmt.Errorf("未找到保存的凭据或是密码: %v", err) } defer nameKey.Close() names, err := nameKey.ReadValueNames(-1) if err != nil { logger.Errorf("failed to read registry key: %v", err) return nil, fmt.Errorf("failed to read registry key: %v", err) } for _, name := range names { value, _, err := nameKey.GetStringValue(name) if err != nil { logger.Errorf("failed to get string value: %v", err) continue } data = append(data, fmt.Sprintf("%s=%s", name, value)) } return data, nil } func getEncFromRegistry(file string) ([]string, []string, error) { /* @param file : NTUSER.DAT配置文件路径 @return : 密码列表、凭据列表、错误 */ reg, err := registry.Open(file) if err != nil { logger.Errorf("failed to open registry file: %v", err) return nil, nil, fmt.Errorf("failed to open registry file: %v", err) } defer reg.Close() rootKey, err := reg.OpenKey("Software\\Mobatek\\MobaXterm") if err != nil { logger.Errorf("failed to open registry key: %v", err) return nil, nil, fmt.Errorf("failed to open registry key: %v", err) } defer rootKey.Close() passwords, _ := getPwdOrCredential(&rootKey, "P") //这俩的错误不处理 credentials, _ := getPwdOrCredential(&rootKey, "C") return passwords, credentials, nil } func AnalyzeMobaXterm(file, masterPasswd string) (*orderedmap.OrderedMap, error) { /* @param file: 配置文件或注册表文件 @return: 解析结果、错误 */ fileInfo, err := os.Stat(file) if err != nil { return nil, err } if fileInfo.IsDir() { logger.Errorf("%s is not a file", file) return nil, fmt.Errorf("%s is not a file", file) } result := orderedmap.New() result.SetEscapeHTML(false) var passwords []string var credentials []string if strings.HasSuffix(file, ".ini") { passwords, credentials, err = getEncFromIni(file) if err != nil { logger.Errorf("failed to get passwords from ini file: %v", err) return nil, err } } else { passwords, credentials, err = getEncFromRegistry(file) if err != nil { logger.Errorf("failed to get passwords from registry file: %v", err) return nil, err } } var passwordList []*orderedmap.OrderedMap for _, password := range passwords { info := orderedmap.New() info.SetEscapeHTML(false) first := "" if strings.Contains(password, ":") { firstSp := strings.Split(password, ":") first = firstSp[0] } idx := strings.Index(password, "=") server := password[len(first)+1 : idx] pwd := decryptMoba(password[idx+1:], masterPasswd) info.Set("协议与端口", first) info.Set("连接账户与地址", server) info.Set("保存的密码", pwd) passwordList = append(passwordList, info) } var credentialList []*orderedmap.OrderedMap for _, credential := range credentials { info := orderedmap.New() info.SetEscapeHTML(false) user := "" encPwd := "" idx := strings.Index(credential, "=") server := credential[:idx] if strings.Contains(credential[idx+1:], ":") { user = strings.Split(credential[idx+1:], ":")[0] encPwd = strings.Split(credential[idx+1:], ":")[1] } pwd := decryptMoba(encPwd, masterPasswd) info.Set("凭据名", server) info.Set("用户名", user) info.Set("保存的密码", pwd) credentialList = append(credentialList, info) } result.Set("密码信息", passwordList) result.Set("凭据信息", credentialList) return result, nil } ================================================ FILE: analyzers/extractor/tool/navicatTool.go ================================================ package tool import ( "crypto/sha1" "encoding/hex" "fmt" "os" "unicode/utf8" "github.com/WXjzcccc/registry" "github.com/deatil/go-cryptobin/cryptobin/crypto" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" "golang.org/x/crypto/blowfish" ) const ( Navicat11KEY = "3DC5CA39" Navicat12KEY = "libcckeylibcckey" Navicat12IV = "libcciv libcciv " ) // Navicat11Cipher 用于 Navicat 11 版本的解密 type Navicat11Cipher struct { key []byte iv []byte } func NewNavicat11Cipher(userKey string) (*Navicat11Cipher, error) { if userKey == "" { userKey = Navicat11KEY } // 初始化密钥 hasher := sha1.New() hasher.Write([]byte(userKey)) key := hasher.Sum(nil) // Blowfish 需要 4-56 字节的密钥 // 初始化 IV iv, err := hex.DecodeString("FFFFFFFFFFFFFFFF") if err != nil { return nil, err } encryptedIV := crypto.FromBytes(iv).WithKey(key).Blowfish().ECB().Encrypt().ToBytes() return &Navicat11Cipher{ key: key, iv: encryptedIV, }, nil } func (c *Navicat11Cipher) xorBytes(a, b []byte) []byte { result := make([]byte, len(a)) for i := 0; i < len(a); i++ { result[i] = a[i] ^ b[i] } return result } func (c *Navicat11Cipher) Decrypt(data []byte) []byte { outData := make([]byte, len(data)) cv := make([]byte, len(c.iv)) copy(cv, c.iv) blockSize := blowfish.BlockSize blocksLen := len(data) / blockSize leftLen := len(data) % blockSize for i := 0; i < blocksLen; i++ { start := i * blockSize end := start + blockSize temp := data[start:end] decrypted := crypto.FromBytes(temp).WithKey(c.key).Blowfish().ECB().Decrypt().ToBytes() decrypted = c.xorBytes(decrypted, cv) copy(outData[start:end], decrypted) for j := 0; j < len(cv); j++ { cv[j] ^= data[start+j] } } if leftLen != 0 { encryptedCV := crypto.FromBytes(cv).WithKey(c.key).Blowfish().ECB().Encrypt().ToBytes() start := blocksLen * blockSize temp := data[start:] temp = c.xorBytes(temp, encryptedCV[:leftLen]) copy(outData[start:], temp) } return outData } func (c *Navicat11Cipher) DecryptString(hexStr string) (string, error) { data, err := hex.DecodeString(hexStr) if err != nil { return "", err } decrypted := c.Decrypt(data) return string(decrypted), nil } // Navicat12Cipher 用于 Navicat 12+ 版本的解密 type Navicat12Cipher struct { aesKey []byte aesIV []byte } func NewNavicat12Cipher() *Navicat12Cipher { return &Navicat12Cipher{ aesKey: []byte(Navicat12KEY), aesIV: []byte(Navicat12IV), } } func (c *Navicat12Cipher) DecryptString(ciphertext string) string { return crypto.FromString(ciphertext).WithKey(c.aesKey).WithIv(c.aesIV).Aes().CBC().Decrypt().ToString() } // 解密密码封装函数 func decryptNavicat(pwd string) string { if pwd == "" { return "" } // 先尝试 Navicat 12+ 解密 dec12 := NewNavicat12Cipher() result := dec12.DecryptString(pwd) if utf8.ValidString(result) && result != "" { return result } // 再尝试 Navicat 11 解密 dec11, err := NewNavicat11Cipher("") if err != nil { logger.Errorf("failed to create navicat 11 cipher: %v", err) return "" } result, err = dec11.DecryptString(pwd) if err == nil { return result } logger.Errorf("failed to decrypt navicat 11 password: %v", err) return "" } func isValueExist(arr []string, value string) bool { valueMap := make(map[string]bool) for _, v := range arr { valueMap[v] = true } _, exist := valueMap[value] return exist } // 获取 Navicat 连接信息 func getNavicatConnections(reg *registry.Registry) (map[string]*registry.Key, error) { rootKey, err := reg.OpenKey("Software\\PremiumSoft") if err != nil { logger.Errorf("failed to open registry key: %v", err) return nil, fmt.Errorf("failed to open registry key: %v", err) } subkeyNames, err := rootKey.ReadSubKeyNames(-1) if err != nil { logger.Errorf("failed to read subkey names: %v", err) return nil, fmt.Errorf("failed to read subkey names: %v", err) } connections := make(map[string]*registry.Key) for _, subkeyName := range subkeyNames { subKey, err := rootKey.OpenSubKey(subkeyName) if err != nil { continue } names, err := subKey.ReadSubKeyNames(-1) if err != nil { continue } if !isValueExist(names, "Servers") { continue } serversKey, err := subKey.OpenSubKey("Servers") if err != nil { continue } connections[subkeyName] = &serversKey } return connections, nil } // 获取 MySQL 连接信息 func getNormalDBInfo(serverKeys *registry.Key) (map[string]*orderedmap.OrderedMap, error) { info := make(map[string]*orderedmap.OrderedMap) connections, err := serverKeys.ReadSubKeyNames(-1) if err != nil { logger.Errorf("failed to read subkey names: %v", err) return nil, fmt.Errorf("failed to read subkey names: %v", err) } for _, connection := range connections { basicInfo := orderedmap.New() basicInfo.Set("连接名", connection) key, err := serverKeys.OpenSubKey(connection) if err != nil { logger.Errorf("failed to open subkey: %v", err) continue } if host, _, err := key.GetStringValue("Host"); err == nil { basicInfo.Set("地址", host) } if port, _, err := key.GetIntegerValue("Port"); err == nil { basicInfo.Set("端口", fmt.Sprintf("%d", port)) } if username, _, err := key.GetStringValue("UserName"); err == nil { basicInfo.Set("用户名", username) } if pwd, _, err := key.GetStringValue("Pwd"); err == nil { basicInfo.Set("密码", decryptNavicat(pwd)) } if path, _, err := key.GetStringValue("QuerySavePath"); err == nil { basicInfo.Set("缓存路径", path) } info[connection] = basicInfo } return info, nil } // 获取 SQLServer 连接信息 func getMSSQLInfo(serverKeys *registry.Key) (map[string]*orderedmap.OrderedMap, error) { info := make(map[string]*orderedmap.OrderedMap) connections, err := serverKeys.ReadSubKeyNames(-1) if err != nil { logger.Errorf("failed to read subkey names: %v", err) return nil, fmt.Errorf("failed to read subkey names: %v", err) } for _, connection := range connections { basicInfo := orderedmap.New() basicInfo.SetEscapeHTML(false) basicInfo.Set("连接名", connection) key, err := serverKeys.OpenSubKey(connection) if err != nil { logger.Errorf("failed to open subkey: %v", err) continue } if host, _, err := key.GetStringValue("Host"); err == nil { basicInfo.Set("地址", host) } if port, _, err := key.GetIntegerValue("Port"); err == nil { basicInfo.Set("端口", fmt.Sprintf("%d", port)) } if username, _, err := key.GetStringValue("UserName"); err == nil { basicInfo.Set("用户名", username) } if pwd, _, err := key.GetStringValue("Pwd"); err == nil { basicInfo.Set("密码", decryptNavicat(pwd)) } if path, _, err := key.GetStringValue("QuerySavePath"); err == nil { basicInfo.Set("缓存路径", path) } if db, _, err := key.GetStringValue("InitialDatabase"); err == nil { basicInfo.Set("默认数据库", db) } if auth, _, err := key.GetStringValue("MSSQLAuthenMode"); err == nil { basicInfo.Set("认证模式", auth) } info[connection] = basicInfo } return info, nil } // 获取SQLite数据 func getSQLiteInfo(serverKeys *registry.Key) (map[string]*orderedmap.OrderedMap, error) { info := make(map[string]*orderedmap.OrderedMap) connections, err := serverKeys.ReadSubKeyNames(-1) if err != nil { logger.Errorf("failed to read subkey names: %v", err) return nil, fmt.Errorf("failed to read subkey names: %v", err) } for _, connection := range connections { basicInfo := orderedmap.New() basicInfo.SetEscapeHTML(false) basicInfo.Set("连接名", connection) key, err := serverKeys.OpenSubKey(connection) if err != nil { logger.Errorf("failed to open subkey: %v", err) continue } if name, _, err := key.GetStringValue("DatabaseFileName"); err == nil { basicInfo.Set("文件名", name) } if encrypted, _, err := key.GetIntegerValue("SQLiteEncrypted"); err == nil { if encrypted == 1 { basicInfo.Set("是否加密", "是") } else { basicInfo.Set("是否加密", "否") } } if saved, _, err := key.GetStringValue("EncryptionSavePassword"); err == nil { if saved == "true" { basicInfo.Set("是否保存密码", "是") } else { basicInfo.Set("是否保存密码", "否") } } if pwd, _, err := key.GetStringValue("EncryptionPassword"); err == nil { basicInfo.Set("密码", decryptNavicat(pwd)) } if path, _, err := key.GetStringValue("QuerySavePath"); err == nil { basicInfo.Set("缓存路径", path) } if db, _, err := key.GetStringValue("InitialDatabase"); err == nil { basicInfo.Set("默认数据库", db) } info[connection] = basicInfo } return info, nil } func addRecords(result *orderedmap.OrderedMap, tType, tName string, connections map[string]*registry.Key) error { var infoFunc func(serverKeys *registry.Key) (map[string]*orderedmap.OrderedMap, error) if keys, ok := connections[tType]; ok { switch tType { case "Navicat", "NavicatMARIADB", "NavicatMongoDB", "NavicatOra", "NavicatPG": infoFunc = getNormalDBInfo case "NavicatMSSQL": infoFunc = getMSSQLInfo case "NavicatSQLite": infoFunc = getSQLiteInfo } info, err := infoFunc(keys) if err != nil { logger.Errorf("failed to get %s info: %v", tName, err) return err } var records []*orderedmap.OrderedMap for _, i := range info { records = append(records, i) } if len(records) > 0 { result.Set(tName, records) } } return nil } // 分析 Navicat 连接信息 func AnalyzeNavicat(regPath string) (*orderedmap.OrderedMap, error) { /* @param refPath: NTUSER.DAT注册表文件路径 @return: 解析结果、错误 */ fileInfo, err := os.Stat(regPath) if err != nil { logger.Errorf("failed to stat file: %v", err) return nil, err } if fileInfo.IsDir() { logger.Errorf("%s is not a file", regPath) return nil, fmt.Errorf("%s is not a file", regPath) } reg, err := registry.Open(regPath) if err != nil { logger.Errorf("failed to open registry file: %v", err) return nil, err } defer reg.Close() connections, err := getNavicatConnections(®) if err != nil { return nil, err } result := orderedmap.New() result.SetEscapeHTML(false) err = addRecords(result, "Navicat", "MySQL连接信息", connections) if err != nil { return nil, err } err = addRecords(result, "NavicatMARIADB", "MariaDB连接信息", connections) if err != nil { return nil, err } err = addRecords(result, "NavicatMongoDB", "MongoDB连接信息", connections) if err != nil { return nil, err } err = addRecords(result, "NavicatOra", "Oracle连接信息", connections) if err != nil { return nil, err } err = addRecords(result, "NavicatPG", "PostgreSQL连接信息", connections) if err != nil { return nil, err } err = addRecords(result, "NavicatMSSQL", "SQLServer连接信息", connections) if err != nil { return nil, err } err = addRecords(result, "NavicatSQLite", "SQLite连接信息", connections) if err != nil { return nil, err } err = reg.Close() if err != nil { return nil, err } return result, nil } ================================================ FILE: analyzers/extractor/tool/xshellTool.go ================================================ package tool import ( "bytes" "crypto/sha256" "encoding/base64" "encoding/hex" "errors" "fmt" "os" "path/filepath" "strings" "github.com/deatil/go-cryptobin/cryptobin/crypto" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" "gopkg.in/ini.v1" ) func decryptXShellStr(sid, encPwd string) (string, error) { /* 低版本解密密文 @param sid:用户的SID @param encPwd: 密文 @return 解密后的密码、错误 */ decoded, err := base64.StdEncoding.DecodeString(encPwd) if err != nil { logger.Errorf("failed to decode base64 string: %v", err) return "", err } if len(decoded) < 32 { logger.Errorf("invalid encrypted password length: %d", len(decoded)) return "", errors.New("invalid encrypted password length") } data := decoded[:len(decoded)-32] checksum := decoded[len(decoded)-32:] // 使用 SHA256 生成密钥 hasher := sha256.New() hasher.Write([]byte(sid)) keyBytes := hasher.Sum(nil) // RC4 解密 decrypted := crypto.FromBytes(data). WithKey(keyBytes). RC4(). Decrypt(). ToBytes() // 验证校验和 hasher = sha256.New() hasher.Write(decrypted) calculatedChecksum := hasher.Sum(nil) if hex.EncodeToString(calculatedChecksum) != hex.EncodeToString(checksum) { logger.Errorf("checksum verification failed: expected %s, got %s", hex.EncodeToString(checksum), hex.EncodeToString(calculatedChecksum)) return "", errors.New("checksum verification failed") } return string(decrypted), nil } // 反转字符串 func reverseString(s string) string { runes := []rune(s) for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 { runes[i], runes[j] = runes[j], runes[i] } return string(runes) } func decryptXShellStrNew(sid string, encPwd string) (string, error) { /* 7.1以后解密密文 @param sid:用户的SID @param encPwd: 密文 @return 解密后的密码、错误 */ decoded, err := base64.StdEncoding.DecodeString(encPwd) if err != nil { logger.Errorf("failed to decode base64 string: %v", err) return "", err } if len(decoded) < 32 { logger.Errorf("invalid encrypted password length: %d", len(decoded)) return "", errors.New("invalid encrypted password length") } data := decoded[:len(decoded)-32] checksum := decoded[len(decoded)-32:] // 处理 SID index := strings.Index(sid, "S-1-5") if index == -1 { logger.Errorf("invalid SID format: %s", sid) return "", errors.New("invalid SID format") } username := sid[:index] ssid := sid[index:] key := reverseString(reverseString(username) + ssid) // 使用 SHA256 生成密钥 hasher := sha256.New() hasher.Write([]byte(key)) keyBytes := hasher.Sum(nil) // RC4 解密 decrypted := crypto.FromBytes(data). WithKey(keyBytes). RC4(). Decrypt(). ToBytes() // 验证校验和 hasher = sha256.New() hasher.Write(decrypted) calculatedChecksum := hasher.Sum(nil) if hex.EncodeToString(calculatedChecksum) != hex.EncodeToString(checksum) { logger.Errorf("checksum verification failed: expected %s, got %s", hex.EncodeToString(checksum), hex.EncodeToString(calculatedChecksum)) return "", errors.New("checksum verification failed") } return string(decrypted), nil } // 预处理文件 func preDeal(file string) (string, error) { data, err := os.ReadFile(file) if err != nil { logger.Errorf("failed to read file: %v", err) return "", err } // 替换特殊字符 data = bytes.ReplaceAll(data, []byte{0x00}, []byte{}) data = bytes.ReplaceAll(data, []byte{0xff}, []byte{}) data = bytes.ReplaceAll(data, []byte{0xfe}, []byte{}) dealFile := file + ".deal" err = os.WriteFile(dealFile, data, 0644) if err != nil { logger.Errorf("failed to write file: %v", err) return "", err } return dealFile, nil } // 删除临时文件 func delDeal(file string) error { return os.Remove(file) } // 分析 XShell/XFtp 配置文件 func AnalyzeXshell(folder string, sid string) (*orderedmap.OrderedMap, error) { /* @param folder: 配置文件目录 @param sid: 用户的用户名+sid @return: 解析结果 */ conns := orderedmap.New() conns.SetEscapeHTML(false) var xsh []*orderedmap.OrderedMap var xft []*orderedmap.OrderedMap fileInfo, err := os.Stat(folder) if err != nil { logger.Errorf("failed to stat folder: %v", err) return nil, err } if !fileInfo.IsDir() { logger.Errorf("%s is not a folder", folder) return nil, fmt.Errorf("%s is not a folder", folder) } err = filepath.Walk(folder, func(path string, info os.FileInfo, err error) error { if err != nil { logger.Errorf("failed to walk file: %v", err) return err } if info.IsDir() { return nil } filename := info.Name() if strings.HasSuffix(filename, ".xsh") { originFile := path dealFile, err := preDeal(originFile) if err != nil { logger.Errorf("failed to preDeal file: %v", err) return err } defer delDeal(dealFile) cfg, err := ini.LoadSources(ini.LoadOptions{ AllowBooleanKeys: true, }, dealFile) if err != nil { logger.Errorf("failed to load ini file: %v", err) return err } conn := orderedmap.New() conn.SetEscapeHTML(false) conn.Set("连接名", strings.TrimSuffix(filename, ".xsh")) conn.Set("地址", cfg.Section("CONNECTION").Key("Host").String()) conn.Set("端口", cfg.Section("CONNECTION").Key("Port").String()) version := cfg.Section("SessionInfo").Key("Version").String() encPwd := cfg.Section("CONNECTION:AUTHENTICATION").Key("Password").String() var pwd string if version != "7.0" && strings.HasPrefix(version, "7.") { pwd, err = decryptXShellStrNew(sid, encPwd) } else { pwd, err = decryptXShellStr(sid, encPwd) } if err == nil { conn.Set("密码", pwd) } else { conn.Set("密码", "解密失败: "+err.Error()) } conn.Set("描述", cfg.Section("CONNECTION").Key("Description").String()) xsh = append(xsh, conn) } if strings.HasSuffix(filename, ".xfp") { originFile := path dealFile, err := preDeal(originFile) if err != nil { logger.Errorf("failed to preDeal file: %v", err) return err } defer delDeal(dealFile) cfg, err := ini.LoadSources(ini.LoadOptions{ AllowBooleanKeys: true, }, dealFile) if err != nil { logger.Errorf("failed to load ini file: %v", err) return err } conn := orderedmap.New() conn.Set("连接名", strings.TrimSuffix(filename, ".xfp")) conn.Set("地址", cfg.Section("Connection").Key("Host").String()) conn.Set("端口", cfg.Section("Connection").Key("Port").String()) version := cfg.Section("SessionInfo").Key("Version").String() encPwd := cfg.Section("Connection").Key("Password").String() var pwd string if version != "7.0" && strings.HasPrefix(version, "7.") { pwd, err = decryptXShellStrNew(sid, encPwd) } else { pwd, err = decryptXShellStr(sid, encPwd) } if err == nil { conn.Set("密码", pwd) } else { conn.Set("密码", "解密失败: "+err.Error()) } conn.Set("描述", cfg.Section("Connection").Key("Description").String()) xft = append(xft, conn) } return nil }) if err != nil { return nil, err } conns.Set("XShell", xsh) conns.Set("XFtp", xft) return conns, nil } ================================================ FILE: analyzers/passwdCalc/passwdCalcAnalyzer.go ================================================ package passwdCalc import ( "ForensicsTool/utils" "context" "crypto/aes" "encoding/binary" "encoding/hex" "errors" "fmt" "strconv" "strings" "github.com/deatil/go-cryptobin/cryptobin/crypto" ) type PasswdCalc struct { ctx context.Context } func NewPasswdCalc() *PasswdCalc { return &PasswdCalc{} } func (p *PasswdCalc) InitCtx(ctx context.Context) { p.ctx = ctx } func (p *PasswdCalc) startup(ctx context.Context) { p.ctx = ctx } func unpad(ciphertext []byte) ([]byte, error) { length := len(ciphertext) if length%aes.BlockSize != 0 { return nil, errors.New("ciphertext block size is invalid") } padding := ciphertext[length-1] if int(padding) > length { return nil, errors.New("padding is invalid") } return ciphertext[:length-int(padding)], nil } func decryptAES(token string, key, iv []byte) string { return crypto.FromBase64String(token). Aes().CBC(). WithKey(key).WithIv(iv). Decrypt().ToString() } func (p *PasswdCalc) CalWechat(uin, imei string) string { /* @param uin: 用户id @param imei: 手机imei,传入空则默认为1234567890ABCDEF @return: 安卓微信EncMicroMsg.db的解密密钥 */ if imei == "" { imei = "1234567890ABCDEF" } pwd := utils.MD5HashHex(imei + uin)[:7] return pwd } func (p *PasswdCalc) CalWechatIndex(uin, wxid, imei string) string { /* @param uin: 用户id @param imei: 手机imei,传入空则默认为1234567890ABCDEF @param wxid: 微信用户的内部wxid @return: 安卓微信EncMicroMsg.db的解密密钥 */ if imei == "" { imei = "1234567890ABCDEF" } atoi, err := strconv.Atoi(uin) if err != nil { return "" } if atoi < 0 { atoi += 4294967296 } uin = strconv.Itoa(atoi) return utils.MD5HashHex(uin + imei + wxid)[:7] } func (p *PasswdCalc) CalWildFire(token string) []string { /* @param token: 野火IM系应用的用户token,在应用目录下shared_prefs/config.xml中的token的值 @return: data的解密密钥 */ // 新版本密钥 key, _ := hex.DecodeString("001122334455667778797A7B7C7D7E7F") iv := key // 旧版本密钥 key2, _ := hex.DecodeString("7F7E7D7C7B7A79787766554433221100") iv2 := key2 pwd := decryptAES(token, key, iv) flag := "使用SQLCipher4进行解密" if pwd == "" { pwd = decryptAES(token, key2, iv2) if pwd == "" { return []string{"解密失败", ""} } flag = "使用SQLCipher3进行解密" } parts := strings.Split(pwd, "|") if len(parts) > 0 { pwd = parts[len(parts)-1] } return []string{pwd, flag} } func (p *PasswdCalc) CalMostone(uid string) []string { /* @param uid: 默往的用户uid,在shared_prefs/im.xml中的userId的值 @return: 默往数据库msg.db的解密密钥 */ hash := utils.MD5HashHex(uid) ret := strings.ToUpper(hash[:6]) return []string{ret, "使用SQLCipher3进行解密"} } func (p *PasswdCalc) CalTiktok(uid string) []string { /* @param uid: 抖音的用户uid,一般在数据库文件名中就有 @return: 抖音数据库的解密密钥 */ en := fmt.Sprintf("byte%simwcdb%sdance", uid, uid) return []string{en, "使用wcdb进行解密"} } func longToBytes(uid int64) []byte { bytes := make([]byte, 8) binary.BigEndian.PutUint64(bytes, uint64(uid)) return bytes } func (p *PasswdCalc) CalBatChat(uid string) []string { /* * @param uid: 用户id,数据库名中的数字 @return: 蝙蝠聊天数据库的解密密钥 */ long_uid, err := strconv.ParseInt(uid, 10, 64) if err != nil { return []string{"", "uid不合法,应该是一串数字!"} } sd := -1756908916 seed := uint32(sd) xxhash32_result := utils.XXHash32(longToBytes(long_uid), seed) fmt.Println(xxhash32_result) pwd := utils.MD5HashHex(string(rune(xxhash32_result)) + uid) return []string{strings.ToUpper(pwd), "使用wcdb进行解密"} } ================================================ FILE: analyzers/reader/fileReader.go ================================================ package reader import ( "ForensicsTool/analyzers/reader/readers" "context" "github.com/iancoleman/orderedmap" ) type FileReader struct { ctx context.Context } func NewFileReader() *FileReader { return &FileReader{} } type ReadMapResult struct { Data *orderedmap.OrderedMap `json:"data"` Err string `json:"err"` } func (p *FileReader) InitCtx(ctx context.Context) { p.ctx = ctx } func (p *FileReader) ReadLevelDB(path string) *ReadMapResult { result, err := readers.LevelDBReader(path) if err != nil { return &ReadMapResult{nil, err.Error()} } return &ReadMapResult{result, ""} } func (p *FileReader) ReadMMKV(path, password string) *ReadMapResult { result, err := readers.MMKVReader(path, password) if err != nil { return &ReadMapResult{nil, err.Error()} } return &ReadMapResult{result, ""} } ================================================ FILE: analyzers/reader/readers/leveldbReader.go ================================================ package readers import ( "fmt" "strings" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" "github.com/syndtr/goleveldb/leveldb" ) func formatBytes(data []byte) string { var builder strings.Builder builder.WriteString("b'") for _, b := range data { if b >= 32 && b <= 126 { // 可打印的 ASCII 字符 builder.WriteByte(b) } else { builder.WriteString(fmt.Sprintf("\\x%02x", b)) // 不可打印字符转为 \x 形式 } } builder.WriteString("'") return builder.String() } func LevelDBReader(dbPath string) (*orderedmap.OrderedMap, error) { db, err := leveldb.OpenFile(dbPath, nil) if err != nil || db == nil { logger.Errorf("【leveldb】数据库打开失败:%v", err) return nil, err } iter := db.NewIterator(nil, nil) result := orderedmap.New() result.SetEscapeHTML(false) var tmp []*orderedmap.OrderedMap for iter.Next() { // Remember that the contents of the returned slice should not be modified, and // only valid until the next call to Next. key := iter.Key() value := iter.Value() info := orderedmap.New() info.SetEscapeHTML(false) info.Set("键", formatBytes(key)) info.Set("值", formatBytes(value)) tmp = append(tmp, info) } iter.Release() defer db.Close() result.Set("leveldbReader", tmp) return result, err } ================================================ FILE: analyzers/reader/readers/mmkvReader.go ================================================ package readers import ( "encoding/hex" "errors" "os" "path/filepath" "strings" go_mmkv "github.com/WXjzcccc/go-mmkv" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" ) func MMKVReader(path, password string) (*orderedmap.OrderedMap, error) { fileInfo, err := os.Stat(path) if err != nil { if os.IsNotExist(err) { logger.Errorf("【mmkvReader】文件不存在") } else { logger.Errorf("【mmkvReader】文件读取失败") } return nil, err } fileMode := fileInfo.Mode() dirPath := path files := []string{} switch { case fileMode.IsDir(): logger.Infof("【mmkvReader】传入的%s是目录", path) files = getDirFiles(path) case fileMode.IsRegular(): logger.Infof("【mmkvReader】传入的%s是文件", path) dirPath = filepath.Dir(path) files = append(files, filepath.Base(path)) default: logger.Errorf("【mmkvReader】文件%s类型错误", path) return nil, errors.New("文件类型错误") } result := orderedmap.New() result.SetEscapeHTML(false) mr, err := go_mmkv.NewManager(dirPath) if err != nil { logger.Errorf("【mmkvReader】打开目录%s失败", dirPath) return nil, err } var openErr error for _, mmkvFile := range files { var tmp []*orderedmap.OrderedMap var vault go_mmkv.Vault if password == "" { vault, openErr = mr.OpenVault(mmkvFile) } else { vault, openErr = mr.OpenVaultCrypto(mmkvFile, password) } if openErr != nil { logger.Errorf("【mmkvReader】打开文件%s失败:%v", mmkvFile, openErr) continue } for _, key := range vault.Keys() { info := orderedmap.New() info.SetEscapeHTML(false) info.Set("键", key) varData, err := vault.GetVarint(key) info.Set("VARINT", varData) bytesData, err := vault.GetBytes(key) if err != nil { logger.Errorf("【mmkvReader】获取%s的bytes数据失败:%v", key, err) info.Set("BYTES", "") } else if len(bytesData) > 0 { info.Set("BYTES", hex.EncodeToString(bytesData)) } else { info.Set("BYTES", "") } stringData, err := vault.GetString(key) if err != nil { logger.Errorf("【mmkvReader】获取%s的string数据失败:%v", key, err) info.Set("STRING", "") } else { info.Set("STRING", stringData) } tmp = append(tmp, info) } result.Set(mmkvFile, tmp) } return result, openErr } func getDirFiles(path string) []string { files, err := os.ReadDir(path) if err != nil { logger.Errorf("【mmkvReader】读取目录%s失败", path) return []string{} } var fileNames []string for _, file := range files { if strings.HasSuffix(file.Name(), ".crc") { fileNames = append(fileNames, strings.ReplaceAll(file.Name(), ".crc", "")) } } return fileNames } ================================================ FILE: analyzers/winreg/structs/domainAccountF.go ================================================ package structs import ( "ForensicsTool/utils" "bytes" "encoding/binary" "fmt" "github.com/donnie4w/go-logger/logger" "github.com/ghostiam/binstruct" ) type DomainAccountF struct { Revision uint32 _ uint32 CreationTime string `bin:"ParseWindowsFileTimestamp"` DomainModifiedCount uint64 MaxPwdAge string `bin:"ParseWindowsFileTimestamp"` MinPwdAge string `bin:"ParseWindowsFileTimestamp"` ForceLogOff string `bin:"ParseWindowsFileTimestamp"` LockOutDuration uint64 LockOutObservationWindow uint64 _ uint64 NextRid uint32 PwdProperties uint32 MinPwdLength uint16 PwdHistoryLength uint16 LockoutTreshold uint16 _ uint16 ServerState uint32 ServerRole uint16 UasCompatibilityReq uint16 _ uint64 Key0 interface{} `bin:"ParseSamKeyData"` } type SamKeyData struct { Revision uint32 Length uint32 Salt []byte `bin:"len:16"` Key []byte `bin:"len:16"` CheckSum []byte `bin:"len:16"` Reserved uint64 } func getSamKeyData(binData []byte) *SamKeyData { var samKeyData SamKeyData decoder := binstruct.NewDecoder(bytes.NewReader(binData), binary.LittleEndian) err := decoder.Decode(&samKeyData) if err != nil { logger.Error("解析SamKeyData失败:", err) return nil } return &samKeyData } type SamKeyDataAes struct { Revision uint32 Length uint32 CheckSumLength uint32 DataLength uint32 Salt []byte `bin:"len:16"` Data []byte `bin:"len:DataLength"` } func getSamKeyDataAes(binData []byte) *SamKeyDataAes { var samKeyDataAes SamKeyDataAes decoder := binstruct.NewDecoder(bytes.NewReader(binData), binary.LittleEndian) err := decoder.Decode(&samKeyDataAes) if err != nil { logger.Error("解析SamKeyDataAes失败:", err) return nil } return &samKeyDataAes } func (*DomainAccountF) ParseWindowsFileTimestamp(r binstruct.Reader) (string, error) { ts, err := r.ReadUint64() if err != nil { logger.Error("读取Windows文件时间戳失败:", err) return "", err } return utils.WindowsFileTimeToDatetime(ts, "", ""), nil } func (d *DomainAccountF) ParseSamKeyData(r binstruct.Reader) (interface{}, error) { marker, err := r.Peek(1) if err != nil { logger.Error("读取SamKeyData标记失败:", err) return nil, err } data, err := r.ReadAll() if err != nil { logger.Error("读取SamKeyData数据失败:", err) return nil, err } switch marker[0] { case byte(1): return getSamKeyData(data), nil case byte(2): return getSamKeyDataAes(data), nil } logger.Error("无效的SamKeyData标记:", marker[0]) return nil, fmt.Errorf("invalid marker") } func GetDomainAccountF(binData []byte) *DomainAccountF { var domainAccountF DomainAccountF decoder := binstruct.NewDecoder(bytes.NewReader(binData), binary.LittleEndian) err := decoder.Decode(&domainAccountF) if err != nil { logger.Error("解析DomainAccountF失败:", err) return nil } return &domainAccountF } ================================================ FILE: analyzers/winreg/structs/domainAccountV.go ================================================ package structs import ( "bytes" "encoding/binary" "fmt" "github.com/donnie4w/go-logger/logger" "github.com/ghostiam/binstruct" ) type DomainAccountV struct { _ []byte `bin:"len:408"` DomainID uint32 SID1 uint32 SID2 uint32 SID3 uint32 } func GetMachineSid(binData []byte) string { var domainAccountV DomainAccountV decoder := binstruct.NewDecoder(bytes.NewReader(binData), binary.LittleEndian) err := decoder.Decode(&domainAccountV) if err != nil { logger.Error("解析DomainAccountV失败:", err) return "" } return fmt.Sprintf("S-1-5-%v-%v-%v-%v", domainAccountV.DomainID, domainAccountV.SID1, domainAccountV.SID2, domainAccountV.SID3) } ================================================ FILE: analyzers/winreg/structs/nthash.go ================================================ package structs import ( "ForensicsTool/utils" "bytes" "encoding/hex" "github.com/deatil/go-cryptobin/cryptobin/crypto" ) /* 解密逻辑和结构体详见https://github.com/skelsec/pypykatz */ func uint32To4BytesLittleEndian(i uint32) []byte { /* 小端序转换 */ buf := new(bytes.Buffer) buf.WriteByte(byte(i)) buf.WriteByte(byte(i >> 8)) buf.WriteByte(byte(i >> 16)) buf.WriteByte(byte(i >> 24)) return buf.Bytes() } func expandDESKey(key []byte) []byte { // 确保密钥长度为7字节,不足补0 if len(key) < 7 { padded := make([]byte, 7) copy(padded, key) key = padded } else { key = key[:7] } var result []byte // 第一字节 b := ((key[0] >> 1) & 0x7f) << 1 result = append(result, b) // 第二字节 b = ((key[0]&0x01)<<6 | (key[1]>>2)&0x3f) << 1 result = append(result, b) // 第三字节 b = ((key[1]&0x03)<<5 | (key[2]>>3)&0x1f) << 1 result = append(result, b) // 第四字节 b = ((key[2]&0x07)<<4 | (key[3]>>4)&0x0f) << 1 result = append(result, b) // 第五字节 b = ((key[3]&0x0f)<<3 | (key[4]>>5)&0x07) << 1 result = append(result, b) // 第六字节 b = ((key[4]&0x1f)<<2 | (key[5]>>6)&0x03) << 1 result = append(result, b) // 第七字节 b = ((key[5]&0x3f)<<1 | (key[6]>>7)&0x01) << 1 result = append(result, b) // 第八字节 b = (key[6] & 0x7f) << 1 result = append(result, b) return result } func rid2Key(rid uint32) ([]byte, []byte) { key := uint32To4BytesLittleEndian(rid) key1 := []byte{key[0], key[1], key[2], key[3], key[0], key[1], key[2]} key2 := []byte{key[3], key[0], key[1], key[2], key[3], key[0], key[1]} return expandDESKey(key1), expandDESKey(key2) } func GetHBootKey(key0 interface{}, bootKey []byte) []byte { QWERTY := []byte("!@#$%^&*()qwertyUIOPAzxcvbnmQQQQQQQQQQQQ)(*@&%\x00") DIGITS := []byte("0123456789012345678901234567890123456789\x00") switch key0.(type) { case *SamKeyData: key := key0.(*SamKeyData) buf := new(bytes.Buffer) buf.Write(key.Salt) buf.Write(QWERTY) buf.Write(bootKey) buf.Write(DIGITS) rc4Key := utils.MD5Hash(buf.Bytes()) buf = new(bytes.Buffer) buf.Write(key.Key) buf.Write(key.CheckSum) hashedBootKey := crypto.FromBytes(buf.Bytes()).WithKey(rc4Key).RC4().Decrypt().ToBytes() buf = new(bytes.Buffer) buf.Write(hashedBootKey[:16]) buf.Write(DIGITS) buf.Write(hashedBootKey[:16]) buf.Write(QWERTY) checksum := utils.MD5Hash(buf.Bytes()) if hex.EncodeToString(hashedBootKey[16:]) != hex.EncodeToString(checksum) { return nil } return hashedBootKey case *SamKeyDataAes: key := key0.(*SamKeyDataAes) hashedBootKey := new(bytes.Buffer) const n = 16 var blocks [][]byte for i := 0; i < len(key.Data); i += n { blocks = append(blocks, key.Data[i:i+n]) } for _, block := range blocks { hashedBootKey.Write( crypto.FromBytes(block).WithKey(bootKey).WithIv(key.Salt).Aes().CBC().NoPadding().Decrypt().ToBytes()) } return hashedBootKey.Bytes() } return nil } const ( NTHASH = 0 LMHASH = 1 NTDEFAULT = "31d6cfe0d16ae931b73c59d7e0c089c0" LMDEFAULT = "aad3b435b51404eeaad3b435b51404ee" ) func DecryptHash(hashedBootKey []byte, rid uint32, hash interface{}, hashType int) string { NTPASSWORD := []byte("NTPASSWORD\x00") LMPASSWORD := []byte("LMPASSWORD\x00") var constant []byte defaultHash := "" var key []byte switch hashType { case NTHASH: constant = NTPASSWORD defaultHash = NTDEFAULT case LMHASH: constant = LMPASSWORD defaultHash = LMDEFAULT } key1, key2 := rid2Key(rid) switch hash.(type) { case *SAMHash: samHash := hash.(*SAMHash) if len(samHash.Hash) == 0 { return defaultHash } buf := new(bytes.Buffer) buf.Write(hashedBootKey[:16]) buf.Write(uint32To4BytesLittleEndian(rid)) buf.Write(constant) rc4Key := utils.MD5Hash(buf.Bytes()) key = crypto.FromBytes(samHash.Hash).WithKey(rc4Key).RC4().Encrypt().ToBytes() case *SAMHashAes: samHashAes := hash.(*SAMHashAes) if len(samHashAes.Data) == 0 { return defaultHash } keyTmp := new(bytes.Buffer) const n = 16 var blocks [][]byte for i := 0; i < len(samHashAes.Data); i += n { blocks = append(blocks, samHashAes.Data[i:i+n]) } for _, block := range blocks { keyTmp.Write( crypto.FromBytes(block).WithKey(hashedBootKey[:16]).WithIv(samHashAes.Salt).Aes().NoPadding().CBC().Decrypt().ToBytes()) } key = keyTmp.Bytes()[:16] } hash1 := crypto.FromBytes(key[:8]).WithKey(key1).Des().NoPadding().Decrypt().ToBytes() hash2 := crypto.FromBytes(key[8:]).WithKey(key2).Des().NoPadding().Decrypt().ToBytes() return hex.EncodeToString(hash1) + hex.EncodeToString(hash2) } ================================================ FILE: analyzers/winreg/structs/userF.go ================================================ package structs import ( "ForensicsTool/utils" "bytes" "encoding/binary" "github.com/ghostiam/binstruct" ) // UserF _是暂时不知道含义的字段 type UserF struct { _ []byte `bin:"len:8"` LastLoginTime string `bin:"ParseWindowsFileTimestamp"` _ []byte `bin:"len:8"` LastPwdChangeTime string `bin:"ParseWindowsFileTimestamp"` _ []byte `bin:"len:8"` LastFailedLoginTime string `bin:"ParseWindowsFileTimestamp"` RID uint32 _ []byte `bin:"len:4"` UserAttribute uint32 _ []byte `bin:"len:4"` LogonCount int16 InValidLoginCount int16 _ []byte `bin:"len:12"` } // ParseWindowsFileTimestamp 会在解码的时候被调用 func (*UserF) ParseWindowsFileTimestamp(r binstruct.Reader) (string, error) { ts, err := r.ReadUint64() if err != nil { return "", err } return utils.WindowsFileTimeToDatetime(ts, "", ""), nil } func GetUserF(binData []byte) *UserF { var userF UserF decoder := binstruct.NewDecoder(bytes.NewReader(binData), binary.LittleEndian) err := decoder.Decode(&userF) if err != nil { return nil } return &userF } ================================================ FILE: analyzers/winreg/structs/userV.go ================================================ package structs import ( "ForensicsTool/utils" "bytes" "encoding/binary" "fmt" "github.com/ghostiam/binstruct" "io" ) type UserV struct { _ []byte `bin:"len:12"` NameOffset uint32 NameLength uint32 _ uint32 FullNameOffset uint32 FullNameLength uint32 _ uint32 CommentOffset uint32 CommentLength uint32 _ uint32 UserCommentOffset uint32 UserCommentLength uint32 _ uint32 _ []byte `bin:"len:12"` HomeDirOffset uint32 HomeDirLength uint32 _ uint32 HomeDirConnectOffset uint32 HomeDirConnectLength uint32 _ uint32 ScriptPathOffset uint32 ScriptPathLength uint32 _ uint32 ProfilePathOffset uint32 ProfilePathLength uint32 _ uint32 WorkstationsOffset uint32 WorkstationsLength uint32 _ uint32 HoursAllowedOffset uint32 HoursAllowedLength uint32 _ uint32 _ []byte `bin:"len:12"` LMHashOffset uint32 LMHashLength uint32 _ uint32 NTHashOffset uint32 NTHashLength uint32 _ uint32 _ []byte `bin:"len:24"` Name string `bin:"ParseName"` FullName string `bin:"ParseFullName"` Comment string `bin:"ParseComment"` UserComment string `bin:"ParseUserComment"` HomeDir string `bin:"ParseHomeDir"` HomeDirConnect string `bin:"ParseHomeDirConnect"` ScriptPath string `bin:"ParseScriptPath"` ProfilePath string `bin:"ParseProfilePath"` Workstations string `bin:"ParseWorkstations"` HoursAllowed string `bin:"ParseHoursAllowed"` LMHash interface{} `bin:"ParseLMHash"` NTHash interface{} `bin:"ParseNTHash"` } type SAMHash struct { PekID uint16 Revision uint16 Hash []byte `bin:"len:16"` } func getSAMHash(binData []byte) *SAMHash { var samHash SAMHash decoder := binstruct.NewDecoder(bytes.NewReader(binData), binary.LittleEndian) err := decoder.Decode(&samHash) if err != nil { return nil } return &samHash } type SAMHashAes struct { PekID uint16 Revision uint16 DataOffset uint32 Salt []byte `bin:"len:16"` Data []byte `bin:"ParseData"` } func (s *SAMHashAes) ParseData(r binstruct.Reader) ([]byte, error) { binData, err := r.ReadAll() if err != nil { return nil, err } return binData, nil } func getSAMHashAes(binData []byte) *SAMHashAes { var samHashAes SAMHashAes decoder := binstruct.NewDecoder(bytes.NewReader(binData), binary.LittleEndian) err := decoder.Decode(&samHashAes) if err != nil { return nil } return &samHashAes } const VOffset = 204 // UserV固定读取前204个字节 func (u *UserV) ParseName(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.NameOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.NameLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseFullName(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.FullNameOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.FullNameLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseComment(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.CommentOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.CommentLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseUserComment(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.UserCommentOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.UserCommentLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseHomeDir(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.HomeDirOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.HomeDirLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseHomeDirConnect(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.HomeDirConnectOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.HomeDirConnectLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseScriptPath(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.ScriptPathOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.ScriptPathLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseProfilePath(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.ProfilePathOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.ProfilePathLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseWorkstations(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.WorkstationsOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.WorkstationsLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseHoursAllowed(r binstruct.Reader) (string, error) { _, err := r.Seek(int64(u.HoursAllowedOffset+VOffset), io.SeekStart) if err != nil { return "", err } binData, err := r.Peek(int(u.HoursAllowedLength)) if err != nil { return "", err } return utils.UTF16leBytesToString(binData), nil } func (u *UserV) ParseLMHash(r binstruct.Reader) (interface{}, error) { _, err := r.Seek(int64(u.NTHashOffset+VOffset), io.SeekStart) if err != nil { return nil, err } head, err := r.Peek(1) if err != nil { return nil, err } if head[0] == byte(1) { if u.LMHashLength == 20 { _, err = r.Seek(int64(u.LMHashOffset+VOffset), io.SeekStart) if err != nil { return nil, err } binData, err := r.Peek(int(u.LMHashLength)) if err != nil { return nil, err } return getSAMHash(binData), nil } } else { if u.LMHashLength == 24 { _, err = r.Seek(int64(u.LMHashOffset+VOffset), io.SeekStart) if err != nil { return nil, err } binData, err := r.Peek(int(u.LMHashLength)) if err != nil { return nil, err } return getSAMHashAes(binData), nil } } return nil, fmt.Errorf("err lmhash") } func (u *UserV) ParseNTHash(r binstruct.Reader) (interface{}, error) { _, err := r.Seek(int64(u.NTHashOffset+VOffset), io.SeekStart) if err != nil { return nil, err } head, err := r.Peek(1) if err != nil { return nil, err } if head[0] == byte(1) { if u.NTHashLength == 20 { _, err = r.Seek(int64(u.NTHashOffset+VOffset), io.SeekStart) if err != nil { return nil, err } binData, err := r.Peek(int(u.NTHashLength)) if err != nil { return nil, err } return getSAMHash(binData), nil } } else { _, err = r.Seek(int64(u.NTHashOffset+VOffset), io.SeekStart) if err != nil { return nil, err } binData, err := r.Peek(int(u.NTHashLength)) if err != nil { return nil, err } return getSAMHashAes(binData), nil } return nil, fmt.Errorf("err nthash") } func GetUserV(binData []byte) *UserV { var userV UserV decoder := binstruct.NewDecoder(bytes.NewReader(binData), binary.LittleEndian) err := decoder.Decode(&userV) if err != nil { return nil } return &userV } ================================================ FILE: analyzers/winreg/winRegAnalyzer.go ================================================ package winreg import ( "ForensicsTool/analyzers/winreg/structs" "ForensicsTool/utils" "context" "encoding/binary" "encoding/hex" "fmt" "os" "path/filepath" "strconv" "strings" "github.com/WXjzcccc/registry" "github.com/donnie4w/go-logger/logger" "github.com/iancoleman/orderedmap" ) type WinReg struct { systemReg registry.Registry samReg registry.Registry softwareReg registry.Registry ntRegList []registry.Registry } type Reg struct { ctx context.Context } func NewReg() *Reg { return &Reg{} } func (r *Reg) InitCtx(ctx context.Context) { r.ctx = ctx } func checkSubKeyExist(key registry.Key, keyName string) bool { /* @param key: 注册表的键 @param keyName: 子键名 @return: 是否存在 */ names, err := key.ReadSubKeyNames(-1) if err != nil { logger.Error("读取子键名称失败:", err) return false } for _, name := range names { if name == keyName { return true } } return false } func getStringValue(key registry.Key, valueName string) string { result, _, err := key.GetStringValue(valueName) if err != nil { logger.Error("获取字符串值失败:", err) return "" } return result } func getStringsValue(key registry.Key, valueName string) []string { result, _, err := key.GetStringsValue(valueName) if err != nil || len(result) == 0 { logger.Errorf("获取字符串数组值<%s>失败:%v", valueName, err) return []string{""} } return result } func getBinaryValue(key registry.Key, valueName string) []byte { result, _, err := key.GetBinaryValue(valueName) if err != nil { logger.Error("获取二进制值失败:", err) return nil } return result } func getIntValue(key registry.Key, valueName string) uint64 { result, _, err := key.GetIntegerValue(valueName) if err != nil { logger.Error("获取整数值失败:", err) return 0 } return result } func timestampByts(timeBytes []byte) string { timestamp := binary.LittleEndian.Uint64(timeBytes) unixSeconds := int64(timestamp)/1e7 - 11644473600 //t := time.Unix(unixSeconds, 0) //formattedDate := t.Format("2006-01-02 15:04:05") formattedDate := utils.DefaultTimestampToDatetime(unixSeconds, "", "") return formattedDate } func timestamp(ts uint64) string { //t := time.Unix(int64(ts), 0) //formattedDate := t.Format("2006-01-02 15:04:05") formattedDate := utils.DefaultTimestampToDatetime(int64(ts), "", "") return formattedDate } func byte2mac(macBytes []byte) string { var result string str := hex.EncodeToString(macBytes) for idx, s := range str { result = result + string(s) if idx%2 == 1 && idx != len(str)-1 { result = result + ":" } } return result } func (w *WinReg) getBootKey() []byte { key, err := w.systemReg.OpenKey(fmt.Sprintf("%s\\Control\\LSA", w.getControlSet())) if err != nil { logger.Error("打开LSA注册表键失败:", err) return nil } defer key.Close() var bootKeyObf []byte jd, err := key.OpenSubKey("JD") if err != nil { logger.Error("打开JD子键失败:", err) return nil } skew, err := key.OpenSubKey("Skew1") if err != nil { logger.Error("打开Skew1子键失败:", err) return nil } gbg, err := key.OpenSubKey("GBG") if err != nil { logger.Error("打开GBG子键失败:", err) return nil } data, err := key.OpenSubKey("Data") if err != nil { logger.Error("打开Data子键失败:", err) return nil } jdClassName, err := hex.DecodeString(jd.GetClassName()) if err != nil { logger.Error("解码JD类名失败:", err) return nil } skewClassName, err := hex.DecodeString(skew.GetClassName()) if err != nil { logger.Error("解码Skew1类名失败:", err) return nil } gbgClassName, err := hex.DecodeString(gbg.GetClassName()) if err != nil { logger.Error("解码GBG类名失败:", err) return nil } dataClassName, err := hex.DecodeString(data.GetClassName()) if err != nil { logger.Error("解码Data类名失败:", err) return nil } bootKeyObf = append(bootKeyObf, jdClassName...) bootKeyObf = append(bootKeyObf, skewClassName...) bootKeyObf = append(bootKeyObf, gbgClassName...) bootKeyObf = append(bootKeyObf, dataClassName...) transforms := []int{8, 5, 4, 2, 11, 9, 13, 3, 0, 6, 1, 12, 14, 10, 15, 7} var bootKey []byte for i := 0; i < len(bootKeyObf); i++ { bootKey = append(bootKey, bootKeyObf[transforms[i]:transforms[i]+1]...) } return bootKey } func (w *WinReg) getControlSet() string { key, err := w.systemReg.OpenKey("select") if err != nil { logger.Error("打开select注册表键失败:", err) return "ControlSet001" } defer key.Close() set := getIntValue(key, "Current") return fmt.Sprintf("ControlSet%03d", set) } func (w *WinReg) getTimeZone() string { key, err := w.systemReg.OpenKey(fmt.Sprintf("%s\\Control\\TimeZoneInformation", w.getControlSet())) if err != nil { logger.Error("打开TimeZoneInformation注册表键失败:", err) return "" } defer key.Close() timeZoneName := getStringValue(key, "TimeZoneKeyName") if timeZoneName == "" { return "" } tKey, err := w.softwareReg.OpenKey(fmt.Sprintf("Microsoft\\Windows NT\\CurrentVersion\\Time Zones\\%s", timeZoneName)) if err != nil { logger.Error("打开时区注册表键失败:", err) return "" } defer tKey.Close() timeZoneDisplayName := getStringValue(tKey, "Display") return timeZoneDisplayName } func (w *WinReg) getComputerName() string { systemKey, err := w.systemReg.OpenKey(fmt.Sprintf("%s\\Control\\ComputerName\\ComputerName", w.getControlSet())) if err != nil { logger.Error("打开ComputerName注册表键失败:", err) return "" } defer systemKey.Close() return getStringValue(systemKey, "ComputerName") } func (w *WinReg) getLastShutdownTime() string { systemKey, err := w.systemReg.OpenKey(fmt.Sprintf("%s\\Control\\Windows", w.getControlSet())) if err != nil { logger.Error("打开Windows注册表键失败:", err) return "" } defer systemKey.Close() hexTime := getBinaryValue(systemKey, "ShutdownTime") return timestampByts(hexTime) } func (w *WinReg) getLastLoginUser() string { softwareKey, err := w.softwareReg.OpenKey("Microsoft\\Windows\\CurrentVersion\\Authentication\\LogonUI") if err != nil { logger.Error("打开LogonUI注册表键失败:", err) return "" } defer softwareKey.Close() return getStringValue(softwareKey, "LastLoggedOnUser") } func (w *WinReg) getOrderMap(key, value string) *orderedmap.OrderedMap { result := orderedmap.New() result.SetEscapeHTML(false) result.Set("键", key) result.Set("值", value) return result } func (w *WinReg) getSystemInfo() ([]*orderedmap.OrderedMap, error) { /* 获取系统信息 */ var result []*orderedmap.OrderedMap softwareKey, err := w.softwareReg.OpenKey("Microsoft\\Windows NT\\CurrentVersion") if err != nil { logger.Error("打开CurrentVersion注册表键失败:", err) return nil, err } defer softwareKey.Close() result = append(result, w.getOrderMap("Build信息", getStringValue(softwareKey, "BuildLabEx"))) result = append(result, w.getOrderMap("Build版本", getStringValue(softwareKey, "CurrentBuildNumber"))) result = append(result, w.getOrderMap("计算机名称", w.getComputerName())) result = append(result, w.getOrderMap("版本信息", getStringValue(softwareKey, "EditionID"))) result = append(result, w.getOrderMap("安装时间(本地时区)", timestamp(getIntValue(softwareKey, "InstallDate")))) result = append(result, w.getOrderMap("系统名称", getStringValue(softwareKey, "ProductName"))) result = append(result, w.getOrderMap("发行ID", getStringValue(softwareKey, "ReleaseId"))) result = append(result, w.getOrderMap("产品ID", getStringValue(softwareKey, "ProductId"))) result = append(result, w.getOrderMap("注册所有者", getStringValue(softwareKey, "RegisteredOwner"))) result = append(result, w.getOrderMap("注册组织", getStringValue(softwareKey, "RegisteredOrganization"))) result = append(result, w.getOrderMap("注册所有者", getStringValue(softwareKey, "RegisteredOwner"))) result = append(result, w.getOrderMap("系统时区", w.getTimeZone())) result = append(result, w.getOrderMap("最后一次正常关机时间(本地时区)", w.getLastShutdownTime())) if checkSubKeyExist(softwareKey, "SoftwareProtectionPlatform") { productKey, err := softwareKey.OpenSubKey("SoftwareProtectionPlatform") if err != nil { logger.Error("打开SoftwareProtectionPlatform子键失败:", err) return result, err } result = append(result, w.getOrderMap("产品密钥备份(非当前密钥)", getStringValue(productKey, "BackupProductKeyDefault"))) } result = append(result, w.getOrderMap("上次登录的用户", w.getLastLoginUser())) return result, nil } func (w *WinReg) getNetInfo() ([]*orderedmap.OrderedMap, error) { /* 获取网卡信息 */ var result []*orderedmap.OrderedMap interfaceKey, err := w.systemReg.OpenKey(fmt.Sprintf("%s\\Services\\Tcpip\\Parameters\\Interfaces", w.getControlSet())) if err != nil { logger.Error("打开Interfaces注册表键失败:", err) return nil, err } defer interfaceKey.Close() interfaceSubKeyNames, err := interfaceKey.ReadSubKeyNames(-1) if err != nil { logger.Error("读取接口子键名称失败:", err) return nil, err } for _, interfaceSubKeyName := range interfaceSubKeyNames { info := orderedmap.New() info.SetEscapeHTML(false) deviceKey, err := w.systemReg.OpenKey(fmt.Sprintf("%s\\Control\\Network\\{4D36E972-E325-11CE-BFC1-08002BE10318}\\%s\\connection", w.getControlSet(), strings.ToUpper(interfaceSubKeyName))) if err != nil { logger.Error("打开网络设备注册表键失败:", err) info.Set("名称", "") } else { info.Set("名称", getStringValue(deviceKey, "Name")) } defer deviceKey.Close() macKey, err := w.systemReg.OpenKey(fmt.Sprintf("%s\\Control\\NetworkSetup2\\Interfaces\\%s\\Kernel", w.getControlSet(), strings.ToUpper(interfaceSubKeyName))) if err != nil { logger.Error("打开MAC地址注册表键失败:", err) info.Set("当前MAC地址", "") info.Set("物理MAC地址", "") } else { info.Set("当前MAC地址", byte2mac(getBinaryValue(macKey, "CurrentAddress"))) info.Set("物理MAC地址", byte2mac(getBinaryValue(macKey, "PermanentAddress"))) } defer macKey.Close() interfaceSubKey, err := interfaceKey.OpenSubKey(interfaceSubKeyName) if err != nil { logger.Error("打开接口子键失败:", err) return nil, err } info.Set("DHCP网络地址", getStringValue(interfaceSubKey, "DhcpIPAddress")) info.Set("DHCP网关", getStringsValue(interfaceSubKey, "DhcpDefaultGateway")[0]) info.Set("DHCP服务地址", getStringValue(interfaceSubKey, "DhcpServer")) info.Set("租赁时间", timestamp(getIntValue(interfaceSubKey, "LeaseObtainedTime"))) info.Set("过期时间", timestamp(getIntValue(interfaceSubKey, "LeaseTerminatesTime"))) info.Set("IP地址", getStringsValue(interfaceSubKey, "IPAddress")[0]) info.Set("子网掩码", getStringsValue(interfaceSubKey, "SubnetMask")[0]) info.Set("网关", getStringsValue(interfaceSubKey, "DefaultGateway")[0]) result = append(result, info) } return result, nil } func (w *WinReg) getUserInfo() ([]*orderedmap.OrderedMap, error) { /* 获取用户信息 */ var result []*orderedmap.OrderedMap domainAccountKey, err := w.samReg.OpenKey("SAM\\Domains\\Account") if err != nil { logger.Error("打开SAM Domains Account注册表键失败:", err) return nil, err } defer domainAccountKey.Close() domainAccountVData := getBinaryValue(domainAccountKey, "V") domainAccountFData := getBinaryValue(domainAccountKey, "F") t := structs.GetDomainAccountF(domainAccountFData) hashedBootKey := structs.GetHBootKey(t.Key0, w.getBootKey()) machineSid := structs.GetMachineSid(domainAccountVData) userAccountKey, err := domainAccountKey.OpenSubKey("Users") if err != nil { logger.Error("打开Users子键失败:", err) return nil, err } defer userAccountKey.Close() userNameKey, err := userAccountKey.OpenSubKey("Names") if err != nil { logger.Error("打开Names子键失败:", err) return nil, err } defer userNameKey.Close() userNames, err := userNameKey.ReadSubKeyNames(-1) if err != nil { logger.Error("读取用户名失败:", err) return nil, err } for _, userName := range userNames { info := orderedmap.New() info.SetEscapeHTML(false) userKey, err := userNameKey.OpenSubKey(userName) if err != nil { logger.Error("打开用户子键失败:", err) continue } defer userKey.Close() _, valType, err := userKey.GetValue("(default)", []byte{}) if err != nil { logger.Error("获取用户默认值失败:", err) continue } userSid := fmt.Sprintf("%s-%v", machineSid, valType) rid := fmt.Sprintf("%08x", valType) accountKey, err := userAccountKey.OpenSubKey(rid) if err != nil { logger.Error("打开用户账户子键失败:", err) continue } accountKey.Close() userFData := getBinaryValue(accountKey, "F") userVData := getBinaryValue(accountKey, "V") userV := structs.GetUserV(userVData) userF := structs.GetUserF(userFData) info.Set("用户名", userName) info.Set("SID", userSid) info.Set("密码哈希", structs.DecryptHash(hashedBootKey, userF.RID, userV.NTHash, structs.NTHASH)) info.Set("上次登录时间", userF.LastLoginTime) info.Set("上次密码修改时间", userF.LastPwdChangeTime) info.Set("上次登录失败时间", userF.LastFailedLoginTime) info.Set("用户属性", strconv.Itoa(int(userF.UserAttribute))) info.Set("登录次数", strconv.Itoa(int(userF.LogonCount))) info.Set("登录失败次数", strconv.Itoa(int(userF.InValidLoginCount))) info.Set("用户全名", userV.FullName) info.Set("描述信息", userV.Comment) result = append(result, info) } return result, nil } //TODO 默认浏览器,最近访问文档等 func (w *WinReg) getDefaultBrowser() ([]*orderedmap.OrderedMap, error) { var result []*orderedmap.OrderedMap for idx, nt := range w.ntRegList { info := orderedmap.New() info.SetEscapeHTML(false) rootKey, err := nt.OpenKey("SOFTWARE\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\http\\UserChoice") if err != nil { logger.Error("打开默认浏览器注册表键失败:", err) return nil, err } defer rootKey.Close() browser := getStringValue(rootKey, "ProgId") result = append(result, w.getOrderMap(strconv.Itoa(idx), browser)) } return result, nil } type RegResult struct { Data *orderedmap.OrderedMap `json:"data"` Err string `json:"err"` } func (r *Reg) AnalyzeWinReg(folder string) *RegResult { /* @param folder: 包含了SAM、SYSTEM、SOFTWARE、NTUSER.DAT注册表的文件夹,NTUSER.DAT可以存在多个,只需要后缀名是DAT即可 @return: 解析结果、错误 */ result := orderedmap.New() result.SetEscapeHTML(false) var systemReg registry.Registry var samReg registry.Registry var softwareReg registry.Registry var ntRegList []registry.Registry fileInfo, err := os.Stat(folder) if err != nil { logger.Error("检查文件夹状态失败:", err) return &RegResult{nil, err.Error()} } if !fileInfo.IsDir() { return &RegResult{nil, fmt.Sprintf("%s is not a folder", folder)} } err = filepath.Walk(folder, func(path string, info os.FileInfo, err error) error { filename := info.Name() switch filename { case "SYSTEM": systemReg, err = registry.Open(path) case "SOFTWARE": softwareReg, err = registry.Open(path) if err != nil { logger.Error("打开SOFTWARE注册表文件失败:", err) return err } case "SAM": samReg, err = registry.Open(path) if err != nil { logger.Error("打开SAM注册表文件失败:", err) return err } } if strings.HasSuffix(filename, ".DAT") { ntReg, err := registry.Open(path) if err != nil { logger.Error("打开NTUSER.DAT注册表文件失败:", err) return err } ntRegList = append(ntRegList, ntReg) } return nil }) if err != nil { logger.Error("遍历文件夹失败:", err) return &RegResult{nil, err.Error()} } winReg := &WinReg{systemReg, samReg, softwareReg, ntRegList} sysInfo, err := winReg.getSystemInfo() if err != nil { logger.Error("获取系统信息失败:", err) } else { result.Set("系统信息", sysInfo) } netInfo, err := winReg.getNetInfo() if err != nil { logger.Error("获取网卡信息失败:", err) } else { result.Set("网卡信息", netInfo) } userInfo, err := winReg.getUserInfo() if err != nil { logger.Error("获取用户信息失败:", err) } else { result.Set("用户信息", userInfo) } defaultBrowser, err := winReg.getDefaultBrowser() if err != nil { logger.Error("获取默认浏览器信息失败:", err) } else { result.Set("默认浏览器", defaultBrowser) } return &RegResult{result, ""} } ================================================ FILE: app.go ================================================ package main import ( "context" "fmt" ) // App struct type App struct { ctx context.Context } // NewApp creates a new App application struct func NewApp() *App { return &App{} } // startup is called at application startup func (a *App) startup(ctx context.Context) { // Perform your setup here a.ctx = ctx } // domReady is called after front-end resources have been loaded func (a App) domReady(ctx context.Context) { // Add your action here } // beforeClose is called when the application is about to quit, // either by clicking the window close button or calling runtime.Quit. // Returning true will cause the application to continue, false will continue shutdown as normal. func (a *App) beforeClose(ctx context.Context) (prevent bool) { return false } // shutdown is called at application termination func (a *App) shutdown(ctx context.Context) { // Perform your teardown here } // Greet returns a greeting for the given name func (a *App) Greet(name string) string { return fmt.Sprintf("Hello %s, It's show time!", name) } func (a *App) GetVersion() string { return "v2.6" } ================================================ FILE: build/README.md ================================================ # Build Directory The build directory is used to house all the build files and assets for your application. The structure is: * bin - Output directory * darwin - macOS specific files * windows - Windows specific files ## Mac The `darwin` directory holds files specific to Mac builds. These may be customised and used as part of the build. To return these files to the default state, simply delete them and build with `wails build`. The directory contains the following files: - `Info.plist` - the main plist file used for Mac builds. It is used when building using `wails build`. - `Info.dev.plist` - same as the main plist file but used when building using `wails dev`. ## Windows The `windows` directory contains the manifest and rc files used when building with `wails build`. These may be customised for your application. To return these files to the default state, simply delete them and build with `wails build`. - `icon.ico` - The icon used for the application. This is used when building using `wails build`. If you wish to use a different icon, simply replace this file with your own. If it is missing, a new `icon.ico` file will be created using the `appicon.png` file in the build directory. - `installer/*` - The files used to create the Windows installer. These are used when building using `wails build`. - `info.json` - Application details used for Windows builds. The data here will be used by the Windows installer, as well as the application itself (right click the exe -> properties -> details) - `wails.exe.manifest` - The main application manifest file. ================================================ FILE: build/darwin/Info.dev.plist ================================================ CFBundlePackageType APPL CFBundleName {{.Info.ProductName}} CFBundleExecutable {{.OutputFilename}} CFBundleIdentifier com.wails.{{.Name}} CFBundleVersion {{.Info.ProductVersion}} CFBundleGetInfoString {{.Info.Comments}} CFBundleShortVersionString {{.Info.ProductVersion}} CFBundleIconFile iconfile LSMinimumSystemVersion 10.13.0 NSHighResolutionCapable true NSHumanReadableCopyright {{.Info.Copyright}} {{if .Info.FileAssociations}} CFBundleDocumentTypes {{range .Info.FileAssociations}} CFBundleTypeExtensions {{.Ext}} CFBundleTypeName {{.Name}} CFBundleTypeRole {{.Role}} CFBundleTypeIconFile {{.IconName}} {{end}} {{end}} {{if .Info.Protocols}} CFBundleURLTypes {{range .Info.Protocols}} CFBundleURLName com.wails.{{.Scheme}} CFBundleURLSchemes {{.Scheme}} CFBundleTypeRole {{.Role}} {{end}} {{end}} NSAppTransportSecurity NSAllowsLocalNetworking ================================================ FILE: build/darwin/Info.plist ================================================ CFBundlePackageType APPL CFBundleName {{.Info.ProductName}} CFBundleExecutable {{.OutputFilename}} CFBundleIdentifier com.wails.{{.Name}} CFBundleVersion {{.Info.ProductVersion}} CFBundleGetInfoString {{.Info.Comments}} CFBundleShortVersionString {{.Info.ProductVersion}} CFBundleIconFile iconfile LSMinimumSystemVersion 10.13.0 NSHighResolutionCapable true NSHumanReadableCopyright {{.Info.Copyright}} {{if .Info.FileAssociations}} CFBundleDocumentTypes {{range .Info.FileAssociations}} CFBundleTypeExtensions {{.Ext}} CFBundleTypeName {{.Name}} CFBundleTypeRole {{.Role}} CFBundleTypeIconFile {{.IconName}} {{end}} {{end}} {{if .Info.Protocols}} CFBundleURLTypes {{range .Info.Protocols}} CFBundleURLName com.wails.{{.Scheme}} CFBundleURLSchemes {{.Scheme}} CFBundleTypeRole {{.Role}} {{end}} {{end}} ================================================ FILE: build/windows/info.json ================================================ { "fixed": { "file_version": "{{.Info.ProductVersion}}" }, "info": { "0000": { "ProductVersion": "{{.Info.ProductVersion}}", "CompanyName": "{{.Info.CompanyName}}", "FileDescription": "{{.Info.ProductName}}", "LegalCopyright": "{{.Info.Copyright}}", "ProductName": "{{.Info.ProductName}}", "Comments": "{{.Info.Comments}}" } } } ================================================ FILE: build/windows/installer/project.nsi ================================================ Unicode true #### ## Please note: Template replacements don't work in this file. They are provided with default defines like ## mentioned underneath. ## If the keyword is not defined, "wails_tools.nsh" will populate them with the values from ProjectInfo. ## If they are defined here, "wails_tools.nsh" will not touch them. This allows to use this project.nsi manually ## from outside of Wails for debugging and development of the installer. ## ## For development first make a wails nsis build to populate the "wails_tools.nsh": ## > wails build --target windows/amd64 --nsis ## Then you can call makensis on this file with specifying the path to your binary: ## For a AMD64 only installer: ## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app.exe ## For a ARM64 only installer: ## > makensis -DARG_WAILS_ARM64_BINARY=..\..\bin\app.exe ## For a installer with both architectures: ## > makensis -DARG_WAILS_AMD64_BINARY=..\..\bin\app-amd64.exe -DARG_WAILS_ARM64_BINARY=..\..\bin\app-arm64.exe #### ## The following information is taken from the ProjectInfo file, but they can be overwritten here. #### ## !define INFO_PROJECTNAME "MyProject" # Default "{{.Name}}" ## !define INFO_COMPANYNAME "MyCompany" # Default "{{.Info.CompanyName}}" ## !define INFO_PRODUCTNAME "MyProduct" # Default "{{.Info.ProductName}}" ## !define INFO_PRODUCTVERSION "1.0.0" # Default "{{.Info.ProductVersion}}" ## !define INFO_COPYRIGHT "Copyright" # Default "{{.Info.Copyright}}" ### ## !define PRODUCT_EXECUTABLE "Application.exe" # Default "${INFO_PROJECTNAME}.exe" ## !define UNINST_KEY_NAME "UninstKeyInRegistry" # Default "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}" #### ## !define REQUEST_EXECUTION_LEVEL "admin" # Default "admin" see also https://nsis.sourceforge.io/Docs/Chapter4.html #### ## Include the wails tools #### !include "wails_tools.nsh" # The version information for this two must consist of 4 parts VIProductVersion "${INFO_PRODUCTVERSION}.0" VIFileVersion "${INFO_PRODUCTVERSION}.0" VIAddVersionKey "CompanyName" "${INFO_COMPANYNAME}" VIAddVersionKey "FileDescription" "${INFO_PRODUCTNAME} Installer" VIAddVersionKey "ProductVersion" "${INFO_PRODUCTVERSION}" VIAddVersionKey "FileVersion" "${INFO_PRODUCTVERSION}" VIAddVersionKey "LegalCopyright" "${INFO_COPYRIGHT}" VIAddVersionKey "ProductName" "${INFO_PRODUCTNAME}" # Enable HiDPI support. https://nsis.sourceforge.io/Reference/ManifestDPIAware ManifestDPIAware true !include "MUI.nsh" !define MUI_ICON "..\icon.ico" !define MUI_UNICON "..\icon.ico" # !define MUI_WELCOMEFINISHPAGE_BITMAP "resources\leftimage.bmp" #Include this to add a bitmap on the left side of the Welcome Page. Must be a size of 164x314 !define MUI_FINISHPAGE_NOAUTOCLOSE # Wait on the INSTFILES page so the user can take a look into the details of the installation steps !define MUI_ABORTWARNING # This will warn the user if they exit from the installer. !insertmacro MUI_PAGE_WELCOME # Welcome to the installer page. # !insertmacro MUI_PAGE_LICENSE "resources\eula.txt" # Adds a EULA page to the installer !insertmacro MUI_PAGE_DIRECTORY # In which folder install page. !insertmacro MUI_PAGE_INSTFILES # Installing page. !insertmacro MUI_PAGE_FINISH # Finished installation page. !insertmacro MUI_UNPAGE_INSTFILES # Uinstalling page !insertmacro MUI_LANGUAGE "English" # Set the Language of the installer ## The following two statements can be used to sign the installer and the uninstaller. The path to the binaries are provided in %1 #!uninstfinalize 'signtool --file "%1"' #!finalize 'signtool --file "%1"' Name "${INFO_PRODUCTNAME}" OutFile "..\..\bin\${INFO_PROJECTNAME}-${ARCH}-installer.exe" # Name of the installer's file. InstallDir "$PROGRAMFILES64\${INFO_COMPANYNAME}\${INFO_PRODUCTNAME}" # Default installing folder ($PROGRAMFILES is Program Files folder). ShowInstDetails show # This will always show the installation details. Function .onInit !insertmacro wails.checkArchitecture FunctionEnd Section !insertmacro wails.setShellContext !insertmacro wails.webview2runtime SetOutPath $INSTDIR !insertmacro wails.files CreateShortcut "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" CreateShortCut "$DESKTOP\${INFO_PRODUCTNAME}.lnk" "$INSTDIR\${PRODUCT_EXECUTABLE}" !insertmacro wails.associateFiles !insertmacro wails.associateCustomProtocols !insertmacro wails.writeUninstaller SectionEnd Section "uninstall" !insertmacro wails.setShellContext RMDir /r "$AppData\${PRODUCT_EXECUTABLE}" # Remove the WebView2 DataPath RMDir /r $INSTDIR Delete "$SMPROGRAMS\${INFO_PRODUCTNAME}.lnk" Delete "$DESKTOP\${INFO_PRODUCTNAME}.lnk" !insertmacro wails.unassociateFiles !insertmacro wails.unassociateCustomProtocols !insertmacro wails.deleteUninstaller SectionEnd ================================================ FILE: build/windows/installer/wails_tools.nsh ================================================ # DO NOT EDIT - Generated automatically by `wails build` !include "x64.nsh" !include "WinVer.nsh" !include "FileFunc.nsh" !ifndef INFO_PROJECTNAME !define INFO_PROJECTNAME "{{.Name}}" !endif !ifndef INFO_COMPANYNAME !define INFO_COMPANYNAME "{{.Info.CompanyName}}" !endif !ifndef INFO_PRODUCTNAME !define INFO_PRODUCTNAME "{{.Info.ProductName}}" !endif !ifndef INFO_PRODUCTVERSION !define INFO_PRODUCTVERSION "{{.Info.ProductVersion}}" !endif !ifndef INFO_COPYRIGHT !define INFO_COPYRIGHT "{{.Info.Copyright}}" !endif !ifndef PRODUCT_EXECUTABLE !define PRODUCT_EXECUTABLE "${INFO_PROJECTNAME}.exe" !endif !ifndef UNINST_KEY_NAME !define UNINST_KEY_NAME "${INFO_COMPANYNAME}${INFO_PRODUCTNAME}" !endif !define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${UNINST_KEY_NAME}" !ifndef REQUEST_EXECUTION_LEVEL !define REQUEST_EXECUTION_LEVEL "admin" !endif RequestExecutionLevel "${REQUEST_EXECUTION_LEVEL}" !ifdef ARG_WAILS_AMD64_BINARY !define SUPPORTS_AMD64 !endif !ifdef ARG_WAILS_ARM64_BINARY !define SUPPORTS_ARM64 !endif !ifdef SUPPORTS_AMD64 !ifdef SUPPORTS_ARM64 !define ARCH "amd64_arm64" !else !define ARCH "amd64" !endif !else !ifdef SUPPORTS_ARM64 !define ARCH "arm64" !else !error "Wails: Undefined ARCH, please provide at least one of ARG_WAILS_AMD64_BINARY or ARG_WAILS_ARM64_BINARY" !endif !endif !macro wails.checkArchitecture !ifndef WAILS_WIN10_REQUIRED !define WAILS_WIN10_REQUIRED "This product is only supported on Windows 10 (Server 2016) and later." !endif !ifndef WAILS_ARCHITECTURE_NOT_SUPPORTED !define WAILS_ARCHITECTURE_NOT_SUPPORTED "This product can't be installed on the current Windows architecture. Supports: ${ARCH}" !endif ${If} ${AtLeastWin10} !ifdef SUPPORTS_AMD64 ${if} ${IsNativeAMD64} Goto ok ${EndIf} !endif !ifdef SUPPORTS_ARM64 ${if} ${IsNativeARM64} Goto ok ${EndIf} !endif IfSilent silentArch notSilentArch silentArch: SetErrorLevel 65 Abort notSilentArch: MessageBox MB_OK "${WAILS_ARCHITECTURE_NOT_SUPPORTED}" Quit ${else} IfSilent silentWin notSilentWin silentWin: SetErrorLevel 64 Abort notSilentWin: MessageBox MB_OK "${WAILS_WIN10_REQUIRED}" Quit ${EndIf} ok: !macroend !macro wails.files !ifdef SUPPORTS_AMD64 ${if} ${IsNativeAMD64} File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_AMD64_BINARY}" ${EndIf} !endif !ifdef SUPPORTS_ARM64 ${if} ${IsNativeARM64} File "/oname=${PRODUCT_EXECUTABLE}" "${ARG_WAILS_ARM64_BINARY}" ${EndIf} !endif !macroend !macro wails.writeUninstaller WriteUninstaller "$INSTDIR\uninstall.exe" SetRegView 64 WriteRegStr HKLM "${UNINST_KEY}" "Publisher" "${INFO_COMPANYNAME}" WriteRegStr HKLM "${UNINST_KEY}" "DisplayName" "${INFO_PRODUCTNAME}" WriteRegStr HKLM "${UNINST_KEY}" "DisplayVersion" "${INFO_PRODUCTVERSION}" WriteRegStr HKLM "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\${PRODUCT_EXECUTABLE}" WriteRegStr HKLM "${UNINST_KEY}" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" WriteRegStr HKLM "${UNINST_KEY}" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 IntFmt $0 "0x%08X" $0 WriteRegDWORD HKLM "${UNINST_KEY}" "EstimatedSize" "$0" !macroend !macro wails.deleteUninstaller Delete "$INSTDIR\uninstall.exe" SetRegView 64 DeleteRegKey HKLM "${UNINST_KEY}" !macroend !macro wails.setShellContext ${If} ${REQUEST_EXECUTION_LEVEL} == "admin" SetShellVarContext all ${else} SetShellVarContext current ${EndIf} !macroend # Install webview2 by launching the bootstrapper # See https://docs.microsoft.com/en-us/microsoft-edge/webview2/concepts/distribution#online-only-deployment !macro wails.webview2runtime !ifndef WAILS_INSTALL_WEBVIEW_DETAILPRINT !define WAILS_INSTALL_WEBVIEW_DETAILPRINT "Installing: WebView2 Runtime" !endif SetRegView 64 # If the admin key exists and is not empty then webview2 is already installed ReadRegStr $0 HKLM "SOFTWARE\WOW6432Node\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv" ${If} $0 != "" Goto ok ${EndIf} ${If} ${REQUEST_EXECUTION_LEVEL} == "user" # If the installer is run in user level, check the user specific key exists and is not empty then webview2 is already installed ReadRegStr $0 HKCU "Software\Microsoft\EdgeUpdate\Clients\{F3017226-FE2A-4295-8BDF-00C3A9A7E4C5}" "pv" ${If} $0 != "" Goto ok ${EndIf} ${EndIf} SetDetailsPrint both DetailPrint "${WAILS_INSTALL_WEBVIEW_DETAILPRINT}" SetDetailsPrint listonly InitPluginsDir CreateDirectory "$pluginsdir\webview2bootstrapper" SetOutPath "$pluginsdir\webview2bootstrapper" File "tmp\MicrosoftEdgeWebview2Setup.exe" ExecWait '"$pluginsdir\webview2bootstrapper\MicrosoftEdgeWebview2Setup.exe" /silent /install' SetDetailsPrint both ok: !macroend # Copy of APP_ASSOCIATE and APP_UNASSOCIATE macros from here https://gist.github.com/nikku/281d0ef126dbc215dd58bfd5b3a5cd5b !macro APP_ASSOCIATE EXT FILECLASS DESCRIPTION ICON COMMANDTEXT COMMAND ; Backup the previously associated file class ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" "" WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "${FILECLASS}_backup" "$R0" WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "${FILECLASS}" WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}" "" `${DESCRIPTION}` WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\DefaultIcon" "" `${ICON}` WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell" "" "open" WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open" "" `${COMMANDTEXT}` WriteRegStr SHELL_CONTEXT "Software\Classes\${FILECLASS}\shell\open\command" "" `${COMMAND}` !macroend !macro APP_UNASSOCIATE EXT FILECLASS ; Backup the previously associated file class ReadRegStr $R0 SHELL_CONTEXT "Software\Classes\.${EXT}" `${FILECLASS}_backup` WriteRegStr SHELL_CONTEXT "Software\Classes\.${EXT}" "" "$R0" DeleteRegKey SHELL_CONTEXT `Software\Classes\${FILECLASS}` !macroend !macro wails.associateFiles ; Create file associations {{range .Info.FileAssociations}} !insertmacro APP_ASSOCIATE "{{.Ext}}" "{{.Name}}" "{{.Description}}" "$INSTDIR\{{.IconName}}.ico" "Open with ${INFO_PRODUCTNAME}" "$INSTDIR\${PRODUCT_EXECUTABLE} $\"%1$\"" File "..\{{.IconName}}.ico" {{end}} !macroend !macro wails.unassociateFiles ; Delete app associations {{range .Info.FileAssociations}} !insertmacro APP_UNASSOCIATE "{{.Ext}}" "{{.Name}}" Delete "$INSTDIR\{{.IconName}}.ico" {{end}} !macroend !macro CUSTOM_PROTOCOL_ASSOCIATE PROTOCOL DESCRIPTION ICON COMMAND DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}" WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "" "${DESCRIPTION}" WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}" "URL Protocol" "" WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\DefaultIcon" "" "${ICON}" WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell" "" "" WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open" "" "" WriteRegStr SHELL_CONTEXT "Software\Classes\${PROTOCOL}\shell\open\command" "" "${COMMAND}" !macroend !macro CUSTOM_PROTOCOL_UNASSOCIATE PROTOCOL DeleteRegKey SHELL_CONTEXT "Software\Classes\${PROTOCOL}" !macroend !macro wails.associateCustomProtocols ; Create custom protocols associations {{range .Info.Protocols}} !insertmacro CUSTOM_PROTOCOL_ASSOCIATE "{{.Scheme}}" "{{.Description}}" "$INSTDIR\${PRODUCT_EXECUTABLE},0" "$INSTDIR\${PRODUCT_EXECUTABLE} $\"%1$\"" {{end}} !macroend !macro wails.unassociateCustomProtocols ; Delete app custom protocol associations {{range .Info.Protocols}} !insertmacro CUSTOM_PROTOCOL_UNASSOCIATE "{{.Scheme}}" {{end}} !macroend ================================================ FILE: build/windows/wails.exe.manifest ================================================ true/pm permonitorv2,permonitor ================================================ FILE: frontend/.gitignore ================================================ # Logs logs *.log npm-debug.log* yarn-debug.log* yarn-error.log* pnpm-debug.log* lerna-debug.log* node_modules .DS_Store dist dist-ssr coverage *.local /cypress/videos/ /cypress/screenshots/ # Editor directories and files .vscode/* !.vscode/extensions.json .idea *.suo *.ntvs* *.njsproj *.sln *.sw? .trae ================================================ FILE: frontend/README.md ================================================ # primevue-quickstart-create-vue-ts This template should help get you started developing with Vue 3 in Vite. ## Recommended IDE Setup [VSCode](https://code.visualstudio.com/) + [Volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar) (and disable Vetur) + [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin). ## Type Support for `.vue` Imports in TS TypeScript cannot handle type information for `.vue` imports by default, so we replace the `tsc` CLI with `vue-tsc` for type checking. In editors, we need [TypeScript Vue Plugin (Volar)](https://marketplace.visualstudio.com/items?itemName=Vue.vscode-typescript-vue-plugin) to make the TypeScript language service aware of `.vue` types. If the standalone TypeScript plugin doesn't feel fast enough to you, Volar has also implemented a [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471#discussioncomment-1361669) that is more performant. You can enable it by the following steps: 1. Disable the built-in TypeScript Extension 1. Run `Extensions: Show Built-in Extensions` from VSCode's command palette 2. Find `TypeScript and JavaScript Language Features`, right click and select `Disable (Workspace)` 2. Reload the VSCode window by running `Developer: Reload Window` from the command palette. ## Customize configuration See [Vite Configuration Reference](https://vitejs.dev/config/). ## Project Setup ```sh npm install ``` ### Compile and Hot-Reload for Development ```sh npm run dev ``` ### Type-Check, Compile and Minify for Production ```sh npm run build ``` ================================================ FILE: frontend/components.d.ts ================================================ /* eslint-disable */ // @ts-nocheck // Generated by unplugin-vue-components // Read more: https://github.com/vuejs/core/pull/3399 // biome-ignore lint: disable export {} /* prettier-ignore */ declare module 'vue' { export interface GlobalComponents { AppConfig: typeof import('./src/components/AppConfig.vue')['default'] AppFooter: typeof import('./src/components/AppFooter.vue')['default'] AppSidebar: typeof import('./src/components/AppSidebar.vue')['default'] AppTopbar: typeof import('./src/components/AppTopbar.vue')['default'] Button: typeof import('primevue/button')['default'] Card: typeof import('primevue/card')['default'] Column: typeof import('primevue/column')['default'] DataTable: typeof import('primevue/datatable')['default'] Divider: typeof import('primevue/divider')['default'] Drawer: typeof import('primevue/drawer')['default'] Empty: typeof import('./src/components/Empty.vue')['default'] FloatLabel: typeof import('primevue/floatlabel')['default'] InputText: typeof import('primevue/inputtext')['default'] Menu: typeof import('primevue/menu')['default'] Message: typeof import('primevue/message')['default'] ProgressBar: typeof import('primevue/progressbar')['default'] ProgressSpinner: typeof import('primevue/progressspinner')['default'] RouterLink: typeof import('vue-router')['RouterLink'] RouterView: typeof import('vue-router')['RouterView'] Tab: typeof import('primevue/tab')['default'] TabList: typeof import('primevue/tablist')['default'] TabPanel: typeof import('primevue/tabpanel')['default'] TabPanels: typeof import('primevue/tabpanels')['default'] Textarea: typeof import('primevue/textarea')['default'] Toast: typeof import('primevue/toast')['default'] } export interface GlobalDirectives { Ripple: typeof import('primevue/ripple')['default'] StyleClass: typeof import('primevue/styleclass')['default'] Tooltip: typeof import('primevue/tooltip')['default'] } } ================================================ FILE: frontend/env.d.ts ================================================ /// ================================================ FILE: frontend/index.html ================================================ ForensicsTool
================================================ FILE: frontend/package.json ================================================ { "name": "primevue-quickstart-create-vue-ts", "version": "0.0.0", "type": "module", "scripts": { "dev": "vite", "build": "run-p type-check build-only", "preview": "vite preview", "build-only": "vite build", "type-check": "vue-tsc --noEmit" }, "dependencies": { "@primeuix/themes": "^1.0.0", "chart.js": "^4.4.8", "echarts": "^6.0.0", "pinia": "^3.0.4", "primeicons": "^7.0.0", "primevue": "^4.3.1", "vue": "^3.4.27", "vue-router": "^4.6.3" }, "devDependencies": { "@primevue/auto-import-resolver": "^4.3.1", "@types/node": "^20.14.2", "@vitejs/plugin-vue": "^5.0.5", "@vue/tsconfig": "^0.5.1", "npm-run-all": "^4.1.5", "typescript": "^5.4.5", "unplugin-vue-components": "^28.4.0", "vite": "^5.2.13", "vue-tsc": "^2.0.21" } } ================================================ FILE: frontend/package.json.md5 ================================================ b9da4125dc6abe1642aa99eb71d943d1 ================================================ FILE: frontend/pnpm-workspace.yaml ================================================ ignoredBuiltDependencies: - esbuild ================================================ FILE: frontend/src/App.vue ================================================ ================================================ FILE: frontend/src/assets/styles/main.css ================================================ @import "primeicons/primeicons.css"; html { box-sizing: border-box; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-family: "Inter", sans-serif; font-optical-sizing: auto; font-variation-settings: normal; font-weight: 400; } /* 全局滚动条样式 */ ::-webkit-scrollbar { width: 6px; height: 6px; } ::-webkit-scrollbar-track { background: transparent; } ::-webkit-scrollbar-thumb { background-color: var(--p-surface-300); border-radius: 3px; transition: background-color 0.2s; } .p-dark ::-webkit-scrollbar-thumb { background-color: var(--p-surface-600); } ::-webkit-scrollbar-thumb:hover { background-color: var(--p-surface-400); } .p-dark ::-webkit-scrollbar-thumb:hover { background-color: var(--p-surface-500); } /* 滚动条交点样式 */ ::-webkit-scrollbar-corner { background: transparent; } body { background-color: var(--p-surface-50); min-height: 100vh; } .p-dark body { background-color: var(--p-surface-950); } .layout-container { background-color: var(--p-surface-50); color: var(--p-surface-950); min-height: 100vh; padding: 2rem; display: flex; flex-direction: column; gap: 1.5rem; } .p-dark .layout-container { background-color: var(--p-surface-950); color: var(--p-surface-0); } /* 重置HTML和body样式,确保页面不被滚动 */ html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; } #app { height: 100vh; overflow: hidden; } .app-layout { background-color: var(--p-surface-50); color: var(--p-surface-950); height: 100%; display: flex; flex-direction: column; } .p-dark .app-layout { background-color: var(--p-surface-950); color: var(--p-surface-0); } .app-body { flex: 1; display: flex; overflow: hidden; min-height: 0; /* 确保flex子项可以收缩 */ } .app-content { flex: 1; overflow-y: hidden; background-color: var(--p-surface-50); height: 100%; } .p-dark .app-content { background-color: var(--p-surface-950); } /* TopBar样式 */ .topbar { background-color: var(--p-surface-200) !important; border-bottom: 1px solid var(--p-surface-200); z-index: 10; } .p-dark .topbar { background-color: var(--p-surface-800) !important; border-bottom-color: var(--p-surface-700); } .topbar-container { display: flex; justify-content: space-between; align-items: center; max-width: 100%; } /* Footer样式 */ .footer { background-color: var(--p-surface-0); border-top: 1px solid var(--p-surface-200); padding: 0.75rem 1.5rem; z-index: 10; } .p-dark .footer { background-color: var(--p-surface-900); border-top-color: var(--p-surface-700); } .footer-container { display: flex; justify-content: space-between; align-items: center; max-width: 100%; } /* 侧边栏样式调整 */ .sidebar { height: 100% !important; display: flex; flex-direction: column; } .layout-grid { display: flex; flex-direction: column; flex: 1; max-width: none; width: 100%; margin: 0 auto; gap: 1.5rem; } .layout-grid-row { display: flex; flex-direction: row; gap: 1.5rem; width: 100%; } .layout-card { background-color: var(--p-surface-0); color: var(--p-surface-950); padding: 1.5rem; border-radius: 0.5rem; border: 1px solid var(--p-surface-200); display: flex; flex-direction: column; gap: 0.5rem; } .p-dark .layout-card { background-color: var(--p-surface-900); color: var(--p-surface-0); border-color: var(--p-surface-700); } .stats { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1.714rem; position: relative; z-index: 0; } .stats-icon-box { flex-shrink: 0; background-color: var(--p-primary-100); color: var(--p-primary-600); border-radius: 0.5rem; width: 2rem; height: 2rem; display: flex; align-items: center; justify-content: center; border: 1px solid var(--p-primary-200); } .p-dark .stats-icon-box { background-color: color-mix(in srgb, var(--p-primary-400), transparent 80%); border-color: color-mix(in srgb, var(--p-primary-400), transparent 70%); color: var(--p-primary-200); } .stats-header { display: flex; align-items: flex-start; gap: 0.5rem; justify-content: space-between; } .stats-title { font-size: 1.25rem; font-weight: 300; line-height: 1.25; color: var(--p-surface-900); } .p-dark .stats-title { color: var(--p-surface-0); } .stats-content { display: flex; flex-direction: column; gap: 0.25rem; width: 100%; } .stats-value { font-size: 1.875rem; font-weight: 500; line-height: 1.25; color: var(--p-surface-900); } .p-dark .stats-value { color: var(--p-surface-0); } .stats-subtitle { color: var(--p-surface-600); font-size: 0.875rem; line-height: 1.25; } .p-dark .stats-subtitle { color: var(--p-surface-400); } .col-item-2 { width: 50%; } /* 统一的结果卡片样式 */ .result-card { background-color: var(--p-surface-0); color: var(--p-surface-950); border: 1px solid var(--p-surface-200); border-radius: 0.5rem; padding: 0.5rem; margin: 0; display: flex; flex-direction: column; flex: 1; overflow: scroll; min-height: 0; } .p-dark .result-card { background-color: var(--p-surface-900); color: var(--p-surface-0); border-color: var(--p-surface-700); } .result-output { white-space: pre-wrap; font-family: monospace; font-size: 0.9rem; line-height: 1.5; color: var(--p-surface-950); } .p-dark .result-output { color: var(--p-surface-0); } .empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 3rem; font-size: 1.2rem; color: var(--p-surface-600); } .p-dark .empty { color: var(--p-surface-400); } /* 统一的表单卡片样式 */ .form-card { background-color: var(--p-surface-0); color: var(--p-surface-950); border: 1px solid var(--p-surface-200); border-radius: 0.5rem; padding: 1rem; margin: 0; box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); } .p-dark .form-card { background-color: var(--p-surface-900); color: var(--p-surface-0); border-color: var(--p-surface-700); } /* 统一的页面容器样式 */ .page-container { padding: 1rem; display: flex; flex-direction: column; height: 100%; gap: 0.75rem; margin: 0; } .chart-header { display: flex; flex-direction: column; gap: 1rem; } .chart-title { font-size: 1rem; font-weight: 500; color: var(--p-surface-900); } .p-dark .chart-title { color: var(--p-surface-0); } .chart-content { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.5rem 0; } .activity-list { display: flex; flex-direction: column; gap: 0.75rem; padding: 0.5rem 0; } .activity-item { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem; border: 1px solid var(--p-surface-200); border-radius: 0.5rem; background-color: var(--p-surface-50); } .p-dark .activity-item { background-color: var(--p-surface-800); border-color: var(--p-surface-700); } .activity-icon { font-size: 1.125rem !important; } .activity-icon.green { color: #22c55e; } .activity-icon.blue { color: #3b82f6; } .activity-icon.yellow { color: #eab308; } .activity-icon.pink { color: #ec4899; } .activity-content { display: flex; flex-direction: column; gap: 0.25rem; } .activity-text { font-size: 0.875rem; font-weight: 500; } .activity-time { font-size: 0.75rem; color: var(--p-surface-600); } .p-dark .activity-time { color: var(--p-surface-400); } .products-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; } @media (max-width: 640px) { .products-header { flex-direction: column; gap: 0.5rem; } .products-header .search-field { width: 100%; } } .products-title { font-size: 1rem; font-weight: 500; color: var(--p-surface-900); } .p-dark .products-title { color: var(--p-surface-0); } .products-table-container { display: flex; flex-direction: column; gap: 0.5rem; background-color: var(--p-surface-0); } .p-dark .products-table-container { background-color: var(--p-surface-900); } .products-table { width: 100%; color: var(--p-surface-900); } .p-dark .products-table { color: var(--p-surface-0); } .products-table-mask { backdrop-filter: blur(4px) !important; background-color: color-mix(in srgb, var(--p-surface-0), transparent 80%) !important; } .p-dark .products-table-mask { background-color: color-mix(in srgb, var(--p-surface-900), transparent 80%) !important; } .products-table-loading { color: var(--p-primary-500) !important; } .products-search { font-size: 0.875rem; padding: 0.5rem; background-color: var(--p-surface-0); color: var(--p-surface-900); border: 1px solid var(--p-surface-200); } .p-dark .products-search { background-color: var(--p-surface-900); color: var(--p-surface-0); border-color: var(--p-surface-700); } @media (min-width: 768px) { .products-search { width: auto !important; } } @media (max-width: 767px) { .products-search { width: 100% !important; } } @media (max-width: 991px) { .stats { grid-template-columns: 1fr 1fr; } .layout-grid-row { flex-direction: column; } .col-item-2 { width: 100%; } } @media (max-width: 480px) { .stats { grid-template-columns: 1fr; } } .topbar { background-color: var(--p-surface-0); padding: 0.15rem; /* border-radius: 1rem; */ max-width: none; margin-left: auto; margin-right: auto; border: 1px solid var(--p-surface-200); width: 100%; } .p-dark .topbar { background-color: var(--p-surface-900); border-color: var(--p-surface-700); } .topbar-container { display: flex; justify-content: space-between; align-items: center; } .topbar-brand { display: flex; gap: 0.75rem; align-items: center; } .topbar-brand-text { display: none; } @media (min-width: 640px) { .topbar-brand-text { display: flex; flex-direction: column; } } .topbar-title { font-size: 1.25rem; font-weight: 300; color: var(--p-surface-700); line-height: 1; } .p-dark .topbar-title { color: var(--p-surface-100); } .topbar-subtitle { font-size: 0.875rem; font-weight: 500; color: var(--p-primary-500); line-height: 1.25; } .topbar-actions { display: flex; align-items: center; gap: 0.5rem; } .topbar-theme-button { width: 2.5rem; height: 2.5rem; display: flex; align-items: center; justify-content: center; border-radius: 9999px; transition: all 0.2s; color: var(--p-surface-900); } .p-dark .topbar-theme-button { color: var(--p-primary-500); } .topbar-theme-button:hover { background-color: var(--p-surface-100); } .p-dark .topbar-theme-button:hover { background-color: var(--p-surface-800); } .topbar-theme-button.topbar-close-button:hover { background-color: #eb050d18 !important; } .fill-primary { fill: var(--p-primary-500); } .p-dark .fill-primary { fill: var(--p-primary-400); } .fill-surface { fill: var(--p-surface-900); } .p-dark .fill-surface { fill: var(--p-surface-0); } .config-panel { position: absolute; top: 4rem; right: 0; width: 16rem; padding: 1rem; background-color: var(--p-surface-0); border-radius: 0.375rem; box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1); border: 1px solid var(--p-surface-200); transform-origin: top; z-index: 50; } .p-dark .config-panel { background-color: var(--p-surface-900); border-color: var(--p-surface-700); } .config-section { display: flex; flex-direction: column; gap: 1rem; } .config-label { font-size: 0.875rem; color: var(--p-surface-600); font-weight: 600; } .p-dark .config-label { color: var(--p-surface-400); } .config-colors { padding-top: 0.5rem; display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: space-between; } .color-button { border: none; width: 1.25rem; height: 1.25rem; border-radius: 9999px; padding: 0; cursor: pointer; } .selected { --ring-offset-shadow: 0 0 0 var(--ring-offset-width) var(--ring-offset-color); --ring-shadow: 0 0 0 calc(var(--ring-width) + var(--ring-offset-width)) var(--ring-color); --ring-width: 2px; --ring-offset-width: 2px; --ring-color: var(--p-primary-500); --ring-offset-color: #ffffff; box-shadow: var(--ring-offset-shadow), var(--ring-shadow); } .hidden { display: none; } .footer { background-color: var(--p-surface-0); padding: 1.5rem; border-radius: 1rem; max-width: none; margin-left: auto; margin-right: auto; border: 1px solid var(--p-surface-200); width: 100%; } .p-dark .footer { background-color: var(--p-surface-900); border-color: var(--p-surface-700); } .footer-container { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; } @media (max-width: 640px) { .footer-container { flex-direction: column; } } .p-select { width: 100%; } .footer-copyright { font-size: 0.875rem; color: var(--p-surface-600); } .p-dark .footer-copyright { color: var(--p-surface-400); } .footer-links { display: flex; gap: 1rem; } .footer-link { color: var(--p-surface-600); font-size: 0.875rem; transition: color 0.2s; } .p-dark .footer-link { color: var(--p-surface-400); } .footer-link:hover { color: var(--p-primary-500); } .footer-icon { font-size: 1.25rem; } .relative { position: relative; } .animate-fadeout { animation: fadeout 0.15s linear; } .animate-scalein { animation: scalein 0.15s linear; } /* PrimeVue组件焦点状态样式适配 */ /* InputText组件样式 */ .p-inputtext { border-color: var(--p-surface-300); transition: border-color 0.3s, box-shadow 0.3s; } .p-inputtext:enabled:focus { border-color: var(--p-primary-500) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-500), transparent 80%); } .p-dark .p-inputtext { border-color: var(--p-surface-600); } .p-dark .p-inputtext:enabled:focus { border-color: var(--p-primary-400) !important; box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-400), transparent 70%); } /* Select/Dropdown组件样式 */ .p-dropdown { border-color: var(--p-surface-300); transition: border-color 0.3s, box-shadow 0.3s; } .p-dropdown:focus { outline: none; border-color: var(--p-primary-500); box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-500), transparent 80%); } .p-dark .p-dropdown { border-color: var(--p-surface-600); } .p-dark .p-dropdown:focus { border-color: var(--p-primary-400); box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-400), transparent 70%); } /* Button组件样式 */ .p-button { transition: box-shadow 0.3s; } .p-button:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-500), transparent 80%); } .p-dark .p-button:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-400), transparent 70%); } /* DataTable组件样式 */ .p-datatable { transition: background-color 0.3s; } .p-datatable .p-datatable-tbody > tr:focus { outline: none; background-color: color-mix(in srgb, var(--p-primary-500), transparent 90%); } .p-dark .p-datatable .p-datatable-tbody > tr:focus { background-color: color-mix(in srgb, var(--p-primary-400), transparent 85%); } .p-datatable-tbody > tr > td { /* text-overflow: ellipsis !important; */ max-width: 20vw; overflow: scroll !important; /* white-space: nowrap !important; */ word-wrap: break-word !important; } /* Tabs组件样式 */ .p-tabs .p-tabs-nav li .p-tabs-nav-link { transition: box-shadow 0.3s; } .p-tabs .p-tabs-nav li .p-tabs-nav-link:focus { outline: none; box-shadow: inset 0 -2px 0 var(--p-primary-500); } .p-dark .p-tabs .p-tabs-nav li .p-tabs-nav-link:focus { box-shadow: inset 0 -2px 0 var(--p-primary-400); } .p-tabpanels { padding: 0 !important; } /* Menu组件样式 */ .p-menuitem-link { transition: background-color 0.3s; } .p-menuitem-link:focus { outline: none; background-color: color-mix(in srgb, var(--p-primary-500), transparent 90%); } .p-dark .p-menuitem-link:focus { background-color: color-mix(in srgb, var(--p-primary-400), transparent 85%); } /* InputSwitch组件样式 */ .p-inputswitch { transition: box-shadow 0.3s; } .p-inputswitch:focus { outline: none; box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-500), transparent 80%); } .p-dark .p-inputswitch:focus { box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-400), transparent 70%); } /* Calendar组件样式 */ .p-datepicker { border-color: var(--p-surface-300); transition: border-color 0.3s, box-shadow 0.3s; } .p-datepicker:focus { outline: none; border-color: var(--p-primary-500); box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-500), transparent 80%); } .p-dark .p-datepicker { border-color: var(--p-surface-600); } .p-dark .p-datepicker:focus { border-color: var(--p-primary-400); box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-400), transparent 70%); } /* InputNumber组件样式 */ .p-inputnumber { border-color: var(--p-surface-300); transition: border-color 0.3s, box-shadow 0.3s; } .p-inputnumber:focus { outline: none; border-color: var(--p-primary-500); box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-500), transparent 80%); } .p-dark .p-inputnumber { border-color: var(--p-surface-600); } .p-dark .p-inputnumber:focus { border-color: var(--p-primary-400); box-shadow: 0 0 0 2px color-mix(in srgb, var(--p-primary-400), transparent 70%); } .p-select:not(.p-disabled).p-focus { border-color: var(--p-primary-600) !important; } /* Card组件样式 */ .p-card { background-color: var(--p-surface-0); color: var(--p-surface-950); border: 1px solid var(--p-primary-500) !important; transition: border-color 0.3s, box-shadow 0.3s; } .p-dark .p-card { background-color: var(--p-surface-900); color: var(--p-surface-0); border-color: var(--p-primary-700) !important; } /* FloatLabel组件样式 */ .p-floatlabel-on { color: var(--p-surface-600); } .p-floatlabel-on:has(input:focus) label { color: var(--p-primary-500); background-color: rgba(red, green, blue, 1); } /* .p-floatlabel-on:has(input[placeholder]) label { background-color: transparent !important; } */ .p-dark .p-floatlabel-on { color: var(--p-surface-400); } .p-dark .p-floatlabel-on:has(input:focus) label { color: var(--p-primary-400); background-color: rgba(red, green, blue, 1); } .p-floatlabel { color: var(--p-surface-600); } .p-floatlabel:has(input:focus) label, .p-floatlabel:has(input.p-filled) label { color: var(--p-primary-500) !important; background-color: rgba(red, green, blue, 1); } .p-dark .p-floatlabel { color: var(--p-surface-400); } .p-dark .p-floatlabel:has(input:focus) label, .p-floatlabel:has(input.p-filled) label { color: var(--p-primary-400) !important; background-color: rgba(red, green, blue, 1); } /* Column组件样式(DataTable内部) */ .p-column { transition: background-color 0.3s; } .p-column:focus { outline: none; background-color: color-mix(in srgb, var(--p-primary-500), transparent 90%); } .p-dark .p-column:focus { background-color: color-mix(in srgb, var(--p-primary-400), transparent 85%); } /* TabPanel组件样式 */ .p-tabpanel { background-color: var(--p-surface-0); color: var(--p-surface-950); transition: background-color 0.3s; } .p-dark .p-tabpanel { background-color: var(--p-surface-900); color: var(--p-surface-0); } /* Toast组件样式 */ .p-toast { background-color: var(--p-surface-0); color: var(--p-surface-950); /* border: 1px solid var(--p-surface-200); */ } .p-dark .p-toast { background-color: var(--p-surface-900); color: var(--p-surface-0); border-color: var(--p-surface-700); } .p-toast-message { background-color: var(--p-surface-0); color: var(--p-surface-950); border: 1px solid var(--p-surface-200); } .p-dark .p-toast-message { background-color: var(--p-surface-900); color: var(--p-surface-0); border-color: var(--p-surface-700); } .p-toast-message-success { background-color: color-mix(in srgb, var(--p-green-500), transparent 90%); border-color: var(--p-green-500); color: var(--p-green-700); } .p-dark .p-toast-message-success { background-color: color-mix(in srgb, var(--p-green-400), transparent 85%); border-color: var(--p-green-400); color: var(--p-green-300); } .p-toast-message-error { background-color: color-mix(in srgb, var(--p-red-500), transparent 90%); border-color: var(--p-red-500); color: var(--p-red-700); } .p-dark .p-toast-message-error { background-color: color-mix(in srgb, var(--p-red-400), transparent 85%); border-color: var(--p-red-400); color: var(--p-red-300); } .p-toast-message-warn { background-color: color-mix(in srgb, var(--p-orange-500), transparent 90%); border-color: var(--p-orange-500); color: var(--p-orange-700); } .p-dark .p-toast-message-warn { background-color: color-mix(in srgb, var(--p-orange-400), transparent 85%); border-color: var(--p-orange-400); color: var(--p-orange-300); } .p-toast-message-info { background-color: color-mix(in srgb, var(--p-blue-500), transparent 90%); border-color: var(--p-blue-500); color: var(--p-blue-700); } .p-dark .p-toast-message-info { background-color: color-mix(in srgb, var(--p-blue-400), transparent 85%); border-color: var(--p-blue-400); color: var(--p-blue-300); } /* 公共表单布局样式 */ .form-layout { display: flex; flex-direction: column; gap: 0.75rem; } /* 输入行布局 - 一行两个输入框 */ .input-row { display: flex; gap: 0.75rem; width: 100%; } /* 按钮行布局 - 等分宽度 */ .button-row { display: flex; gap: 0.75rem; width: 100%; margin-top: 0.5rem; } .field { display: flex; flex-direction: column; gap: 0.25rem; } /* 全宽字段 - 用于下拉选择框 */ .field.full-width, .field > .full-width { width: 100%; } /* 半宽字段 - 用于文本输入框 */ .field.half-width { flex: 1; } .field label { margin-bottom: 0.25rem; font-weight: 500; color: var(--text-color); } /* 等宽按钮 */ .button.equal-width { flex: 1; border-radius: 4px; } .p-progressbar.equal-width { flex: 1; border-radius: 4px; } /* 结果输出样式 */ .result-output { white-space: pre-wrap; font-family: monospace; font-size: 0.9rem; line-height: 1.5; color: var(--p-surface-950); } .p-dark .result-output { color: var(--p-surface-0); } .result-container { flex: 1; overflow: auto; border: 1px solid var(--p-surface-200); border-radius: 4px; padding: 1rem; background-color: var(--p-surface-50); } .p-dark .result-container { border-color: var(--p-surface-700); background-color: var(--p-surface-800); } /* 空状态样式 */ .empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; padding: 3rem; font-size: 1.2rem; color: var(--p-surface-600); } .p-dark .empty { color: var(--p-surface-400); } /* 公共PrimeVue组件样式调整 */ .p-dropdown { width: 100%; } .p-inputtext { width: 100%; } .p-button { margin: 0.25rem; } .p-datatable { font-size: 0.875rem; } .p-tabs { margin-top: -1.5rem; flex: 1; display: flex; flex-direction: column; } .p-tabs .p-tabview-panels { flex: 1; display: flex; flex-direction: column; } .p-tabs .p-tabview-panel { flex: 1; display: flex; flex-direction: column; } /* 响应式调整 */ @media (max-width: 768px) { .form-card { padding: 0.5rem; } .input-row { flex-direction: column; } .button-row { flex-direction: column; } .p-datatable { font-size: 0.75rem; } } /* Tooltip组件样式 */ .p-tooltip { color: var(--p-surface-0); max-width: 30vw !important; } .p-dark .p-tooltip { color: var(--p-surface-950); } /* 通用焦点状态样式 */ *:focus-visible { outline: 2px solid var(--p-primary-500); outline-offset: 2px; } .p-dark *:focus-visible { outline: 2px solid var(--p-primary-400); } @keyframes fadeout { 0% { opacity: 1; } 100% { opacity: 0; } } @keyframes scalein { 0% { opacity: 0; transform: scaleY(0.8); transition: transform 0.12s cubic-bezier(0, 0, 0.2, 1), opacity 0.12s cubic-bezier(0, 0, 0.2, 1); } 100% { opacity: 1; transform: scaleY(1); } } .p-progressbar-label { color: var(--p-surface-700) !important; } .p-dark .p-progressbar-label { color: var(--p-surface-300) !important; } /* 视图控制区域样式 */ .view-controls { display: flex; justify-content: space-between; align-items: center; background-color: var(--surface-card); border-top: 1px solid var(--surface-border); border-bottom: 1px solid var(--surface-border); } /* 视图切换按钮组样式 */ .view-switch-buttons { display: flex; gap: 0.5rem; } /* 折叠按钮样式 */ .collapse-button { display: flex; justify-content: center; align-items: center; width: 30px; height: 30px; cursor: pointer; border-radius: 4px; transition: all 0.2s ease; } .collapse-button:hover { background-color: var(--surface-hover); } .collapse-button i { font-size: 0.8rem; color: var(--text-color-secondary); } /* 卡片收起状态样式 */ .form-card.collapsed { height: 0; opacity: 0; margin: 0; padding: 0; border: none; } .card-content.collapsed-content { max-height: 0; opacity: 0; overflow: hidden; margin: 0; padding: 0; } /* 按钮行样式 */ .button-item { flex: 1; min-width: 120px; } /* 固定表头宽度样式 */ .fixed-header-table .p-datatable-thead > tr > th { position: sticky !important; top: 0 !important; z-index: 10 !important; background-color: var(--surface-card) !important; box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important; min-width: inherit !important; max-width: inherit !important; width: inherit !important; } .fixed-header-table .p-datatable-tbody > tr > td { min-width: inherit !important; max-width: inherit !important; width: inherit !important; } /* 确保表格在滚动时列宽保持一致 */ .fixed-header-table .p-datatable-scrollable-header { overflow: hidden !important; } .fixed-header-table .p-datatable-scrollable-body { overflow: auto !important; } /* 防止内容溢出 */ .fixed-header-table .p-datatable-scrollable-body td { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } ================================================ FILE: frontend/src/components/AppConfig.vue ================================================ ================================================ FILE: frontend/src/components/AppFooter.vue ================================================ ================================================ FILE: frontend/src/components/AppSidebar.vue ================================================ ================================================ FILE: frontend/src/components/AppTopbar.vue ================================================ ================================================ FILE: frontend/src/components/Empty.vue ================================================ ================================================ FILE: frontend/src/composables/useLayout.js ================================================ import { updatePrimaryPalette, updateSurfacePalette } from "@primeuix/themes"; import { computed, ref, watchEffect } from "vue"; // 从localStorage读取配置或使用默认值 const getStoredConfig = () => { try { const stored = localStorage.getItem('forensics-tool-theme'); if (stored) { return JSON.parse(stored); } } catch (e) { console.error('Failed to parse theme config from localStorage:', e); } // 默认配置 return { primary: "emerald", surface: "slate", darkMode: true }; }; // 保存配置到localStorage const saveConfigToStorage = (config) => { try { localStorage.setItem('forensics-tool-theme', JSON.stringify(config)); } catch (e) { console.error('Failed to save theme config to localStorage:', e); } }; const appState = ref(getStoredConfig()); // 监听配置变化并保存到localStorage watchEffect(() => { saveConfigToStorage(appState.value); }); const primaryColors = ref([ { name: 'noir', palette: { 50: "{zinc.50}", 100: "{zinc.100}", 200: "{zinc.200}", 300: "{zinc.300}", 400: "{zinc.400}", 500: "{zinc.500}", 600: "{zinc.600}", 700: "{zinc.700}", 800: "{zinc.800}", 900: "{zinc.900}", 950: "{zinc.950}" }, }, { name: "emerald", palette: { 50: "#ecfdf5", 100: "#d1fae5", 200: "#a7f3d0", 300: "#6ee7b7", 400: "#34d399", 500: "#10b981", 600: "#059669", 700: "#047857", 800: "#065f46", 900: "#064e3b", 950: "#022c22" } }, { name: "green", palette: { 50: "#f0fdf4", 100: "#dcfce7", 200: "#bbf7d0", 300: "#86efac", 400: "#4ade80", 500: "#22c55e", 600: "#16a34a", 700: "#15803d", 800: "#166534", 900: "#14532d", 950: "#052e16" } }, { name: "lime", palette: { 50: "#f7fee7", 100: "#ecfccb", 200: "#d9f99d", 300: "#bef264", 400: "#a3e635", 500: "#84cc16", 600: "#65a30d", 700: "#4d7c0f", 800: "#3f6212", 900: "#365314", 950: "#1a2e05" } }, { name: "orange", palette: { 50: "#fff7ed", 100: "#ffedd5", 200: "#fed7aa", 300: "#fdba74", 400: "#fb923c", 500: "#f97316", 600: "#ea580c", 700: "#c2410c", 800: "#9a3412", 900: "#7c2d12", 950: "#431407" } }, { name: "amber", palette: { 50: "#fffbeb", 100: "#fef3c7", 200: "#fde68a", 300: "#fcd34d", 400: "#fbbf24", 500: "#f59e0b", 600: "#d97706", 700: "#b45309", 800: "#92400e", 900: "#78350f", 950: "#451a03" } }, { name: "yellow", palette: { 50: "#fefce8", 100: "#fef9c3", 200: "#fef08a", 300: "#fde047", 400: "#facc15", 500: "#eab308", 600: "#ca8a04", 700: "#a16207", 800: "#854d0e", 900: "#713f12", 950: "#422006" } }, { name: "teal", palette: { 50: "#f0fdfa", 100: "#ccfbf1", 200: "#99f6e4", 300: "#5eead4", 400: "#2dd4bf", 500: "#14b8a6", 600: "#0d9488", 700: "#0f766e", 800: "#115e59", 900: "#134e4a", 950: "#042f2e" } }, { name: "cyan", palette: { 50: "#ecfeff", 100: "#cffafe", 200: "#a5f3fc", 300: "#67e8f9", 400: "#22d3ee", 500: "#06b6d4", 600: "#0891b2", 700: "#0e7490", 800: "#155e75", 900: "#164e63", 950: "#083344" } }, { name: "sky", palette: { 50: "#f0f9ff", 100: "#e0f2fe", 200: "#bae6fd", 300: "#7dd3fc", 400: "#38bdf8", 500: "#0ea5e9", 600: "#0284c7", 700: "#0369a1", 800: "#075985", 900: "#0c4a6e", 950: "#082f49" } }, { name: "blue", palette: { 50: "#eff6ff", 100: "#dbeafe", 200: "#bfdbfe", 300: "#93c5fd", 400: "#60a5fa", 500: "#3b82f6", 600: "#2563eb", 700: "#1d4ed8", 800: "#1e40af", 900: "#1e3a8a", 950: "#172554" } }, { name: "indigo", palette: { 50: "#eef2ff", 100: "#e0e7ff", 200: "#c7d2fe", 300: "#a5b4fc", 400: "#818cf8", 500: "#6366f1", 600: "#4f46e5", 700: "#4338ca", 800: "#3730a3", 900: "#312e81", 950: "#1e1b4b" } }, { name: "violet", palette: { 50: "#f5f3ff", 100: "#ede9fe", 200: "#ddd6fe", 300: "#c4b5fd", 400: "#a78bfa", 500: "#8b5cf6", 600: "#7c3aed", 700: "#6d28d9", 800: "#5b21b6", 900: "#4c1d95", 950: "#2e1065" } }, { name: "purple", palette: { 50: "#faf5ff", 100: "#f3e8ff", 200: "#e9d5ff", 300: "#d8b4fe", 400: "#c084fc", 500: "#a855f7", 600: "#9333ea", 700: "#7e22ce", 800: "#6b21a8", 900: "#581c87", 950: "#3b0764" } }, { name: "fuchsia", palette: { 50: "#fdf4ff", 100: "#fae8ff", 200: "#f5d0fe", 300: "#f0abfc", 400: "#e879f9", 500: "#d946ef", 600: "#c026d3", 700: "#a21caf", 800: "#86198f", 900: "#701a75", 950: "#4a044e" } }, { name: "pink", palette: { 50: "#fdf2f8", 100: "#fce7f3", 200: "#fbcfe8", 300: "#f9a8d4", 400: "#f472b6", 500: "#ec4899", 600: "#db2777", 700: "#be185d", 800: "#9d174d", 900: "#831843", 950: "#500724" } }, { name: "rose", palette: { 50: "#fff1f2", 100: "#ffe4e6", 200: "#fecdd3", 300: "#fda4af", 400: "#fb7185", 500: "#f43f5e", 600: "#e11d48", 700: "#be123c", 800: "#9f1239", 900: "#881337", 950: "#4c0519" } } ]); const surfaces = ref([ { name: "slate", palette: { 0: "#ffffff", 50: "#f8fafc", 100: "#f1f5f9", 200: "#e2e8f0", 300: "#cbd5e1", 400: "#94a3b8", 500: "#64748b", 600: "#475569", 700: "#334155", 800: "#1e293b", 900: "#0f172a", 950: "#020617" } }, { name: "gray", palette: { 0: "#ffffff", 50: "#f9fafb", 100: "#f3f4f6", 200: "#e5e7eb", 300: "#d1d5db", 400: "#9ca3af", 500: "#6b7280", 600: "#4b5563", 700: "#374151", 800: "#1f2937", 900: "#111827", 950: "#030712" } }, { name: "zinc", palette: { 0: "#ffffff", 50: "#fafafa", 100: "#f4f4f5", 200: "#e4e4e7", 300: "#d4d4d8", 400: "#a1a1aa", 500: "#71717a", 600: "#52525b", 700: "#3f3f46", 800: "#27272a", 900: "#18181b", 950: "#09090b" } }, { name: "neutral", palette: { 0: "#ffffff", 50: "#fafafa", 100: "#f5f5f5", 200: "#e5e5e5", 300: "#d4d4d4", 400: "#a3a3a3", 500: "#737373", 600: "#525252", 700: "#404040", 800: "#262626", 900: "#171717", 950: "#0a0a0a" } }, { name: "stone", palette: { 0: "#ffffff", 50: "#fafaf9", 100: "#f5f5f4", 200: "#e7e5e4", 300: "#d6d3d1", 400: "#a8a29e", 500: "#78716c", 600: "#57534e", 700: "#44403c", 800: "#292524", 900: "#1c1917", 950: "#0c0a09" } }, { name: "soho", palette: { 0: "#ffffff", 50: "#f4f4f4", 100: "#e8e9e9", 200: "#d2d2d4", 300: "#bbbcbe", 400: "#a5a5a9", 500: "#8e8f93", 600: "#77787d", 700: "#616268", 800: "#4a4b52", 900: "#34343d", 950: "#1d1e27" } }, { name: "viva", palette: { 0: "#ffffff", 50: "#f3f3f3", 100: "#e7e7e8", 200: "#cfd0d0", 300: "#b7b8b9", 400: "#9fa1a1", 500: "#87898a", 600: "#6e7173", 700: "#565a5b", 800: "#3e4244", 900: "#262b2c", 950: "#0e1315" } }, { name: "ocean", palette: { 0: "#ffffff", 50: "#fbfcfc", 100: "#F7F9F8", 200: "#EFF3F2", 300: "#DADEDD", 400: "#B1B7B6", 500: "#828787", 600: "#5F7274", 700: "#415B61", 800: "#29444E", 900: "#183240", 950: "#0c1920" } } ]); export function useLayout() { function setPrimary(value) { appState.value.primary = value; } function setSurface(value) { appState.value.surface = value; } function setDarkMode(value) { appState.value.darkMode = value; if (value) { document.documentElement.classList.add("p-dark"); } else { document.documentElement.classList.remove("p-dark"); } } function toggleDarkMode() { appState.value.darkMode = !appState.value.darkMode; document.documentElement.classList.toggle("p-dark"); } function updateColors(type, colorName) { if (type === "primary") { setPrimary(colorName); const color = primaryColors.value.find((c) => c.name === colorName); updatePrimaryPalette(color.palette); } else if (type === "surface") { setSurface(colorName); const surfaceColor = surfaces.value.find((s) => s.name === colorName); updateSurfacePalette(surfaceColor.palette); } } const isDarkMode = computed(() => appState.value.darkMode); const primary = computed(() => appState.value.primary); const surface = computed(() => appState.value.surface); // 初始化时应用保存的主题设置 const initTheme = () => { // 应用暗黑模式设置 if (appState.value.darkMode) { document.documentElement.classList.add("p-dark"); } else { document.documentElement.classList.remove("p-dark"); } // 应用主色调 const primaryColor = primaryColors.value.find((c) => c.name === appState.value.primary); if (primaryColor) { updatePrimaryPalette(primaryColor.palette); } // 应用表面色调 const surfaceColor = surfaces.value.find((s) => s.name === appState.value.surface); if (surfaceColor) { updateSurfacePalette(surfaceColor.palette); } }; // 初始化主题 initTheme(); return { primaryColors, surfaces, isDarkMode, primary, surface, toggleDarkMode, setDarkMode, setPrimary, setSurface, updateColors, initTheme }; } ================================================ FILE: frontend/src/composables/useTableHeight.js ================================================ import { ref, nextTick } from 'vue' /** * 计算表格的动态高度 * @param {Ref} resultCardRef - 结果卡片的引用 * @param {Ref} tableScrollHeight - 表格滚动高度的响应式引用 * @param {number} offsetHeight - 额外偏移高度,默认为120px * @param {number} minHeight - 最小高度,默认为200px */ export function useTableHeight(resultCardRef, tableScrollHeight, offsetHeight = 120, minHeight = 200) { /** * 计算表格高度 */ const calculateTableHeight = () => { if (resultCardRef.value) { // 获取结果卡片的高度 const cardHeight = resultCardRef.value.$el.offsetHeight // 计算表格高度(卡片高度减去其他元素的高度,如标题、按钮等) const calculatedHeight = cardHeight - offsetHeight // 设置最小高度 const finalHeight = Math.max(calculatedHeight, minHeight) // 将像素值转换为vh单位 const vhValue = (finalHeight / window.innerHeight) * 100 tableScrollHeight.value = `${vhValue+4}vh` } } /** * 窗口大小变化处理函数 */ const handleResize = () => { nextTick(() => { calculateTableHeight() }) } return { calculateTableHeight, handleResize } } ================================================ FILE: frontend/src/main.ts ================================================ import "./assets/styles/main.css"; import { createApp } from "vue"; import PrimeVue from "primevue/config"; import Aura from "@primeuix/themes/aura"; import router from "./router"; // @ts-ignore import App from "./App.vue"; import ToastService from 'primevue/toastservice'; import Tooltip from 'primevue/tooltip'; import store from "./store"; const app = createApp(App); app.use(PrimeVue, { theme: { preset: Aura, options: { darkModeSelector: ".p-dark", }, }, }); app.use(ToastService); app.use(store); app.use(router); app.directive('tooltip', Tooltip); app.mount("#app"); ================================================ FILE: frontend/src/router/index.ts ================================================ import { createRouter, createWebHistory } from 'vue-router'; // @ts-ignore import KeyCalculation from '../views/KeyCalculation.vue'; // @ts-ignore import DatabaseDecrypt from '../views/DatabaseDecrypt.vue'; // @ts-ignore import DataExtraction from '../views/DataExtraction.vue'; // @ts-ignore import RegistryAnalysis from '../views/RegistryAnalysis.vue'; // @ts-ignore import TimestampParser from '../views/TimestampParser.vue'; // @ts-ignore import BruteForce from '../views/BruteForce.vue'; // @ts-ignore import FileReader from '../views/FileReader.vue'; // @ts-ignore import About from '../views/About.vue'; // @ts-ignore import IPLocation from '../views/IPLocation.vue'; const routes = [ { path: '/', redirect: '/KeyCalculation' }, { path: '/KeyCalculation', name: 'KeyCalculation', component: KeyCalculation }, { path: '/DatabaseDecrypt', name: 'DatabaseDecrypt', component: DatabaseDecrypt }, { path: '/DataExtraction', name: 'DataExtraction', component: DataExtraction }, { path: '/RegistryAnalysis', name: 'RegistryAnalysis', component: RegistryAnalysis }, { path: '/TimestampParser', name: 'TimestampParser', component: TimestampParser }, { path: '/BruteForce', name: 'BruteForce', component: BruteForce }, { path: '/FileReader', name: 'FileReader', component: FileReader }, { path: '/IPLocation', name: 'IPLocation', component: IPLocation }, { path: '/About', name: 'About', component: About } ]; const router = createRouter({ history: createWebHistory(), routes }); export default router; ================================================ FILE: frontend/src/store/index.ts ================================================ import { createPinia } from 'pinia'; const store = createPinia(); export default store; export * from './modules/page'; ================================================ FILE: frontend/src/store/modules/page.ts ================================================ import { defineStore } from 'pinia'; interface PageDataState { keyCalculationStore: any | null; databaseDecryptStore: any | null; dataExtractionStore: any | null; registryStore: any | null; bruteForceStore: any | null; timestampStore: any | null; fileReaderStore: any | null; ipLocationStore: any | null; isCardCollapsed: boolean | null; } export const usePageDataStore = defineStore('pageData', { state: (): PageDataState => ({ keyCalculationStore: null, databaseDecryptStore: null, dataExtractionStore: null, registryStore: null, bruteForceStore: null, timestampStore: null, fileReaderStore: null, ipLocationStore: null, isCardCollapsed: null, }), actions: { saveKeyCalculationData(data: any) { this.keyCalculationStore = data; }, saveDatabaseDecryptData(data: any) { this.databaseDecryptStore = data; }, saveDataExtractionData(data: any) { this.dataExtractionStore = data; }, saveRegistryData(data: any) { this.registryStore = data; }, saveBruteForceData(data: any) { this.bruteForceStore = data; }, saveTimestampData(data: any) { this.timestampStore = data; }, saveFileReaderData(data: any) { this.fileReaderStore = data; }, saveIPLocationData(data: any) { this.ipLocationStore = data; }, // 获取爆破状态 getBruteForceCrackingState(): boolean { return this.bruteForceStore?.cracking || false; }, // 更新爆破状态 updateBruteForceCrackingState(cracking: boolean) { if (!this.bruteForceStore) { this.bruteForceStore = {}; } this.bruteForceStore.cracking = cracking; }, // 设置卡片折叠状态 setCardCollapsed(collapsed: boolean) { this.isCardCollapsed = collapsed; }, // 获取卡片折叠状态 getCardCollapsed(): boolean { return this.isCardCollapsed || false; } }, }); ================================================ FILE: frontend/src/utils.js ================================================ // 工具函数集合 /** * 生成普通文本输出 * @param {string} text - 文本内容 * @param {string} color - 文本颜色 * @returns {string} 带样式的HTML字符串 */ export function generateNormalTextOutput(text, color = 'black') { return `${text}
`; } /** * 生成成功文本输出 * @param {string} label - 标签文本 * @param {string} value - 值文本 * @returns {string} 带样式的HTML字符串 */ export function generateSuccessTextOutput(label, value) { return `${label}: ${value}
`; } /** * 生成错误文本输出 * @param {string} text - 文本内容 * @returns {string} 带样式的HTML字符串 */ export function generateErrorTextOutput(text) { return `${text}
`; } /** * 生成警告文本输出 * @param {string} text - 文本内容 * @returns {string} 带样式的HTML字符串 */ export function generateWarningTextOutput(text) { return `${text}
`; } /** * 生成信息文本输出 * @param {string} text - 文本内容 * @returns {string} 带样式的HTML字符串 */ export function generateInfoTextOutput(text) { return `${text}
`; } ================================================ FILE: frontend/src/views/About.vue ================================================ ================================================ FILE: frontend/src/views/BruteForce.vue ================================================ ================================================ FILE: frontend/src/views/DataExtraction.vue ================================================ ================================================ FILE: frontend/src/views/DatabaseDecrypt.vue ================================================ ================================================ FILE: frontend/src/views/FileReader.vue ================================================ ================================================ FILE: frontend/src/views/IPLocation.vue ================================================