├── .github └── workflows │ └── build.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README-zh_CN.md ├── README.md ├── compile.sh ├── dict.dic ├── doc ├── icon.png ├── interface-en.png └── interface-zh_CN.png ├── forge.config.js ├── package-lock.json ├── package.json └── src ├── command.js ├── execUtils.js ├── i18n.js ├── icons ├── icon.icns ├── icon.ico └── icon.png ├── locales ├── en.json └── zh-CN.json ├── main.js ├── preload.js ├── renderer ├── assets │ ├── font │ │ └── SourceCodePro-Regular.ttf │ └── icon │ │ ├── 16 │ │ └── drag.png │ │ ├── 128 │ │ └── drag.png │ │ └── svg │ │ ├── close.svg │ │ ├── del.svg │ │ ├── icon.svg │ │ ├── locked.svg │ │ ├── minimize.svg │ │ ├── rename.svg │ │ ├── save.svg │ │ ├── settings.svg │ │ ├── stop.svg │ │ ├── timer.svg │ │ ├── tools.svg │ │ ├── trash.svg │ │ └── unlock.svg ├── css │ ├── about.css │ ├── dumpComparator.css │ ├── dumpEditor.css │ ├── dumpHistory.css │ ├── index.css │ ├── scrollBar.css │ └── subWindow.css ├── html │ ├── about.html │ ├── dictTest.html │ ├── dumpComparator.html │ ├── dumpEditor.html │ ├── dumpHistory.html │ ├── hardNested.html │ ├── index.html │ ├── inputkeys.html │ └── settings.html └── js │ ├── dumpComparator.js │ ├── dumpEditor.js │ ├── dumpHistory.js │ ├── i18n.js │ ├── index.js │ ├── jquery-3.6.3.min.js │ └── utils.js ├── status.js └── windows.js /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: build 2 | 3 | on: 4 | push: 5 | branches: [ "main" ] 6 | paths-ignore: 7 | - 'doc/**' 8 | - 'README*' 9 | - '.github/**' 10 | workflow_dispatch: 11 | 12 | jobs: 13 | build: 14 | name: Build (${{ matrix.os }}) 15 | runs-on: ${{ matrix.os }} 16 | strategy: 17 | matrix: 18 | os: [ ubuntu-latest, windows-latest, macOS-latest, macOS(ARM64) ] 19 | 20 | outputs: 21 | should_release: ${{ steps.whether_release.outputs.should_release }} 22 | 23 | steps: 24 | - name: Setup MSYS2 (Windows) 25 | if: runner.os == 'Windows' 26 | uses: msys2/setup-msys2@v2 27 | with: 28 | msystem: mingw64 29 | 30 | - name: Clean up (macOS(ARM64)) 31 | if: matrix.os == 'macOS(ARM64)' 32 | run: rm -rf * 33 | 34 | - uses: actions/checkout@v3 35 | with: 36 | submodules: 'recursive' 37 | 38 | - name: install dependencies (macOS) 39 | if: runner.os == 'macOS' 40 | run: brew install autoconf automake libtool pkg-config 41 | 42 | - name: install dependencies (Ubuntu) 43 | if: runner.os == 'Linux' 44 | run: sudo apt-get install liblzma-dev libreadline-dev 45 | 46 | - name: Compile core files (Unix) 47 | if: runner.os != 'Windows' 48 | run: sh ./compile.sh 49 | 50 | - name: Compile core files (Windows) 51 | if: runner.os == 'Windows' 52 | shell: msys2 {0} 53 | run: sh ./compile.sh 54 | 55 | - name: Use Node.js 56 | uses: actions/setup-node@v3 57 | with: 58 | node-version: '18.x' 59 | cache: 'npm' 60 | 61 | - name: Install dependencies 62 | run: npm ci 63 | 64 | - name: Compile GUI 65 | env: 66 | NFCTOOLSGUI_COMPILER: "Github Actions" 67 | run: npm run make 68 | 69 | - name: Find output files (Unix) 70 | if: runner.os != 'Windows' 71 | run: | 72 | EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) 73 | echo "output_files<<$EOF" >> $GITHUB_ENV 74 | find out/make/zip -name "*.zip" >> $GITHUB_ENV 75 | echo "$EOF" >> $GITHUB_ENV 76 | 77 | - name: Find output files (Windows) 78 | if: runner.os == 'Windows' 79 | shell: msys2 {0} 80 | run: | 81 | EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) 82 | echo "output_files<<$EOF" >> $GITHUB_ENV 83 | find out/make/zip -name "*.zip" >> $GITHUB_ENV 84 | echo "$EOF" >> $GITHUB_ENV 85 | 86 | - name: Upload artifact 87 | uses: actions/upload-artifact@v3 88 | with: 89 | name: NFCToolsGUI-${{ runner.os }}-${{ runner.arch }} 90 | path: ${{ env.output_files }} 91 | 92 | - name: Determine whether release 93 | id: whether_release 94 | if: matrix.os == 'ubuntu-latest' 95 | run: | 96 | if [[ "${{ github.event.head_commit.message }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then 97 | echo "should_release=true" >> $GITHUB_OUTPUT 98 | fi 99 | 100 | release: 101 | name: Release 102 | needs: build 103 | if: needs.build.outputs.should_release 104 | runs-on: ubuntu-latest 105 | 106 | permissions: 107 | contents: write 108 | 109 | steps: 110 | - uses: actions/download-artifact@v3 111 | 112 | - name: Find zip files 113 | id: find-zip-files 114 | run: | 115 | EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) 116 | echo "articact_files<<$EOF" >> $GITHUB_ENV 117 | find . -name "*.zip" >> $GITHUB_ENV 118 | echo "$EOF" >> $GITHUB_ENV 119 | 120 | - name: Release 121 | uses: softprops/action-gh-release@v1 122 | with: 123 | tag_name: ${{ github.event.head_commit.message }} 124 | files: ${{ env.articact_filesS }} 125 | generate_release_notes: true 126 | prerelease: true 127 | 128 | - uses: geekyeggo/delete-artifact@v2 129 | with: 130 | name: '*' 131 | failOnError: false 132 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | .DS_Store 18 | 19 | # Directory for instrumented libs generated by jscoverage/JSCover 20 | lib-cov 21 | 22 | # Coverage directory used by tools like istanbul 23 | coverage 24 | *.lcov 25 | 26 | # nyc test coverage 27 | .nyc_output 28 | 29 | # node-waf configuration 30 | .lock-wscript 31 | 32 | # Compiled binary addons (https://nodejs.org/api/addons.html) 33 | build/Release 34 | 35 | # Dependency directories 36 | node_modules/ 37 | jspm_packages/ 38 | 39 | # TypeScript v1 declaration files 40 | typings/ 41 | 42 | # TypeScript cache 43 | *.tsbuildinfo 44 | 45 | # Optional npm cache directory 46 | .npm 47 | 48 | # Optional eslint cache 49 | .eslintcache 50 | 51 | # Optional REPL history 52 | .node_repl_history 53 | 54 | # Output of 'npm pack' 55 | *.tgz 56 | 57 | # Yarn Integrity file 58 | .yarn-integrity 59 | 60 | # dotenv environment variables file 61 | .env 62 | .env.test 63 | 64 | # parcel-bundler cache (https://parceljs.org/) 65 | .cache 66 | 67 | # next.js build output 68 | .next 69 | 70 | # nuxt.js build output 71 | .nuxt 72 | 73 | # vuepress build output 74 | .vuepress/dist 75 | 76 | # Serverless directories 77 | .serverless/ 78 | 79 | # FuseBox cache 80 | .fusebox/ 81 | 82 | # DynamoDB Local files 83 | .dynamodb/ 84 | 85 | # Webpack 86 | .webpack/ 87 | 88 | # Electron-Forge 89 | out/ 90 | 91 | # Running Data 92 | dumpfiles/ 93 | keys.txt 94 | *.mfd 95 | 96 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "source/libnfc"] 2 | path = source/libnfc 3 | url = https://github.com/GSWXXN/libnfc.git 4 | branch = libnfc 5 | [submodule "source/nfc-mfdetect"] 6 | path = source/nfc-mfdetect 7 | url = https://github.com/GSWXXN/mfoc.git 8 | branch = nfc-mfdetect 9 | [submodule "source/nfc-mfdict"] 10 | path = source/nfc-mfdict 11 | url = https://github.com/GSWXXN/mfoc.git 12 | branch = nfc-mfdict 13 | [submodule "source/nfc-mflock"] 14 | path = source/nfc-mflock 15 | url = https://github.com/GSWXXN/nfc-mflock.git 16 | branch = nfc-mflock 17 | [submodule "source/cropto1_bs"] 18 | path = source/cropto1_bs 19 | url = https://github.com/GSWXXN/cropto1_bs.git 20 | branch = cropto1_bs 21 | [submodule "source/libnfc_collect"] 22 | path = source/libnfc_collect 23 | url = https://github.com/GSWXXN/crypto1_bs.git 24 | branch = libnfc_collect 25 | [submodule "source/mfoc"] 26 | path = source/mfoc 27 | url = https://github.com/GSWXXN/mfoc.git 28 | branch = master 29 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . -------------------------------------------------------------------------------- /README-zh_CN.md: -------------------------------------------------------------------------------- 1 | # NFCToolsGUI 2 | icon 3 | 4 | 一个与 PN532 进行交互的跨平台程序, 支持 Windows、Linux 和 macOS。 5 | 6 | [English](https://github.com/GSWXXN/NFCToolsGUI/blob/main/README.md) | 简体中文 7 | 8 | 9 | ## 支持的功能 10 | * MFOC 解卡 11 | * 写卡 12 | * 格式化卡片 13 | * 锁定 UFUID 14 | * HardNested 破解 15 | * 字典测试 16 | * 转储编辑 17 | * 转储比较 18 | 19 | ## 界面预览 20 | 21 | 22 | ## 驱动安装 23 | 根据实际情况选择驱动, 以 CH341 为例 24 | ### Windows 25 | 下载安装 [CH341SER](http://www.wch-ic.com/downloads/CH341SER_ZIP.html) 26 | 27 | ### macOS 28 | 下载安装 [CH341SER_MAC](http://www.wch-ic.com/downloads/CH341SER_MAC_ZIP.html) 29 | 30 | ### Linux 31 | 通常来说,Linux 内核已经包含了 CH341 的驱动,因此不需要额外安装驱动。如果你的 Linux 内核不包含 CH341 的驱动,那么可以下载安装 [CH341SER_LINUX](http://www.wch-ic.com/downloads/CH341SER_LINUX_ZIP.html) 32 | 33 | ## 如何编译 34 | ### 编译核心组件 35 | #### Windows 36 | 1. 安装 [MSYS2](https://www.msys2.org/) 37 | 2. 进入此项目目录并在 `CMD` 中执行如下命令 38 | ```bash 39 | C:\msys64\msys2_shell.cmd -mingw64 -defterm -here -no-start -c ./compile.sh 40 | ``` 41 | > 将 `C:\msys64\` 替换为 MSYS2 的安装路径 42 | 43 | #### Linux 44 | 1. 安装依赖 (以 Ubuntu 为例) 45 | ```bash 46 | sudo apt-get install curl autoconf libtool pkg-config patchelf liblzma-dev libreadline-dev 47 | ``` 48 | > 不同发行版的依赖名称可能不同 49 | 2. 进入此项目目录并执行如下命令 50 | ```bash 51 | sh ./compile.sh 52 | ``` 53 | #### macOS 54 | 1. 安装依赖 55 | ```bash 56 | brew install autoconf automake libtool pkg-config 57 | ``` 58 | 2. 进入此项目目录并执行如下命令 59 | ```bash 60 | sh ./compile.sh 61 | ``` 62 | ### 编译 GUI 63 | 1. 安装 [Node.js](https://nodejs.org/) 64 | 2. 进入此项目目录并执行如下命令 65 | ```bash 66 | npm install 67 | npm run make 68 | ``` 69 | 3. 编译完成后,可在 `out` 目录下找到编译好的文件 70 | > 你也可以使用 `npm run start` 来调试运行此项目 71 | 72 | ## 目录使用 73 | 除了安装目录, 程序还使用以下目录来存放用户文件: 74 | * Windows: `%APPDATA%\NFCToolsGUI` 75 | * Linux: `$XDG_CONFIG_HOME/NFCToolsGUI` 或者 `~/.config/NFCToolsGUI` 76 | * macOS: `~/Library/Application Support/NFCToolsGUI` 77 | 78 | ## Linux 中的注意事项 79 | ### 找不到类似 `ttyUSB0` 的串口 80 | 首先执行 81 | ```bash 82 | sudo dmesg | grep brltty 83 | ``` 84 | 如果输出类似如下内容,那么说明你的串口已经被 brltty 占用了: 85 | ``` 86 | interface 0 claimed by ch341 while 'brltty' sets config #1 87 | ``` 88 | 执行 89 | ```bash 90 | sudo apt remove brltty 91 | ``` 92 | 卸载 brltty,然后重新插拔设备即可 93 | 94 | 95 | ### 确认已找到串口, 但是无法打开 96 | 在 Linux 中,要访问串口需要有足够的权限。一种解决办法是将当前用户添加到 dialout 用户组中,这个用户组具有访问串口的权限。这样,程序就可以在不使用 sudo 的情况下访问串口。 97 | 98 | 可以使用以下命令将当前用户添加到 dialout 用户组中: 99 | ```bash 100 | sudo usermod -a -G dialout 101 | ``` 102 | 添加完成后,你需要注销并重新登录才能使更改生效。 103 | 104 | 如果你不想将用户添加到 dialout 组中,那么可以通过修改串口文件的权限来让程序能够访问串口。例如,可以使用以下命令将 /dev/ttyUSB0 文件的权限修改为 666: 105 | ```bash 106 | sudo chmod 666 /dev/ttyUSB0 107 | ``` 108 | > 请注意,这种方法会使其他用户也能访问串口,因此不推荐使用。 109 | 110 | ## 许可证 111 | * [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html) 112 | ``` 113 | Copyright (C) 2022-2023 GSWXXN 114 | 115 | This program is free software: you can redistribute it and/or modify 116 | it under the terms of the GNU Affero General Public License as 117 | published by the Free Software Foundation, either version 3 of the 118 | License, or (at your option) any later version. 119 | 120 | This program is distributed in the hope that it will be useful, 121 | but WITHOUT ANY WARRANTY; without even the implied warranty of 122 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 123 | GNU Affero General Public License for more details. 124 | 125 | You should have received a copy of the GNU Affero General Public License 126 | along with this program. If not, see . 127 | ``` 128 | 129 |
130 | AGPL-3.0 许可证允许您 131 |
    132 |
  • 自由使用、修改和分发受 AGPL-3.0 许可证保护的软件。
  • 133 |
  • 将受 AGPL-3.0 许可证保护的软件用于商业目的。
  • 134 |
  • 以源代码或者可执行文件的形式重新分发软件。
  • 135 |
  • 将受 AGPL-3.0 许可证保护的软件与其他软件或代码结合使用,形成衍生作品,只要这些衍生作品同样受 AGPL-3.0 许可证保护并遵守 AGPL-3.0 许可证的条款和条件。
  • 136 |
  • 在网络上提供使用 AGPL-3.0 许可证保护的软件,只要您提供完整的源代码和修改的内容,并允许用户以相同的 AGPL-3.0 许可证继续分发您的修改和衍生作品。
  • 137 |
138 |
139 | 140 |
141 | AGPL-3.0 许可证禁止您 142 |
    143 |
  • 修改 AGPL-3.0 许可证保护的软件并以闭源的方式分发。
  • 144 |
  • 在您提供的网络服务中使用 AGPL-3.0 许可证保护的软件,而不向用户提供完整的源代码和修改的内容。
  • 145 |
146 |
147 | 148 | ## 致谢 149 | - [MifareOneTool](https://github.com/xcicode/MifareOneTool/): 一个运行在 Windows 平台上的 Mifare Classic GUI 工具 150 | - [Electron](https://github.com/electron/electron): 建立跨平台桌面应用程序的框架 151 | - [mfoc](https://github.com/nfc-tools/mfoc): Mifare Classic 离线破解工具 152 | - [crypto1_bs](https://github.com/aczid/crypto1_bs): Bitsliced Crypto-1 暴力破解器, 在本项目中仅用于收集 nonces 153 | - [cropto1_bs](https://github.com/vk496/cropto1_bs): HardNested 暴力破解器 154 | - [libnfc](https://github.com/nfc-tools/libnfc): 不依赖平台的 NFC 库 155 | - [nfc-mflock](https://github.com/duament/nfc-mflock): Mifare Classic 锁定工具 156 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NFCToolsGUI 2 | icon 3 | 4 | A cross-platform program that interacts with PN532, supports Windows, Linux, and macOS. 5 | 6 | English | [简体中文](https://github.com/GSWXXN/NFCToolsGUI/blob/main/README-zh_CN.md) 7 | 8 | 9 | ## Supported functions 10 | * Crack card using MFOC 11 | * Write card 12 | * Format card 13 | * Lock UFUID 14 | * HardNested crack 15 | * Dictionary testing 16 | * Dump editing 17 | * Dump comparison 18 | 19 | ## Interface preview 20 | 21 | 22 | ## Driver installation 23 | Choose the appropriate driver according to your actual situation, taking CH341 as an example. 24 | ### Windows 25 | Download and install [CH341SER](http://www.wch-ic.com/downloads/CH341SER_ZIP.html) 26 | 27 | ### macOS 28 | Download and install [CH341SER_MAC](http://www.wch-ic.com/downloads/CH341SER_MAC_ZIP.html) 29 | 30 | ### Linux 31 | Usually, the Linux kernel already includes the driver for CH341, so there is no need to install the driver separately. If your Linux kernel does not include the CH341 driver, you can try to download and install [CH341SER_LINUX](http://www.wch-ic.com/downloads/CH341SER_LINUX_ZIP.html) 32 | 33 | ## How to compile 34 | ### Compile the core component 35 | #### Windows 36 | 1. Install [MSYS2](https://www.msys2.org/) 37 | 2. Enter the project directory and execute the following command in `CMD` 38 | ```bash 39 | C:\msys64\msys2_shell.cmd -mingw64 -defterm -here -no-start -c ./compile.sh 40 | ``` 41 | > Replace `C:\msys64\` with the installation path of MSYS2. 42 | 43 | #### Linux 44 | 1. Install dependencies (using Ubuntu as an example) 45 | ```bash 46 | sudo apt-get install curl autoconf libtool pkg-config patchelf liblzma-dev libreadline-dev 47 | ``` 48 | > The dependency names may vary on different distributions. 49 | 2. Enter the project directory and execute the following command: 50 | ```bash 51 | sh ./compile.sh 52 | ``` 53 | #### macOS 54 | 1. Install dependencies: 55 | ```bash 56 | brew install autoconf automake libtool pkg-config 57 | ``` 58 | 2. Enter the project directory and execute the following command: 59 | ```bash 60 | sh ./compile.sh 61 | ``` 62 | ### Compile GUI 63 | 1. Install [Node.js](https://nodejs.org/) 64 | 2. Enter the project directory and execute the following command: 65 | ```bash 66 | npm install 67 | npm run make 68 | ``` 69 | 3. After compilation, the compiled files can be found in the `out` directory 70 | > You can also use `npm run start` to debug this project. 71 | 72 | ## Directory usage 73 | In addition to the installation directory, the program also uses the following directories to store user files: 74 | * Windows: `%APPDATA%\NFCToolsGUI` 75 | * Linux: `$XDG_CONFIG_HOME/NFCToolsGUI` or `~/.config/NFCToolsGUI` 76 | * macOS: `~/Library/Application Support/NFCToolsGUI` 77 | 78 | ## Notes on Linux 79 | ### Cannot find a serial port like `ttyUSB0` 80 | First, run the following command: 81 | ```bash 82 | sudo dmesg | grep brltty 83 | ``` 84 | If the output is similar to the following content, it means that your serial port has been occupied by brltty: 85 | ``` 86 | interface 0 claimed by ch341 while 'brltty' sets config #1 87 | ``` 88 | Execute: 89 | ```bash 90 | sudo apt remove brltty 91 | ``` 92 | to uninstall brltty, and then plug in the device again. 93 | 94 | 95 | ### Find the Serial Port But Can't Open It 96 | In Linux, accessing a serial port requires sufficient permissions. One solution is to add the current user to the dialout group, which has permissions to access the serial port. This way, the program can access the serial port without using sudo. 97 | 98 | You can use the following command to add the current user to the dialout group 99 | ```bash 100 | sudo usermod -a -G dialout 101 | ``` 102 | After adding, you need to log out and log in again to make the changes take effect. 103 | 104 | If you don't want to add the user to the dialout group, you can modify the permissions of the serial port file to allow the program to access it. For example, you can use the following command to modify the permission of the `/dev/ttyUSB0` file to 666: 105 | ```bash 106 | sudo chmod 666 /dev/ttyUSB0 107 | ``` 108 | 109 | 110 | ## License 111 | * [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html) 112 | ``` 113 | Copyright (C) 2022-2023 GSWXXN 114 | 115 | This program is free software: you can redistribute it and/or modify 116 | it under the terms of the GNU Affero General Public License as 117 | published by the Free Software Foundation, either version 3 of the 118 | License, or (at your option) any later version. 119 | 120 | This program is distributed in the hope that it will be useful, 121 | but WITHOUT ANY WARRANTY; without even the implied warranty of 122 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 123 | GNU Affero General Public License for more details. 124 | 125 | You should have received a copy of the GNU Affero General Public License 126 | along with this program. If not, see . 127 | ``` 128 | 129 |
130 | AGPL-3.0 license allows you to: 131 |
    132 |
  • use, modify, and distribute software protected by the AGPL-3.0 license for free.
  • 133 |
  • use software protected by the AGPL-3.0 license for commercial purposes.
  • 134 |
  • redistribute software in source code or executable form.
  • 135 |
  • combine software protected by the AGPL-3.0 license with other software or code to create derivative works, as long as these derivative works are also protected by the AGPL-3.0 license and comply with the terms and conditions of the AGPL-3.0 license.
  • 136 |
  • provide software protected by the AGPL-3.0 license on a network, as long as you provide the complete source code and modified content, and allow users to distribute your modifications and derivative works under the same AGPL-3.0 license.
  • 137 |
138 |
139 | 140 |
141 | AGPL-3.0 license prohibits you from: 142 |
    143 |
  • modifying software protected by the AGPL-3.0 license and distributing it in a proprietary manner.
  • 144 |
  • using software protected by the AGPL-3.0 license in your network service without providing users with the complete source code and modified content.
  • 145 |
146 |
147 | 148 | ## Credits 149 | - [MifareOneTool](https://github.com/xcicode/MifareOneTool/): A GUI Mifare Classic tool on Windows 150 | - [Electron](https://github.com/electron/electron): A framework for building cross-platform desktop applications. 151 | - [mfoc](https://github.com/nfc-tools/mfoc): Mifare Classic Offline Cracker 152 | - [crypto1_bs](https://github.com/aczid/crypto1_bs): Bitsliced Crypto-1 brute-forcer, used only for nonce collection in this project. 153 | - [cropto1_bs](https://github.com/vk496/cropto1_bs): HardNested brute-forcer. 154 | - [libnfc](https://github.com/nfc-tools/libnfc): Platform-independent NFC library. 155 | - [nfc-mflock](https://github.com/duament/nfc-mflock): A simple utility to lock block0 of UFUID cards. 156 | -------------------------------------------------------------------------------- /compile.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | case $(uname -s) in 5 | MINGW64*) 6 | os="MINGW64" 7 | echo "Running on MINGW64" 8 | ;; 9 | Darwin*) 10 | os="Darwin" 11 | echo "Running on MacOS" 12 | ;; 13 | Linux*) 14 | os="Linux" 15 | echo "Running on Linux" 16 | ;; 17 | *) 18 | echo "$os: This system is not supported. Exiting..." 19 | exit 1 20 | ;; 21 | esac 22 | 23 | # install msys2 dependency 24 | if [ "$os" = "MINGW64" ]; then 25 | echo "============================== install msys dependency ==============================" 26 | pacman -S --noconfirm unzip 27 | pacman -S --noconfirm mingw-w64-x86_64-crt-git 28 | pacman -S --noconfirm mingw-w64-x86_64-gcc 29 | pacman -S --noconfirm mingw-w64-x86_64-make 30 | pacman -S --noconfirm mingw-w64-x86_64-pkgconf 31 | pacman -S --noconfirm mingw-w64-x86_64-zlib 32 | pacman -S --noconfirm mingw-w64-x86_64-autotools 33 | pacman -S --noconfirm mingw-w64-x86_64-cmake 34 | pacman -S --noconfirm mingw-w64-x86_64-xz 35 | pacman -S --noconfirm mingw-w64-x86_64-readline 36 | pacman -S --noconfirm mingw-w64-x86_64-headers-git 37 | fi 38 | 39 | workdir=$(pwd) 40 | prefix=$workdir/framework 41 | source=$workdir/source 42 | rm -rf "$prefix" 43 | mkdir "$prefix" 44 | mkdir "$prefix"/bin 45 | 46 | # libusb 47 | cd "$source" 48 | echo 49 | echo 50 | echo "============================== libusb ==============================" 51 | if [ "$os" = "MINGW64" ]; then 52 | curl -Lo libusb-win32.zip https://github.com/mcuee/libusb-win32/releases/download/snapshot_1.2.7.3/libusb-win32-bin-1.2.7.3.zip 53 | unzip -o libusb-win32.zip 54 | cd ./libusb-win32-bin-1.2.7.3 55 | cp ./bin/x86/libusb0_x86.dll "$prefix"/bin/libusb0.dll 56 | cp -a ./include "$prefix" 57 | cp -a ./lib "$prefix" 58 | elif [ "$os" = "Darwin" ]; then 59 | mkdir -p ./libusb 60 | cd ./libusb 61 | curl -LO https://pub-3d2f9df4304d45e38bbebe723816c4a3.r2.dev/libusb-legacy-0.1.12_4.darwin_22.x86_64.tbz2 62 | tar -xvf libusb-legacy-0.1.12_4.darwin_22.x86_64.tbz2 63 | mv ./opt/local/* "$prefix"/ 64 | else 65 | curl -LO https://pub-3d2f9df4304d45e38bbebe723816c4a3.r2.dev/libusb-0.1.12.zip 66 | unzip -o libusb-0.1.12.zip 67 | cd ./libusb-0.1.12 68 | ./configure prefix="$prefix" 69 | make && make install 70 | fi 71 | 72 | 73 | # libnfc 74 | echo 75 | echo 76 | echo "============================== libnfc ==============================" 77 | cd "$source"/libnfc 78 | if [ "$os" = "MINGW64" ]; then 79 | CMAKE_INSTALL_PREFIX=$prefix 80 | LIBNFC_DRIVER_ACR122S=OFF 81 | LIBNFC_DRIVER_ACR122_USB=OFF 82 | LIBNFC_DRIVER_ARYGON=OFF 83 | LIBNFC_DRIVER_PN53X_USB=OFF 84 | LIBUSB_INCLUDE_DIRS=$prefix/include 85 | LIBUSB_LIBRARIES=$prefix/lib/gcc/libusb.a 86 | cmake -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX="$CMAKE_INSTALL_PREFIX" -DLIBUSB_INCLUDE_DIRS="$LIBUSB_INCLUDE_DIRS" -DLIBUSB_LIBRARIES="$LIBUSB_LIBRARIES" -DLIBNFC_DRIVER_ACR122S="$LIBNFC_DRIVER_ACR122S" -DLIBNFC_DRIVER_ACR122_USB="$LIBNFC_DRIVER_ACR122_USB" -DLIBNFC_DRIVER_ARYGON=$LIBNFC_DRIVER_ARYGON -DLIBNFC_DRIVER_PN53X_USB=$LIBNFC_DRIVER_PN53X_USB 87 | mingw32-make install 88 | cp ./libnfc/libnfc.dll.a "$prefix"/lib/libnfc.a 89 | cp ./contrib/win32/err.h "$prefix"/include 90 | else 91 | autoreconf -vis 92 | autoreconf -is 93 | ./configure prefix="$prefix" LDFLAGS=-L"$prefix"/lib/libusb-legacy --with-drivers=pn532_uart 94 | make && make install 95 | fi 96 | 97 | 98 | # mfoc 99 | echo 100 | echo 101 | echo "============================== mfoc ==============================" 102 | cd "$source"/mfoc 103 | autoreconf -vis 104 | if [ "$os" = "MINGW64" ]; then 105 | LIBS=$prefix/lib/libnfc.a ./configure LDFLAGS=-L"$prefix"/lib CPPFLAGS=-I"$prefix"/include PKG_CONFIG=: prefix="$prefix" 106 | else 107 | ./configure LDFLAGS=-L"$prefix"/lib PKG_CONFIG_PATH="$prefix"/lib/pkgconfig prefix="$prefix" 108 | fi 109 | make && make install 110 | 111 | 112 | 113 | # nfc-mfdict 114 | echo 115 | echo 116 | echo "============================== nfc-mfdict ==============================" 117 | cd "$source"/nfc-mfdict 118 | autoreconf -vis 119 | if [ "$os" = "MINGW64" ]; then 120 | LIBS=$prefix/lib/libnfc.a ./configure LDFLAGS=-L"$prefix"/lib CPPFLAGS=-I"$prefix"/include PKG_CONFIG=: prefix="$prefix" 121 | else 122 | ./configure LDFLAGS=-L"$prefix"/lib PKG_CONFIG_PATH="$prefix"/lib/pkgconfig prefix="$prefix" 123 | fi 124 | make && make install 125 | 126 | 127 | # nfc-mfdetect 128 | echo 129 | echo 130 | echo "============================== nfc-mfdetect ==============================" 131 | cd "$source"/nfc-mfdetect 132 | autoreconf -vis 133 | if [ "$os" = "MINGW64" ]; then 134 | LIBS=$prefix/lib/libnfc.a ./configure LDFLAGS=-L"$prefix"/lib CPPFLAGS=-I"$prefix"/include PKG_CONFIG=: prefix="$prefix" 135 | else 136 | ./configure LDFLAGS=-L"$prefix"/lib PKG_CONFIG_PATH="$prefix"/lib/pkgconfig prefix="$prefix" 137 | fi 138 | make && make install 139 | 140 | 141 | # nfc-mflock 142 | echo 143 | echo 144 | echo "============================== nfc-mflock ==============================" 145 | cd "$source"/nfc-mflock 146 | autoreconf -vis 147 | ./configure LDFLAGS=-L"$prefix"/lib prefix="$prefix" CPPFLAGS=-I"$prefix"/include 148 | make && make install 149 | 150 | 151 | # libnfc_collect 152 | echo 153 | echo 154 | echo "============================== libnfc_collect ==============================" 155 | cd "$source"/libnfc_collect 156 | curl -LO https://pub-3d2f9df4304d45e38bbebe723816c4a3.r2.dev/craptev1-v1.1.tar.xz 157 | tar -xf craptev1-v1.1.tar.xz 158 | mkdir -p crapto1-v3.3 159 | curl -LO https://pub-3d2f9df4304d45e38bbebe723816c4a3.r2.dev/crapto1-v3.3.tar.xz 160 | tar -xf crapto1-v3.3.tar.xz -C crapto1-v3.3 161 | autoreconf -vis 162 | if [ "$os" = "Darwin" ]; then 163 | ./configure LDFLAGS=-L"$prefix"/lib prefix="$prefix" CPPFLAGS=-I"$prefix"/include CFLAGS='-std=gnu99 -O3' 164 | else 165 | ./configure LDFLAGS=-L"$prefix"/lib' '-Wl,--allow-multiple-definition prefix="$prefix" CPPFLAGS=-I"$prefix"/include CFLAGS='-std=gnu99 -O3 -march=native' 166 | fi 167 | make libnfc-collect && make install 168 | 169 | 170 | # cropto1_bs 171 | echo 172 | echo 173 | echo "============================== cropto1_bs ==============================" 174 | cd "$source"/cropto1_bs 175 | autoreconf -vis 176 | ./configure prefix="$prefix" CFLAGS=-I/opt/local/include' '-I"$prefix"/include LDFLAGS=-L"$prefix"/lib 177 | make && make install 178 | 179 | 180 | 181 | # copy library 182 | if [ "$os" = "MINGW64" ]; then 183 | echo "- copy library" 184 | cp /mingw64/bin/libreadline8.dll "$prefix"/bin 185 | cp /mingw64/bin/libtermcap-0.dll "$prefix"/bin 186 | cp /mingw64/bin/libwinpthread-1.dll "$prefix"/bin 187 | fi 188 | 189 | 190 | # delete useless program 191 | echo "- delete useless program" 192 | mkdir "$prefix"/bin2/ 193 | mv "$prefix"/bin/* "$prefix"/bin2/ 194 | 195 | mv "$prefix"/bin2/nfc-list* "$prefix"/bin 196 | mv "$prefix"/bin2/nfc-mfclassic* "$prefix"/bin 197 | mv "$prefix"/bin2/nfc-mfdict* "$prefix"/bin 198 | mv "$prefix"/bin2/mfoc* "$prefix"/bin 199 | mv "$prefix"/bin2/nfc-mfdetect* "$prefix"/bin 200 | mv "$prefix"/bin2/nfc-mflock* "$prefix"/bin 201 | mv "$prefix"/bin2/libnfc-collect* "$prefix"/bin 202 | mv "$prefix"/bin2/cropto1_bs* "$prefix"/bin 203 | if [ "$os" = "MINGW64" ]; then 204 | mv "$prefix"/bin2/*.dll "$prefix"/bin 205 | fi 206 | 207 | # clean 208 | echo "- clean up" 209 | rm -rf "$prefix"/bin2/ 210 | rm -rf "$prefix"/include/ 211 | rm -rf "$prefix"/share/ 212 | rm -rf "$prefix"/lib/pkgconfig/ 213 | rm -rf "$prefix"/lib/*.la 214 | if [ "$os" = "MINGW64" ]; then 215 | rm -rf "${prefix:?}/lib/" 216 | fi 217 | 218 | 219 | # install_name_tool -change 220 | if [ "$os" = "Darwin" ]; then 221 | echo "- install_name_tool" 222 | cd "$prefix"/bin 223 | for i in *; do 224 | install_name_tool -change "$prefix"/lib/libnfc.6.dylib @loader_path/../lib/libnfc.6.dylib "$prefix"/bin/"$i" 225 | done 226 | 227 | for i in *; do 228 | install_name_tool -change /usr/local/lib/libnfc.6.dylib @loader_path/../lib/libnfc.6.dylib "$prefix"/bin/"$i" 229 | done 230 | elif [ "$os" = "Linux" ]; then 231 | echo "- patchelf" 232 | cd "$prefix"/bin 233 | for i in *; do 234 | patchelf --set-rpath '$ORIGIN/../lib/' "$prefix"/bin/"$i" 235 | done 236 | fi 237 | echo "- Done!" 238 | -------------------------------------------------------------------------------- /doc/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GSWXXN/NFCToolsGUI/06e90d3231252df6273dedea8a40b3e200a7cca4/doc/icon.png -------------------------------------------------------------------------------- /doc/interface-en.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GSWXXN/NFCToolsGUI/06e90d3231252df6273dedea8a40b3e200a7cca4/doc/interface-en.png -------------------------------------------------------------------------------- /doc/interface-zh_CN.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GSWXXN/NFCToolsGUI/06e90d3231252df6273dedea8a40b3e200a7cca4/doc/interface-zh_CN.png -------------------------------------------------------------------------------- /forge.config.js: -------------------------------------------------------------------------------- 1 | const path = require("path"); 2 | const fs = require('fs'); 3 | const { execSync } = require('child_process'); 4 | const os = require("os"); 5 | 6 | module.exports = { 7 | packagerConfig: { 8 | packageManager: "npm", 9 | icon: "src/icons/icon", 10 | asar: true, 11 | overwrite: true, 12 | ignore: [ 13 | "source", 14 | "compile.sh", 15 | "framework", 16 | "README*", 17 | "LICENSE", 18 | "doc", 19 | "dict.dic", 20 | ".gitignore", 21 | ".gitsubmodules", 22 | ".github", 23 | ".idea", 24 | ".vscode" 25 | ], 26 | extraResource: [ 27 | "framework", 28 | "dict.dic" 29 | ] 30 | }, 31 | makers: [ 32 | { 33 | name: "@electron-forge/maker-zip", 34 | platforms: [ 35 | "darwin", 36 | "linux", 37 | "win32" 38 | ] 39 | } 40 | ], 41 | hooks: { 42 | "generateAssets": async () => { 43 | const hash = execSync('git rev-parse --short HEAD').toString().trim(); 44 | const version = require('./package.json').version; 45 | 46 | const data = { 47 | version: `v${version}-${hash}`, 48 | builder: process.env["NFCTOOLSGUI_COMPILER"] ? process.env["NFCTOOLSGUI_COMPILER"] : os.userInfo().username 49 | } 50 | 51 | fs.writeFileSync('./src/buildInfo.json', JSON.stringify(data, null, 2), 'utf-8'); 52 | }, 53 | "packageAfterPrune": async (forgeConfig, buildPath) => { 54 | const url = path.join(buildPath, 'node_modules/@serialport/bindings-cpp/build/node_gyp_bins') 55 | fs.unlink(path.join(url, "python3"), () => { 56 | fs.rmdir(url, () => {}) 57 | }); 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "nfctoolsgui", 3 | "productName": "NFCToolsGUI", 4 | "version": "1.0.0", 5 | "description": "NFCToolsGUI is an Electron-based cross-platform software that interact with PN532. It supports Windows, Linux, and macOS.", 6 | "main": "src/main.js", 7 | "scripts": { 8 | "start": "electron-forge start", 9 | "package": "electron-forge package", 10 | "make": "electron-forge make" 11 | }, 12 | "license": "AGPL-3.0", 13 | "dependencies": { 14 | "serialport": "^10.5.0" 15 | }, 16 | "devDependencies": { 17 | "node-abi": "^3.33.0", 18 | "@electron-forge/cli": "^6.0.4", 19 | "@electron-forge/maker-zip": "^6.0.4", 20 | "electron": "23.1.1" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/command.js: -------------------------------------------------------------------------------- 1 | const {exec, killProcess, printExitLog, printLog, printStatus} = require("./execUtils") 2 | const fs = require('fs') 3 | const {dialog, app, shell} = require('electron') 4 | const cp = require("child_process"); 5 | const status = require("./status") 6 | const { SerialPort } = require('serialport') 7 | const path = require("path") 8 | const { i18n } = require('./i18n') 9 | const https = require('https'); 10 | 11 | const { 12 | createDumpHistoryWindow, 13 | createDumpComparatorWindow, 14 | createDumpEditorWindow, 15 | createInputKeysWindow, 16 | createHardNestedWindow, 17 | createDictTestWindow, 18 | createSettingsWindow, 19 | createAboutWindow, 20 | 21 | sendToMainWindow, 22 | sentToDictTestWindow, 23 | sentToDumpEditorWindow, 24 | sentToDumpComparatorWindow, 25 | sentToDumpHistoryWindow 26 | } = require("./windows") 27 | 28 | const userDataPath = app.getPath('userData') 29 | 30 | const knownKeysFile = path.join(userDataPath, "./keys.txt") 31 | const tempMFDFilePath = path.join(userDataPath, "./temp.mfd") 32 | const dumpFilesPath = path.join(userDataPath, "./dumpfiles") 33 | const noncesFilesPath = path.join(userDataPath, "./nonces.bin") 34 | const nfcConfigFilePath = path.join(userDataPath, "./libnfc.conf") 35 | let dictPath = app.isPackaged ? 36 | path.join(process.resourcesPath, "./dict.dic") : 37 | path.join(__dirname, "../dict.dic") 38 | const dumpsFolder = path.join(userDataPath, "./dumpfiles") 39 | 40 | let newKeys = [] 41 | let knownKeyInfo = [] 42 | let unknownKeyInfo = [] 43 | let totalUnknownKeys = 0 44 | 45 | const defaultKeys = [ 46 | "ffffffffffff", 47 | "a0a1a2a3a4a5", 48 | "d3f7d3f7d3f7", 49 | "000000000000", 50 | "b0b1b2b3b4b5", 51 | "4d3a99c351dd", 52 | "1a982c7e459a", 53 | "aabbccddeeff", 54 | "714c5c886e97", 55 | "587ee5f9350f", 56 | "a0478cc39091", 57 | "533cb6c723f6", 58 | "8fd0a4f256e9" 59 | ] 60 | 61 | const actions = { 62 | // 打开设置窗口 63 | "open-settings-window": createSettingsWindow, 64 | 65 | // 扫描设备 66 | "scan-usb-devices": () => { 67 | SerialPort.list().then(ports => { 68 | const devices = [] 69 | ports.forEach(port => { 70 | devices.push(port["path"]) 71 | }) 72 | sendToMainWindow("update-usb-devices", devices) 73 | }); 74 | }, 75 | 76 | // 连接设备 77 | "conn-usb-devices": (device) => { 78 | if (device === " ") {status.currentDevice = null; return} 79 | printStatus(i18n("indicator_connecting_device")) 80 | status.currentDevice = device 81 | setNFCConfig() 82 | }, 83 | 84 | // 速度设置 85 | // "set-speed": (speed) => { 86 | // if (status.currentDevice === null) {dialog.showErrorBox("错误", "请先选择设备"); return} 87 | // status.currentSpeed = speed 88 | // setNFCConfig() 89 | // }, 90 | 91 | // 一键解卡 92 | "read-IC": () => { 93 | printStatus(i18n("indicator_reading_ic_card")) 94 | mfoc([`-O${tempMFDFilePath}`, `-f${knownKeysFile}`]) 95 | }, 96 | 97 | // 一键写卡 98 | "write-IC": () => { 99 | dialog.showOpenDialog({ 100 | title: i18n("dialog_title_choose_dump_need_to_write"), 101 | defaultPath: dumpFilesPath, 102 | buttonLabel: i18n("dialog_button_open"), 103 | filters: [{ name: i18n("file_type_dump"), extensions: ['dump', 'mfd'] }] 104 | }).then(result => { 105 | if (result["canceled"] === true) return 106 | let mfdFilePath = result["filePaths"][0] 107 | 108 | readICThenExec( 109 | i18n("log_msg_start_write_card"), i18n("indicator_writing_ic_card"), true, 110 | "nfc-mfclassic", ["w", "A", "u", mfdFilePath, tempMFDFilePath, "f"] 111 | ) 112 | }) 113 | }, 114 | 115 | // 格式化 116 | "format-card": () => { 117 | readICThenExec( 118 | i18n("log_msg_start_format_card"), i18n("indicator_formatting_ic_card"), true, 119 | "nfc-mfclassic", ["f", "A", "u", tempMFDFilePath, tempMFDFilePath, "f"] 120 | ) 121 | }, 122 | 123 | // 输入已知密钥解卡 124 | "input-keys-read-IC": () => {createInputKeysWindow("done-input-keys-read-IC")}, 125 | "done-input-keys-read-IC": (keys) => { 126 | const keyArg = [] 127 | keys.match(/[0-9A-Fa-f]{12}/g).forEach(key => { 128 | keyArg.push(`-k${key}`) 129 | }) 130 | printStatus(i18n("indicator_reading_ic_card")) 131 | mfoc(keyArg.concat([`-O${tempMFDFilePath}`, `-f${knownKeysFile}`])) 132 | }, 133 | 134 | // 检测卡片类型 135 | "detect-card-type": () => { 136 | checkKeyFileExist() 137 | knownKeyInfo = [] 138 | unknownKeyInfo = [] 139 | printStatus(i18n("indicator_detecting_ic_card")) 140 | exec( 141 | i18n("log_msg_start_detect_card"), 142 | 'nfc-mfdetect', [`-N`, `-f${knownKeysFile}`], 143 | (value) => {keyInfoStatistic(value)}, 144 | ).then(()=>{printExitLog(0)}).catch(() => {}) 145 | }, 146 | 147 | // 锁 UFUID 148 | "lock-ufuid": () => { 149 | dialog.showMessageBox({ 150 | type: "warning", 151 | buttons: [i18n("dialog_button_cancel"), i18n("dialog_button_ok")], 152 | title: i18n("dialog_title_danger_operation"), 153 | message: i18n("dialog_msg_card_will_be_locked"), 154 | }).then((response) => { 155 | if (response.response === 1) { 156 | printStatus(i18n("indicator_locking_ufuid")) 157 | exec(i18n("log_msg_start_lock_ufuid"), "nfc-mflock", ["-q"]).then(()=>{printExitLog(0)}).catch(() => {}) 158 | } 159 | }) 160 | }, 161 | 162 | // HardNested 解密 163 | "hard-nested": () => { 164 | try {createHardNestedWindow({ 165 | knownKey: knownKeyInfo[0][0], 166 | knownSector: knownKeyInfo[0][1], 167 | knownKeyType: knownKeyInfo[0][2], 168 | targetSector: unknownKeyInfo[0][0], 169 | targetKeyType: unknownKeyInfo[0][1] 170 | })} 171 | catch (e) {createHardNestedWindow()}}, 172 | "hard-nested-config-done": (configs) => { 173 | if (configs.autoRun) { 174 | readICThenExec(i18n("lod_msg_start_auto_hard_nested"), 175 | `${i18n("indicator_doing_hard_nested")} - ${totalUnknownKeys - unknownKeyInfo.length + 1}/${totalUnknownKeys}`, 176 | false, 177 | () => { 178 | if (configs.fromUser) totalUnknownKeys = unknownKeyInfo.length 179 | 180 | if (knownKeyInfo.length === 0) { 181 | printLog(`\n${i18n("log_msg_not_found_known_key")}`); 182 | printExitLog(1); 183 | return; 184 | } 185 | if (unknownKeyInfo.length === 0) { 186 | printLog(`\n${i18n("log_msg_tried_decrypt_all_unknown_keys")}\n`); 187 | printExitLog(0); 188 | return; 189 | } 190 | configs.knownKey = knownKeyInfo[0][0] 191 | configs.knownSector = knownKeyInfo[0][1] 192 | configs.knownKeyType = knownKeyInfo[0][2] 193 | configs.targetSector = unknownKeyInfo[0][0] 194 | configs.targetKeyType = unknownKeyInfo[0][1] 195 | execAction("run-hard-nested", configs) 196 | }) 197 | } 198 | else execAction("run-hard-nested", configs) 199 | }, 200 | "run-hard-nested": (configs) => { 201 | let uid, sector, keyType 202 | configs.knownSector = (parseInt(configs.knownSector) + 1) * 4 - 1 203 | configs.targetSector = (parseInt(configs.targetSector) + 1) * 4 - 1 204 | 205 | printStatus(`${i18n("indicator_collecting_nonces")}${configs.autoRun ? ` - ${totalUnknownKeys - unknownKeyInfo.length + 1}/${totalUnknownKeys}` : ""}`) 206 | exec( 207 | `${i18n("log_msg_start_collect_nonces")}\n\n`, 208 | "libnfc-collect", [ 209 | configs.knownKey, 210 | configs.knownSector, 211 | configs.knownKeyType, 212 | configs.targetSector, 213 | configs.targetKeyType, 214 | "bin", 215 | noncesFilesPath 216 | ], 217 | (value) => { 218 | let i = value.indexOf("Found tag with uid ") 219 | if (i >= 0) { 220 | uid = value.substring(i + 19, i + 27) 221 | i = value.indexOf("collecting nonces for key") 222 | if (i >= 0) { 223 | const pattern = /\(sector (\d{1,2})\)/; 224 | const match = pattern.exec(value); 225 | if (match) sector = match[1] 226 | keyType = value.substring(i + 26, i + 27) 227 | } 228 | } 229 | }, 230 | () => { 231 | if (configs.collectOnly && fs.statSync(noncesFilesPath).size !== 0) { 232 | const url = dialog.showSaveDialogSync({ 233 | title: i18n("dialog_title_save_to"), 234 | defaultPath: uid ? `${uid}_${sector}${keyType}` : "nonces", 235 | filters: [{ name: i18n("file_type_bin"), extensions: ['bin'] }], 236 | message: i18n("dialog_msg_choose_save_path") 237 | }) 238 | if (!url) { 239 | printLog(i18n("log_msg_not_saved")) 240 | } else { 241 | fs.rename(noncesFilesPath, url, (err) => { 242 | if (err) { 243 | printLog(i18n("log_msh_save_failed")) 244 | printExitLog(1) 245 | throw err 246 | } 247 | else { 248 | printLog( `\n\n${i18n("log_msg_already_saved_to")} ${url}\n`) 249 | printExitLog(0) 250 | } 251 | }) 252 | } 253 | } 254 | }).then(() => { 255 | if (!configs.collectOnly) { 256 | printStatus(`${i18n("indicator_doing_hard_nested")} - ${totalUnknownKeys - unknownKeyInfo.length + 1}/${totalUnknownKeys}`) 257 | exec( 258 | i18n("lod_msg_start_hard_nested"), 259 | "cropto1_bs", [noncesFilesPath], 260 | (value) => { 261 | let i = value.indexOf("Key found:") 262 | if (i >= 0) { 263 | i += 11 264 | const key = value.substring(i, i + 12) 265 | saveKeys([key]) 266 | if (unknownKeyInfo.length === 0) return 267 | if (unknownKeyInfo[0][0] === sector && unknownKeyInfo[0][1] === keyType) unknownKeyInfo.shift() 268 | } 269 | }).then(() => { 270 | if (configs.autoRun) { 271 | execAction("hard-nested-config-done", { 272 | knownKey: knownKeyInfo[0][0], 273 | knownSector: knownKeyInfo[0][1], 274 | knownKeyType: knownKeyInfo[0][2], 275 | targetSector: unknownKeyInfo[0][0], 276 | targetKeyType: unknownKeyInfo[0][1], 277 | collectOnly: false, 278 | autoRun: true 279 | }) 280 | } else {printExitLog(0)} 281 | }).catch(() => {}) 282 | } 283 | }).catch(() => {}) 284 | }, 285 | 286 | //打开字典文件 287 | "open-dict-file": () => { 288 | const url = dialog.showOpenDialogSync({ 289 | title: i18n("dialog_title_choose_dictionary_file"), 290 | defaultPath: dictPath, 291 | filters: [{ name: i18n("file_type_dict"), extensions: ['txt', 'dic'] }], 292 | message: i18n("dialog_msg_choose_dictionary_file"), 293 | properties: ['openFile'] 294 | }) 295 | if (url) { 296 | dictPath = url[0] 297 | const pathArray = dictPath.split(/[\/\\]/g) 298 | sentToDictTestWindow("dict-file-name", pathArray[pathArray.length - 1]) 299 | } 300 | }, 301 | // 字典测试 302 | "dict-test": () => { 303 | try { 304 | createDictTestWindow({ 305 | targetSector: unknownKeyInfo[0][0], 306 | targetKeyType: unknownKeyInfo[0][1] 307 | }) 308 | } 309 | catch (e) {createDictTestWindow()} 310 | }, 311 | "dict-test-config-done": (configs) => { 312 | printStatus(i18n("indicator_testing_dictionary")) 313 | exec(i18n("log_msg_start_test_dictionary"), 314 | "nfc-mfdict", [`-s${configs.sector}`, `-t${configs.keyType}`, `-l${configs.startPosition}`, `-d${dictPath}`], 315 | (value) => { 316 | let i = value.indexOf("Found Key: ") 317 | if (i >= 0) { 318 | i += 11 319 | const key = value.substring(i, i + 12) 320 | saveKeys([key]) 321 | if (unknownKeyInfo.length === 0) return 322 | if (unknownKeyInfo[0][0] === configs.sector && unknownKeyInfo[0][1] === configs.keyType) unknownKeyInfo.shift() 323 | } 324 | } 325 | ).then(()=>{printExitLog(0)}).catch(() => {}) 326 | }, 327 | 328 | // 打开历史密钥 329 | "open-history-keys": () => {cp.exec(`${process.platform === "win32" ? "notepad.exe" : "open"} "${knownKeysFile}"`)}, 330 | 331 | // 转储编辑器 332 | "open-dump-editor": (file) => { 333 | createDumpEditorWindow(file ? path.join(dumpsFolder, file) : null) 334 | }, 335 | "dump-editor-choose-file": (filePath) => { 336 | const filePaths = filePath ? filePath : dialog.showOpenDialogSync({ 337 | title: i18n("dialog_title_choose_dump_file"), 338 | defaultPath: dictPath, 339 | properties: ['openFile'], 340 | filters: [{ name: 'Dump Files', extensions: ['mfd', 'dump'] }], 341 | message: i18n("dialog_msg_choose_dump_file"), 342 | })[0] 343 | fs.readFile(filePaths, (err, data) => { 344 | if (err) throw err; 345 | const hexDataArray = Array.from(new Uint8Array(data), function(byte) { 346 | return ('0' + (byte & 0xff).toString(16)).slice(-2); 347 | }).join('').match(/.{1,32}/g); 348 | const groupedHexData = []; 349 | for (let i = 0; i < hexDataArray.length; i += 4) { 350 | groupedHexData.push((hexDataArray.slice(i, i + 4)).join('\n')); 351 | } 352 | sentToDumpEditorWindow('binary-data', {url: filePaths, data: groupedHexData}); 353 | }); 354 | }, 355 | "dump-editor-save": (data) => { 356 | const binaryArray = new Buffer.from(data.hexData, "hex") 357 | 358 | fs.writeFile(data.url, binaryArray, (error) => { 359 | if (error) { 360 | throw error 361 | } else { 362 | sentToDumpEditorWindow('saved-binary-data'); 363 | } 364 | }); 365 | }, 366 | 367 | // 转储比较器 368 | "open-dump-comparator": (dumpFilesData) => { 369 | // dumpFilesData = {A: "dump1.mfd", B: "dump2.mfd"} 370 | if (dumpFilesData) { 371 | dumpFilesData.A = path.join(dumpsFolder, dumpFilesData.A); 372 | dumpFilesData.B = path.join(dumpsFolder, dumpFilesData.B) 373 | } 374 | createDumpComparatorWindow(dumpFilesData) 375 | }, 376 | "dump-comparator-choose-file": (type) => { 377 | const dumpType = type.type 378 | const filePaths = type.path ? type.path : dialog.showOpenDialogSync({ 379 | title: i18n("dialog_title_choose_dump_file"), 380 | defaultPath: dictPath, 381 | properties: ['openFile'], 382 | filters: [{ name: 'Dump Files', extensions: ['mfd', 'dump'] }], 383 | message: i18n("dialog_msg_choose_dump_file"), 384 | })[0] 385 | fs.readFile(filePaths, (err, data) => { 386 | if (err) throw err; 387 | const hexDataArray = Array.from(new Uint8Array(data), function(byte) { 388 | return ('0' + (byte & 0xff).toString(16)).slice(-2); 389 | }).join('').match(/.{1,32}/g); 390 | const groupedHexData = []; 391 | for (let i = 0; i < hexDataArray.length; i += 4) { 392 | groupedHexData.push(hexDataArray.slice(i, i + 4)); 393 | } 394 | sentToDumpComparatorWindow('binary-data', {url: filePaths, data: groupedHexData, type: dumpType}); 395 | }); 396 | }, 397 | 398 | // 历史记录 399 | "dump-history": () => { 400 | fs.mkdir(dumpsFolder, () => { 401 | const dumpFiles = fs.readdirSync(dumpsFolder).filter(file => file.endsWith('.mfd')); 402 | createDumpHistoryWindow(dumpFiles) 403 | }); 404 | }, 405 | // 删除历史记录 406 | "delete-dump": (files) => { 407 | // 弹出确认框 408 | const confirmDelete = dialog.showMessageBoxSync({ 409 | type: 'question', 410 | buttons: [i18n("dialog_button_ok"), i18n("dialog_button_cancel")], 411 | message: i18n("dialog_msg_are_you_sure_to_delete_these_dumps"), 412 | detail: files.join('\n'), 413 | }); 414 | 415 | if (confirmDelete === 0) { // 用户点击 Yes 416 | files.forEach((file) => { 417 | fs.unlink(path.join(dumpsFolder, file), (err) => { 418 | if (err) throw err; 419 | updateDumpFiles() 420 | }); 421 | }); 422 | } 423 | }, 424 | // 重命名 425 | "rename-dump-file": (fileObj) => { 426 | const { oldName, newName } = fileObj; 427 | fs.rename(path.join(dumpsFolder, oldName), path.join(dumpsFolder, newName), (err) => { 428 | if (err) throw err; 429 | updateDumpFiles() 430 | }); 431 | }, 432 | 433 | // 取消任务 434 | "cancel-task": () => { 435 | killProcess() 436 | }, 437 | 438 | // 保存日志 439 | "save-log": (content) => { 440 | const url = dialog.showSaveDialogSync({ 441 | title: i18n("dialog_title_save_to"), 442 | defaultPath: `NFCTools_log_${getTimeList().join("_")}`, 443 | filters: [{ name: i18n("file_type_txt"), extensions: ['txt'] }], 444 | message: i18n("dialog_msg_choose_save_path") 445 | }) 446 | 447 | if (!url) { 448 | printLog(i18n("log_msg_not_saved")) 449 | } else { 450 | fs.writeFile(url, content, (err) => { 451 | if (err) { 452 | printLog(i18n("log_msh_save_failed")) 453 | printExitLog(1) 454 | throw err 455 | } 456 | else { 457 | printLog(`\n\n${i18n("log_msg_file_already_saved_to")} ${url}\n`) 458 | printExitLog(0) 459 | } 460 | }) 461 | } 462 | }, 463 | // about page 464 | "open-about": createAboutWindow, 465 | 466 | // 检查更新 467 | "check-update": (isShowErrorDialog=false) => { 468 | const repoAuthor = 'GSWXXN'; 469 | const repoName = 'NFCToolsGUI'; 470 | 471 | const options = { 472 | hostname: 'api.github.com', 473 | path: `/repos/${repoAuthor}/${repoName}/releases/latest`, 474 | headers: {'User-Agent': repoName} 475 | }; 476 | 477 | https.get(options, (response) => { 478 | let body = ''; 479 | response.on('data', (chunk) => { 480 | body += chunk; 481 | }); 482 | response.on('end', () => { 483 | const res = JSON.parse(body) 484 | const versionName = res['name'] ?? '' 485 | const updateLogs = res['body'] ?? '' 486 | const updateUrl = res['html_url'] ?? '' 487 | 488 | if (versionName !== `v${app.getVersion()}`) { 489 | dialog.showMessageBox({ 490 | type: 'none', 491 | buttons: [i18n("dialog_button_go_to_download"), i18n("dialog_button_cancel")], 492 | message: i18n("dialog_msg_new_version_found"), 493 | detail: `${i18n("dialog_msg_version")}: ${versionName}\n\n${i18n("dialog_msg_update_logs")}\n${updateLogs}`, 494 | }).then((response) => { 495 | if (response.response === 0) shell.openExternal(updateUrl) 496 | }) 497 | } 498 | }); 499 | }).on("error", (error) => { 500 | if (isShowErrorDialog) 501 | dialog.showMessageBoxSync({ 502 | type: 'error', 503 | buttons: [i18n("dialog_button_ok")], 504 | message: i18n("dialog_msg_check_update_failed"), 505 | detail: error.message, 506 | }) 507 | else { 508 | printLog("\n\n" + i18n("log_msg_check_update_failed")) 509 | printLog("\n" + error.message) 510 | } 511 | }); 512 | } 513 | } 514 | 515 | // 保存密钥 516 | function saveKeys(keys) { 517 | const knownKeys = fs.readFileSync(knownKeysFile).toString().match(/[0-9A-Fa-f]{12}/g) 518 | keys = Array.from(new Set(knownKeys ? knownKeys.concat(keys) : keys)) 519 | defaultKeys.forEach((value) => { 520 | let i = keys.indexOf(value) 521 | if (i >= 0) keys.splice(i, 1) 522 | }) 523 | fs.writeFileSync(knownKeysFile, `${keys.join("\n")}`) 524 | } 525 | 526 | // 先读卡,然后进行后续操作 527 | function readICThenExec(msg, statusMsg, isSaveDumpFile, cmd, args, processHandler, finishHandler) { 528 | let isCmdFunc = true 529 | if (arguments.length === 4) isCmdFunc = false 530 | checkKeyFileExist() 531 | newKeys = [] 532 | knownKeyInfo = [] 533 | unknownKeyInfo = [] 534 | printStatus(i18n("indicator_detecting_ic_card")) 535 | exec( 536 | i18n("log_msg_read_ic_then_execute"), 537 | 'nfc-mfdetect', isSaveDumpFile ? [`-O${tempMFDFilePath}`, `-f${knownKeysFile}`] : [`-N`, `-f${knownKeysFile}`], 538 | (value) => {keyInfoStatistic(value)}, 539 | () => { 540 | saveKeys(newKeys) 541 | if (isSaveDumpFile && fs.statSync(tempMFDFilePath).size === 0) { 542 | fs.unlinkSync(tempMFDFilePath) 543 | } 544 | }).then(() => { 545 | printStatus(statusMsg) 546 | if (!isCmdFunc) {cmd(); return;} 547 | if (isSaveDumpFile && !fs.existsSync(tempMFDFilePath)) { 548 | printExitLog(0) 549 | return 550 | } 551 | exec(msg, cmd, args, processHandler, (code, signal)=>{ 552 | if (finishHandler) finishHandler(code, signal) 553 | fs.unlink(tempMFDFilePath, (err) => { 554 | if(err) throw err; 555 | }) 556 | }).then(()=>{printExitLog(0)}).catch(() => {}) 557 | }).catch(() => {}) 558 | } 559 | 560 | // 执行MFOC解密 561 | function mfoc(args) { 562 | let cardID = null 563 | newKeys = [] 564 | knownKeyInfo = [] 565 | unknownKeyInfo = [] 566 | checkKeyFileExist() 567 | exec( 568 | i18n("log_msg_start_mfoc"), 569 | 'mfoc', args, 570 | (value) => { 571 | keyInfoStatistic(value) 572 | 573 | let i = value.indexOf("UID (NFCID1):") 574 | if (i >= 0) { 575 | i += 14 576 | cardID = value.substring(i, i + 14).replace(/\s+/g, "") 577 | } 578 | }, 579 | () => { 580 | saveKeys(newKeys) 581 | if (fs.statSync(tempMFDFilePath).size === 0) { 582 | fs.unlink(tempMFDFilePath, (err) => { 583 | if(err) throw err; 584 | }) 585 | } else { 586 | fs.mkdir(dumpsFolder, () => { 587 | fs.rename(tempMFDFilePath, `${dumpFilesPath}/${cardID}_${getTimeList().join("_")}.mfd`, (err) =>{ 588 | if (err) throw err 589 | }) 590 | cardID = null 591 | }) 592 | } 593 | } 594 | ).then(()=>{printExitLog(0)}).catch(() => {}) 595 | } 596 | 597 | // 统计密钥信息 598 | function keyInfoStatistic(content) { 599 | 600 | //match [ Unknown Key A] or [ Found Key B: ffffffffffff] 601 | const matchStatus = content.match(/ (\w{5}|\w{7})\s+Key \w(: \w{12}|)/g) 602 | if (!matchStatus) return 603 | 604 | matchStatus.forEach((matchStr, i) => { 605 | const sector = parseInt(`${i / 2}`) 606 | if (matchStr[1] === "F") { 607 | const key = matchStr.substring(16, 28) 608 | knownKeyInfo.push([key, sector, matchStr[13]]) 609 | newKeys.join(key) 610 | } else if (matchStr[1] === "U") { 611 | unknownKeyInfo.push([sector, matchStr[13]]) 612 | } 613 | }) 614 | } 615 | 616 | // 检查密钥文件是否存在 617 | function checkKeyFileExist() { 618 | if (!fs.existsSync(knownKeysFile)) fs.writeFileSync(knownKeysFile, "") 619 | } 620 | 621 | // 配置 libnfc.conf 622 | function setNFCConfig() { 623 | sendToMainWindow("setting-nfc-config", "start") 624 | const content = `device.name = "NFC_Device"\ndevice.connstring = "pn532_uart:${status.currentDevice}:${status.currentSpeed}"` 625 | fs.writeFile(nfcConfigFilePath, content, (err) => { 626 | if (err) throw err 627 | exec(i18n("log_msg_start_connect_device"), 628 | "nfc-list", [], 629 | (value) => { 630 | if (value.indexOf("NFC device: NFC_Device opened") >= 0) { 631 | printLog(`\n*** ${i18n("log_msg_discover_device")} ***\n`) 632 | status.isDeviceConnected = true 633 | } 634 | if (value.indexOf("Unable to open NFC device") >= 0) { 635 | printLog(`\n*** ${i18n("log_msg_not_found_device")} ***\n`) 636 | status.isDeviceConnected = false 637 | } 638 | }, 639 | () => {sendToMainWindow("setting-nfc-config", status.isDeviceConnected ? "success" : "failed")}, 640 | ).then(()=>{printExitLog(0)}).catch(() => {}) 641 | }) 642 | } 643 | 644 | function getTimeList() { 645 | const date = new Date() 646 | const time = [ 647 | date.getFullYear(), 648 | date.getMonth() + 1, 649 | date.getDate(), 650 | date.getHours(), 651 | date.getMinutes(), 652 | date.getSeconds() 653 | ] 654 | time.forEach((value, index) => { 655 | if (value < 10) time[index] = `0${value}` 656 | else time[index] = `${value}` 657 | }) 658 | return time 659 | } 660 | 661 | function updateDumpFiles() { 662 | const dumpFiles = fs.readdirSync(dumpsFolder).filter(file => file.endsWith('.mfd')); 663 | sentToDumpHistoryWindow('update-dump-history', dumpFiles) 664 | } 665 | 666 | function execAction(action, arg) { 667 | actions[action](arg) 668 | } 669 | module.exports = {execAction} -------------------------------------------------------------------------------- /src/execUtils.js: -------------------------------------------------------------------------------- 1 | const cp = require('child_process') 2 | const { dialog, app } = require('electron') 3 | const { sendToMainWindow } = require("./windows") 4 | const status = require("./status") 5 | const { i18n } = require('./i18n') 6 | const path = require("path"); 7 | 8 | let task = null 9 | const binPath = app.isPackaged ? path.join(process.resourcesPath, "./framework/bin/") : path.join(__dirname, "../framework/bin/") 10 | 11 | function exec(msg, cmd, args, processHandler, finishHandler) { 12 | return new Promise((resolve, reject) => { 13 | if (status.currentDevice === null || (!status.isDeviceConnected && cmd !== "nfc-list")) { 14 | printStatus(i18n("indicator_error"), "error") 15 | dialog.showErrorBox(i18n("dialog_title_error"), i18n("dialog_msg_not_connected_device")) 16 | reject(new Error(i18n("dialog_msg_not_connected_device"))) 17 | return 18 | } 19 | if (status.isRunningTask) { 20 | dialog.showErrorBox(i18n("dialog_title_device_busy"), i18n("dialog_msg_running_task")) 21 | reject(new Error(i18n("dialog_msg_running_task"))) 22 | return 23 | } 24 | status.isRunningTask = true 25 | printLog(`\n\n### ${msg}\n`) 26 | task = cp.spawn(`${binPath}${cmd}`, args) 27 | 28 | task.stdout.on('data', (data) => { 29 | printLog(data.toString()); 30 | if (processHandler) processHandler(data.toString()) 31 | }); 32 | 33 | task.stderr.on('data', (data) => { 34 | printLog(`\n${data.toString()}`) 35 | if (processHandler) processHandler(data.toString()) 36 | }); 37 | 38 | task.on('close', (code, signal) => { 39 | if (finishHandler) finishHandler(code, signal) 40 | 41 | status.isRunningTask = false 42 | if (code !== 0) { 43 | if (signal) printExitLog(2) 44 | else { 45 | const message = `\nexit code: ${code}` 46 | printLog(message) 47 | printExitLog(1) 48 | reject(new Error(message)) 49 | } 50 | } else { 51 | resolve() 52 | } 53 | }) 54 | }) 55 | } 56 | 57 | 58 | function killProcess() { 59 | try { task.kill() } catch (e) {} 60 | status.isRunningTask = false 61 | } 62 | 63 | function printLog(msg) { 64 | sendToMainWindow("update-log-output", msg) 65 | } 66 | 67 | function printStatus(msg, indicator="running") { 68 | sendToMainWindow("update-status", {"text": msg, "indicator": indicator}) 69 | } 70 | 71 | function printExitLog(code) { 72 | switch (code) { 73 | case 0: 74 | printStatus(i18n("indicator_free"), "free") 75 | printLog(`\n${i18n("log_msg_finished")}`) 76 | break 77 | case 1: 78 | printStatus(i18n("indicator_error"), "error") 79 | printLog(`\n${i18n("log_msg_error")}`) 80 | break 81 | case 2: 82 | printStatus(i18n("indicator_free"), "free") 83 | printLog(`\n${i18n("log_msg_finished")}`) 84 | break 85 | } 86 | } 87 | 88 | module.exports = {exec, killProcess, printExitLog, printLog, printStatus} -------------------------------------------------------------------------------- /src/i18n.js: -------------------------------------------------------------------------------- 1 | const { app } = require('electron'); 2 | const path = require('path'); 3 | const fs = require('fs'); 4 | 5 | let texts = {}; 6 | 7 | function init() { 8 | const lang = getLanguage(); 9 | const langFilePath = path.join(__dirname, 'locales', `${lang}.json`); 10 | try { 11 | const langFileContent = fs.readFileSync(langFilePath, 'utf8'); 12 | texts = JSON.parse(langFileContent); 13 | } catch (err) { 14 | console.error(`Failed to load language file: ${err}`); 15 | } 16 | } 17 | 18 | function getLanguage() { 19 | const userLanguage = app.getLocale(); 20 | const [languageCode] = userLanguage.split('-'); 21 | const supportedLanguages = ['en', 'zh-CN']; // 支持的语言列表 22 | if (supportedLanguages.includes(languageCode)) { 23 | return languageCode; 24 | } else if (supportedLanguages.includes(userLanguage)) { 25 | return userLanguage; 26 | } 27 | return 'en'; // 如果用户的语言不在支持列表中,则默认使用英语 28 | } 29 | 30 | function getText(key) { 31 | return texts[key] || key; 32 | } 33 | 34 | const i18n = getText 35 | 36 | module.exports = { 37 | init, 38 | getLanguage, 39 | getText, 40 | i18n 41 | }; 42 | -------------------------------------------------------------------------------- /src/icons/icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GSWXXN/NFCToolsGUI/06e90d3231252df6273dedea8a40b3e200a7cca4/src/icons/icon.icns -------------------------------------------------------------------------------- /src/icons/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GSWXXN/NFCToolsGUI/06e90d3231252df6273dedea8a40b3e200a7cca4/src/icons/icon.ico -------------------------------------------------------------------------------- /src/icons/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GSWXXN/NFCToolsGUI/06e90d3231252df6273dedea8a40b3e200a7cca4/src/icons/icon.png -------------------------------------------------------------------------------- /src/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "app_name": "NFCToolsGUI", 3 | 4 | "indicator_free": "Free", 5 | "indicator_error": "Error", 6 | "indicator_connecting_device": "Connecting to device", 7 | "indicator_reading_ic_card": "Decrypting card", 8 | "indicator_writing_ic_card": "Writing card", 9 | "indicator_formatting_ic_card": "Formatting card", 10 | "indicator_detecting_ic_card": "Detecting card", 11 | "indicator_locking_ufuid": "Locking UFUID", 12 | "indicator_doing_hard_nested": "Performing HardNested", 13 | "indicator_testing_dictionary": "Testing dictionary", 14 | "indicator_collecting_nonces": "Collecting Nonces", 15 | 16 | "dialog_title_error": "Error", 17 | "dialog_title_device_busy": "Device Busy", 18 | "dialog_title_prompt": "Prompt", 19 | "dialog_title_choose_dump_need_to_write": "Choose dump file to write", 20 | "dialog_title_danger_operation": "Dangerous Operation Warning", 21 | "dialog_title_save_to": "Save to...", 22 | "dialog_title_choose_dictionary_file": "Choose dictionary file", 23 | "dialog_title_choose_dump_file": "Choose dump file", 24 | 25 | "dialog_msg_not_connected_device": "Please connect the device first", 26 | "dialog_msg_running_task": "A task is in progress. The operation cannot be executed", 27 | "dialog_msg_are_you_sure_to_exit": "The program is running, are you sure to exit?", 28 | "dialog_msg_card_will_be_locked": "This operation will lock the UFUID card!!!\nOnce locked, it cannot be recovered! Block 0 cannot be changed again! Are you sure you want to continue?", 29 | "dialog_msg_choose_save_path": "Please choose a save path", 30 | "dialog_msg_choose_dictionary_file": "Please choose a dictionary file", 31 | "dialog_msg_choose_dump_file": "Please choose a dump file", 32 | "dialog_msg_are_you_sure_to_delete_these_dumps": "Are you sure you want to delete these dump files?", 33 | "dialog_msg_new_version_found": "New version found", 34 | "dialog_msg_version": "Version", 35 | "dialog_msg_update_logs": "Update Logs", 36 | "dialog_msg_check_update_failed": "Check for updates failed", 37 | 38 | "dialog_button_cancel": "Cancel", 39 | "dialog_button_still_exit": "Still Exit", 40 | "dialog_button_ok": "OK", 41 | "dialog_button_open": "Open", 42 | "dialog_button_go_to_download": "Go to Download", 43 | 44 | "file_type_dump": "Dump File", 45 | "file_type_bin": "BIN File", 46 | "file_type_dict": "Dictionary File", 47 | "file_type_txt": "TXT File", 48 | 49 | "log_msg_finished": "### Finished ###", 50 | "log_msg_error": "### Error Occurred ###", 51 | "log_msg_start_write_card": "Start Writing to M1 Card", 52 | "log_msg_start_format_card": "Start Formatting M1 Card", 53 | "log_msg_start_detect_card": "Start Detecting Card Type", 54 | "log_msg_start_lock_ufuid": "Start Locking UFUID", 55 | "lod_msg_start_auto_hard_nested": "Start Auto-Decrypting HardNested", 56 | "lod_msg_start_hard_nested": "Start HardNested Decrypting", 57 | "log_msg_not_found_known_key": "Not found Known keys", 58 | "log_msg_tried_decrypt_all_unknown_keys": "Attempted to decrypt all unknown keys", 59 | "log_msg_start_collect_nonces": "Start Collecting Nonces", 60 | "log_msg_not_saved": "Not Saved", 61 | "log_msh_save_failed": "Save Failed", 62 | "log_msg_file_already_saved_to": "Already Saved to", 63 | "log_msg_start_test_dictionary": "Start Dictionary Test", 64 | "log_msg_read_ic_then_execute": "Read the card first, then use the decryption key for subsequent operations\n\n# Start detection", 65 | "log_msg_start_mfoc": "Start MFOC decryption", 66 | "log_msg_start_connect_device": "Start Connecting Device", 67 | "log_msg_discover_device": "Device Discovered", 68 | "log_msg_not_found_device": "Device not found!", 69 | "log_msg_check_update_failed": "Check for updates failed", 70 | 71 | "html_tools": "Tools", 72 | "html_settings": "Settings", 73 | "html_edit_history_key": "Edit Historical Keys", 74 | "html_dump_editor": "Dump Editor", 75 | "html_dump_comparator": "Dump Comparator", 76 | "html_dump_history": "History", 77 | "html_minimize": "Minimize", 78 | "html_close": "Close", 79 | "html_choose_device": "Choose Device", 80 | "html_read_card": "Read Card", 81 | "html_read_card_with_known_key": "Read Card with Known Key", 82 | "html_write_card": "Write Card", 83 | "html_format_card": "Format Card", 84 | "html_detect_card": "Detect Card Encryption", 85 | "html_lock_ufuid": "Lock UFUID", 86 | "html_hard_nested": "HardNested Decryption", 87 | "html_test_dictionary": "Dictionary Test", 88 | "html_lock_scroll": "Lock Scrolling", 89 | "html_unlock_scroll": "Auto Scroll", 90 | "html_stop_task": "Stop Task", 91 | "html_save_log": "Save Log", 92 | "html_clear_log": "Clear Log", 93 | "html_timer": "Timer", 94 | "html_current_version": "Current Version:", 95 | "html_check_update": "Check for Updates", 96 | "html_please_input_known_keys": "Please Enter Known Keys", 97 | "html_input_test_info": "Enter the sector information and dictionary start position you want to test, to continue from where you left off", 98 | "html_dictionary_file": "Dictionary File", 99 | "html_build_in_dictionary": "Built-in Dict", 100 | "html_choose_file": "Choose File", 101 | "html_sector": "Sector", 102 | "html_key_type": "Type", 103 | "html_start_position": "Start Position", 104 | "html_dump": "Dump", 105 | "html_data_format_wrong": "Data Format Error", 106 | "html_save_success": "Saved Successfully", 107 | "html_current_file": "Current File", 108 | "html_open_file": "Open File", 109 | "html_save_file": "Save File", 110 | "html_caption": "Caption", 111 | "html_uid_manufacture_info": "UID & ManufInfo", 112 | "html_key_a": "KeyA", 113 | "html_key_b": "KeyB", 114 | "html_access_control": "ACs", 115 | "html_update_colors": "Update Colors", 116 | "html_compute_dump": "Compare Dumps", 117 | "html_edit_dump": "Edit Dump", 118 | "html_delete_checked": "Delete Checked", 119 | "html_please_input_known_keys_split_by_comma": "Please Enter Known Keys, Separated by Comma", 120 | "html_auto_run": "Auto Run", 121 | "html_known_info": "Known Information", 122 | "html_known_key": "Known Key", 123 | "html_execute": "Execute", 124 | "html_target_sector_info": "Target Sector Information", 125 | "html_collect_only": "Collect Only without Calculation", 126 | "html_about": "About", 127 | "html_version_code": "Version: ", 128 | "html_builder": "Builder: ", 129 | "html_open_source_repository": "Open Source Repository: ", 130 | "html_license:": "License: ", 131 | "html_this_program_use_following_open_source_project": "This program uses the following open source projects:", 132 | "html_source_code": "Source Code", 133 | "html_license": "License" 134 | } -------------------------------------------------------------------------------- /src/locales/zh-CN.json: -------------------------------------------------------------------------------- 1 | { 2 | "app_name": "NFCToolsGUI", 3 | 4 | "indicator_free": "空闲", 5 | "indicator_error": "出错", 6 | "indicator_connecting_device": "正在连接设备", 7 | "indicator_reading_ic_card": "正在解卡", 8 | "indicator_writing_ic_card": "正在写卡", 9 | "indicator_formatting_ic_card": "正在格式化卡片", 10 | "indicator_detecting_ic_card": "正在检测卡片", 11 | "indicator_locking_ufuid": "正在锁 UFUID", 12 | "indicator_doing_hard_nested": "正在执行 HardNested 解密", 13 | "indicator_testing_dictionary": "正在进行字典测试", 14 | "indicator_collecting_nonces": "正在收集 Nonces", 15 | 16 | "dialog_title_error" : "出错", 17 | "dialog_title_device_busy": "设备忙", 18 | "dialog_title_prompt": "提示", 19 | "dialog_title_choose_dump_need_to_write": "选择需要写入的转储文件", 20 | "dialog_title_danger_operation": "危险操作警告", 21 | "dialog_title_save_to": "保存到...", 22 | "dialog_title_choose_dictionary_file": "选择字典文件", 23 | "dialog_title_choose_dump_file": "选择转储文件", 24 | 25 | "dialog_msg_not_connected_device": "请先连接设备", 26 | "dialog_msg_running_task": "有任务进行中,不可执行", 27 | "dialog_msg_are_you_sure_to_exit": "程序正在运行, 你确定要关闭吗", 28 | "dialog_msg_card_will_be_locked": "该操作将会锁死UFUID卡片!!!\n锁死后不可恢复!无法再次更改0块!请确认是否要继续操作?", 29 | "dialog_msg_choose_save_path": "请选择保存路径", 30 | "dialog_msg_choose_dictionary_file": "请选择字典文件", 31 | "dialog_msg_choose_dump_file": "请选择转储文件", 32 | "dialog_msg_are_you_sure_to_delete_these_dumps": "你确定要删除这些转储文件吗?", 33 | "dialog_msg_new_version_found": "发现新版本", 34 | "dialog_msg_version": "版本", 35 | "dialog_msg_update_logs": "更新日志", 36 | "dialog_msg_check_update_failed": "检查更新失败", 37 | 38 | "dialog_button_cancel" : "取消", 39 | "dialog_button_still_exit" : "仍然退出", 40 | "dialog_button_ok" : "确定", 41 | "dialog_button_open" : "打开", 42 | "dialog_button_go_to_download": "前往下载", 43 | 44 | "file_type_dump": "转储文件", 45 | "file_type_bin": "BIN 文件", 46 | "file_type_dict": "字典文件", 47 | "file_type_txt": "TXT 文件", 48 | 49 | "log_msg_finished": "### 运行完毕 ###", 50 | "log_msg_error": "### 运行出错 ###", 51 | "log_msg_start_write_card": "开始执行写入 M1 卡片", 52 | "log_msg_start_format_card": "开始执行格式化 M1 卡片", 53 | "log_msg_start_detect_card": "开始执行检测卡片l类型", 54 | "log_msg_start_lock_ufuid": "开始执行锁定 UFUID", 55 | "lod_msg_start_auto_hard_nested": "开始自动解密 HardNested", 56 | "lod_msg_start_hard_nested": "开始执行 HardNested 解密", 57 | "log_msg_not_found_known_key": "未发现已知密钥", 58 | "log_msg_tried_decrypt_all_unknown_keys": "已尝试解密全部未知密钥", 59 | "log_msg_start_collect_nonces": "开始收集 Nonces", 60 | "log_msg_not_saved": "未保存", 61 | "log_msh_save_failed": "保存失败", 62 | "log_msg_file_already_saved_to": "已保存到", 63 | "log_msg_start_test_dictionary": "开始执行字典测试", 64 | "log_msg_read_ic_then_execute": "先读卡,然后利用解卡密钥进行后续操作\n\n# 开始执行检测卡片", 65 | "log_msg_start_mfoc": "开始执行 MFOC 解密", 66 | "log_msg_start_connect_device": "开始连接设备", 67 | "log_msg_discover_device": "发现设备", 68 | "log_msg_not_found_device": "未发现设备!", 69 | "log_msg_check_update_failed": "检查更新失败", 70 | 71 | "html_tools": "工具", 72 | "html_settings": "设置", 73 | "html_edit_history_key": "编辑历史密钥", 74 | "html_dump_editor": "转储编辑器", 75 | "html_dump_comparator": "转储比较器", 76 | "html_dump_history": "历史记录", 77 | "html_minimize": "最小化", 78 | "html_close": "关闭", 79 | "html_choose_device": "选择设备", 80 | "html_read_card": "一键解卡", 81 | "html_read_card_with_known_key": "已知密钥解卡", 82 | "html_write_card": "一键写卡", 83 | "html_format_card": "格式化", 84 | "html_detect_card": "检测卡片加密", 85 | "html_lock_ufuid": "锁定 UFUID", 86 | "html_hard_nested": "HardNested 解密", 87 | "html_test_dictionary": "字典测试", 88 | "html_lock_scroll": "锁定滚动", 89 | "html_unlock_scroll": "自动滚动", 90 | "html_stop_task": "停止任务", 91 | "html_save_log": "保存日志", 92 | "html_clear_log": "清空日志", 93 | "html_timer": "计时器", 94 | "html_current_version": "当前版本:", 95 | "html_check_update": "检查更新", 96 | "html_please_input_known_keys": "请输入已知密钥", 97 | "html_input_test_info": "输入你想要测试的扇区信息以及字典起始位置, 以便接着上次跑", 98 | "html_dictionary_file": "字典文件", 99 | "html_build_in_dictionary": "内置字典", 100 | "html_choose_file": "选择文件", 101 | "html_sector": "扇区", 102 | "html_key_type": "类型", 103 | "html_start_position": "起始位置", 104 | "html_dump": "转储", 105 | "html_data_format_wrong": "数据格式错误", 106 | "html_save_success": "保存成功", 107 | "html_current_file": "当前文件", 108 | "html_open_file": "打开文件", 109 | "html_save_file": "保存文件", 110 | "html_caption": "图例", 111 | "html_uid_manufacture_info": "UID & 厂家信息", 112 | "html_key_a": "密钥 A", 113 | "html_key_b": "密钥 B", 114 | "html_access_control": "访问控制", 115 | "html_update_colors": "更新颜色", 116 | "html_compute_dump": "比较转储", 117 | "html_edit_dump": "编辑转储", 118 | "html_delete_checked": "删除选中", 119 | "html_please_input_known_keys_split_by_comma": "请输入已知的Key, 以英文半角逗号分隔", 120 | "html_auto_run": "自动执行", 121 | "html_known_info": "已知信息", 122 | "html_known_key": "已知密钥", 123 | "html_execute": "执行", 124 | "html_target_sector_info": "目标扇区解密信息", 125 | "html_collect_only": "只采集不计算", 126 | "html_about": "关于", 127 | "html_version_code": "版本号: ", 128 | "html_builder": "编译者: ", 129 | "html_open_source_repository": "开源仓库: ", 130 | "html_license:": "许可证: ", 131 | "html_this_program_use_following_open_source_project": "本程序使用了以下开源项目:", 132 | "html_source_code": "源代码", 133 | "html_license": "许可证" 134 | } -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | const {execAction} = require('./command') 2 | const {app, BrowserWindow, ipcMain, Menu, nativeTheme, shell} = require('electron') 3 | const {createMainWindow} = require('./windows') 4 | const {killProcess} = require('./execUtils') 5 | const path = require("path"); 6 | const buildInfo = require('./buildInfo.json'); 7 | const i18n = require('./i18n'); 8 | 9 | process.env['LIBNFC_SYSCONFDIR'] = app.getPath('userData') 10 | 11 | Menu.setApplicationMenu(null) 12 | 13 | ipcMain.handle('minimize-current-window', (event) => { 14 | BrowserWindow.fromWebContents(event.sender).minimize() 15 | }) 16 | ipcMain.handle("close-current-window", (event) => { 17 | BrowserWindow.fromWebContents(event.sender).close() 18 | }) 19 | ipcMain.on('rendered', (event) => { 20 | BrowserWindow.fromWebContents(event.sender).show() 21 | }) 22 | 23 | ipcMain.handle('get-app-version', () => {return buildInfo.version}) 24 | ipcMain.handle('get-builder', () => {return buildInfo.builder}) 25 | ipcMain.handle('exec-action', (event, action, arg) => { 26 | execAction(action, arg) 27 | }) 28 | ipcMain.handle('open-link', (event, url) => { 29 | shell.openExternal(url) 30 | }) 31 | ipcMain.handle('dark-mode:system', () => { 32 | nativeTheme.themeSource = 'system' 33 | }) 34 | ipcMain.handle('dark-mode:light', () => { 35 | nativeTheme.themeSource = 'light' 36 | }) 37 | ipcMain.handle('dark-mode:dark', () => { 38 | nativeTheme.themeSource = 'dark' 39 | }) 40 | 41 | ipcMain.on('ondragstart', (event, filePath) => { 42 | event.sender.startDrag({ 43 | file: filePath, 44 | icon: path.join(__dirname, 'renderer/assets/icon/16/drag.png') 45 | }) 46 | }) 47 | ipcMain.on('get-text', (event, key) => { 48 | event.returnValue = i18n.getText(key); 49 | }); 50 | ipcMain.on('get-language', (event) => { 51 | event.returnValue = i18n.getLanguage(); 52 | }); 53 | 54 | 55 | // This method will be called when Electron has finished 56 | // initialization and is ready to create browser windows. 57 | // Some APIs can onlybe used after this event occurs. 58 | app.on('ready', () => { 59 | i18n.init(); 60 | createMainWindow(); 61 | }) 62 | 63 | // Quit when all windows are closed, except on macOS. There, it's common 64 | // for applications and their menu bar to stay active until the user quits 65 | // explicitly with Cmd + Q. 66 | app.on('window-all-closed', () => { 67 | killProcess() 68 | app.quit(); 69 | }) 70 | 71 | app.on('activate', () => { 72 | // On OS X it's common to re-create a window in the app when the 73 | // dock icon is clicked and there are no other windows open. 74 | if (BrowserWindow.getAllWindows().length === 0) { 75 | createMainWindow(); 76 | } 77 | }) -------------------------------------------------------------------------------- /src/preload.js: -------------------------------------------------------------------------------- 1 | // See the Electron documentation for details on how to use preload scripts: 2 | // https://www.electronjs.org/docs/latest/tutorial/process-model#preload-scripts 3 | const {contextBridge, ipcRenderer} = require('electron') 4 | 5 | 6 | contextBridge.exposeInMainWorld('electronAPI', { 7 | devicePrefix: "/dev/tty.", 8 | platform: process.platform, 9 | 10 | onUpdateLogOutput: (callback) => ipcRenderer.on("update-log-output", callback), 11 | onUpdateStatus: (callback) => ipcRenderer.on("update-status", callback), 12 | onUpdateUSBDevices: (callback) => ipcRenderer.on("update-usb-devices", callback), 13 | onUpdateDumpEditorFile: (callback) => ipcRenderer.on("update-dump-editor-file", callback), 14 | onUpdateDumpComparatorFile: (callback) => ipcRenderer.on("update-dump-comparator-files", callback), 15 | onSettingNFCConfig: (callback) => ipcRenderer.on("setting-nfc-config", callback), 16 | onCreateHardNestedWindow: (config) => ipcRenderer.on("update-hard-nested-config", config), 17 | onCreateDictTestWindow: (config) => ipcRenderer.on("update-dict-test-config", config), 18 | onCreateDumpHistoryWindow: (dumps) => ipcRenderer.on("update-dump-history", dumps), 19 | onOpenDictFile: (callback) => ipcRenderer.on("dict-file-name", callback), 20 | onOpenDumpFile: (callback) => ipcRenderer.on("binary-data", callback), 21 | onSavedDumpFile: (callback) => ipcRenderer.on("saved-binary-data", callback), 22 | 23 | getVersion: () => ipcRenderer.invoke("get-app-version"), 24 | getBuilder: () => ipcRenderer.invoke('get-builder'), 25 | closeCurrentWindow: () => ipcRenderer.invoke("close-current-window"), 26 | minimizeCurrentWindow: () => ipcRenderer.invoke("minimize-current-window"), 27 | openLink: (link) => ipcRenderer.invoke("open-link", link), 28 | execAction: (action, arg) => ipcRenderer.invoke("exec-action", action, arg), 29 | 30 | startDrag: (path) => {ipcRenderer.send('ondragstart', path)}, 31 | rendered: () => ipcRenderer.send('rendered'), 32 | getText: (key) => ipcRenderer.sendSync('get-text', key), 33 | getLanguage: () => ipcRenderer.sendSync('get-language'), 34 | }) 35 | contextBridge.exposeInMainWorld('darkMode', { 36 | light: () => ipcRenderer.invoke('dark-mode:light'), 37 | dark: () => ipcRenderer.invoke('dark-mode:dark'), 38 | system: () => ipcRenderer.invoke('dark-mode:system') 39 | }) -------------------------------------------------------------------------------- /src/renderer/assets/font/SourceCodePro-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GSWXXN/NFCToolsGUI/06e90d3231252df6273dedea8a40b3e200a7cca4/src/renderer/assets/font/SourceCodePro-Regular.ttf -------------------------------------------------------------------------------- /src/renderer/assets/icon/128/drag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GSWXXN/NFCToolsGUI/06e90d3231252df6273dedea8a40b3e200a7cca4/src/renderer/assets/icon/128/drag.png -------------------------------------------------------------------------------- /src/renderer/assets/icon/16/drag.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/GSWXXN/NFCToolsGUI/06e90d3231252df6273dedea8a40b3e200a7cca4/src/renderer/assets/icon/16/drag.png -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/close.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 10 | 11 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/del.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/icon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/locked.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/minimize.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/rename.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/save.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 14 | 15 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/settings.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/stop.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 9 | 10 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/timer.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/tools.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 12 | 17 | 18 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/trash.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 8 | 11 | 13 | 15 | 17 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/renderer/assets/icon/svg/unlock.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 7 | 11 | 12 | -------------------------------------------------------------------------------- /src/renderer/css/about.css: -------------------------------------------------------------------------------- 1 | body{ 2 | user-select: none; 3 | background-color: #f7f8fa; 4 | } 5 | h1{ 6 | margin-bottom: 0; 7 | } 8 | .container { 9 | display: flex; 10 | } 11 | 12 | .icon { 13 | width: 150px; 14 | height: 150px; 15 | margin-top: 40px; 16 | margin-left: 20px; 17 | } 18 | 19 | .info { 20 | flex: 1; 21 | padding-left: 20px; 22 | } 23 | .opensource { 24 | height: 200px; 25 | width: calc(100% - 20px); 26 | overflow-y: scroll; 27 | background-color: #eaeaea; 28 | border-radius: 20px; 29 | padding-top: 0; 30 | user-select: text; 31 | } 32 | ul{ 33 | margin: 10px; 34 | } 35 | span{ 36 | font-size: 14px; 37 | display: inline-block; 38 | padding-top: 8px; 39 | padding-bottom: 2px; 40 | } 41 | 42 | a:link { 43 | font-size: 14px; 44 | color: #000000; 45 | text-decoration: none; 46 | } 47 | a:visited { 48 | text-decoration: none; 49 | } 50 | a:hover { 51 | text-decoration: underline; 52 | } 53 | button{ 54 | border: none; 55 | background-color: lightgray; 56 | cursor: pointer; 57 | font-size: 12px; 58 | color: #000000; 59 | border-radius: 20px; 60 | padding: 3px 8px 3px 8px; 61 | margin-left: 5px; 62 | } 63 | button:hover{ 64 | background-color: #dcdbdb; 65 | } 66 | button:focus{ 67 | outline: none; 68 | } 69 | ul{ 70 | padding-left: 0; 71 | font-size: 14px; 72 | } 73 | li{ 74 | background-color: #f3f3f3; 75 | padding: 5px; 76 | border-radius: 8px; 77 | list-style: none; 78 | margin-bottom: 5px; 79 | margin-top: 5px; 80 | } 81 | .opensource_link{ 82 | float: right; 83 | display: inline-block; 84 | } 85 | .tag{ 86 | font-weight: bold; 87 | } 88 | 89 | @media (prefers-color-scheme: dark) { 90 | body { 91 | background-color: #1b202b; 92 | color: #cbcdce; 93 | } 94 | .opensource { 95 | background-color: #212121; 96 | } 97 | a:link { 98 | color: #cbcdce;; 99 | } 100 | button { 101 | background-color: #3a4150; 102 | color: #cbcdce; 103 | } 104 | button:hover { 105 | background-color: #53565d; 106 | } 107 | li { 108 | background-color: #444444; 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /src/renderer/css/dumpComparator.css: -------------------------------------------------------------------------------- 1 | @font-face{ 2 | font-family: 'SourceCodePro'; 3 | src: url('../assets/font/SourceCodePro-Regular.ttf'); 4 | font-weight: normal; 5 | font-style: normal; 6 | } 7 | .dump-text{ 8 | font-family: "SourceCodePro", serif; 9 | font-size: 14px; 10 | white-space: pre; 11 | margin: 0; 12 | padding: 0; 13 | border: 0; 14 | width: 100%; 15 | height: 100%; 16 | overflow: auto; 17 | user-select: text; 18 | } 19 | .sector-tag{ 20 | margin-bottom: 8px; 21 | } 22 | 23 | #top-bar{ 24 | padding-top: 10px; 25 | position: fixed; 26 | top: 0; 27 | left: 0; 28 | right: 0; 29 | } 30 | #top-bar span{ 31 | margin-left: 20px; 32 | display: inline-block; 33 | vertical-align: middle; 34 | } 35 | #top-bar button{ 36 | height: 20px; 37 | border: none; 38 | border-radius: 5px; 39 | vertical-align: middle; 40 | } 41 | 42 | #top-bar button:focus{ 43 | outline: none; 44 | } 45 | #top-bar hr { 46 | margin-bottom: 0; 47 | } 48 | #compare-container{ 49 | margin-top: 80px; 50 | text-align: center; 51 | } 52 | #compare-container hr{ 53 | border: 0; 54 | padding-top: 1px; 55 | margin-top: 8px; 56 | margin-bottom: 8px; 57 | } 58 | 59 | body{ 60 | user-select: none; 61 | } 62 | button{ 63 | cursor: pointer; 64 | } 65 | 66 | @media (prefers-color-scheme: light) { 67 | .dump-text { 68 | background-color: #fff; 69 | color: #000; 70 | } 71 | 72 | #top-bar { 73 | background-color: white; 74 | } 75 | 76 | #top-bar button { 77 | background-color: #486bc7; 78 | color: white; 79 | box-shadow: 0 0 5px rgb(72 107 199 / 30%); 80 | } 81 | 82 | #top-bar button:active { 83 | background-color: #3856b0; 84 | } 85 | 86 | #top-bar hr { 87 | background-color: white; 88 | } 89 | 90 | #compare-container hr { 91 | background: linear-gradient(to right, transparent, #b0b0b4, transparent); 92 | } 93 | 94 | mark { 95 | background-color: #ffd6d6; 96 | } 97 | } 98 | 99 | @media (prefers-color-scheme: dark) { 100 | body { 101 | background-color: #1b202b; 102 | color: #cbcdce; 103 | } 104 | 105 | .dump-text { 106 | background-color: #1b202b; 107 | color: #cbcdce; 108 | } 109 | 110 | #top-bar { 111 | background-color: #1b202b; 112 | } 113 | 114 | #top-bar button { 115 | background-color: #384151; 116 | color: #cbcdce; 117 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); 118 | } 119 | 120 | #top-bar button:active { 121 | background-color: #475467; 122 | } 123 | 124 | #top-bar hr { 125 | background-color: white; 126 | } 127 | 128 | #compare-container hr { 129 | background: linear-gradient(to right, transparent, #b0b0b4, transparent); 130 | } 131 | 132 | mark { 133 | color: #cbcdce; 134 | background-color: #7c5d5d; 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /src/renderer/css/dumpEditor.css: -------------------------------------------------------------------------------- 1 | .uid{ 2 | color: #7742b8; 3 | } 4 | .keyA{ 5 | color: #96e187; 6 | } 7 | .keyB{ 8 | color: #4d8027; 9 | } 10 | .accessControl{ 11 | color: #e2702f; 12 | } 13 | 14 | body{ 15 | margin-bottom: 120px; 16 | margin-top: 0; 17 | } 18 | 19 | .binary-input{ 20 | margin:0 auto; 21 | white-space: pre-wrap; 22 | border-radius: 6px; 23 | font-size: 14px; 24 | font-family: "SourceCodePro", serif; 25 | text-align: center; 26 | width: fit-content; 27 | padding: 8px; 28 | } 29 | .binary-input:focus{ 30 | outline: 0; 31 | } 32 | .textarea-label{ 33 | display: flex; 34 | margin: 20px auto 5px; 35 | font-size: 14px; 36 | } 37 | 38 | 39 | #bottom-area{ 40 | position: fixed; 41 | z-index: 999; 42 | bottom: 0; 43 | right: 0; 44 | left: 0; 45 | text-align: left; 46 | padding-bottom: 10px; 47 | padding-top: 8px; 48 | font-size: 12px; 49 | } 50 | #update-tag-color{ 51 | font-size: 11px; 52 | border: none; 53 | border-radius: 10px; 54 | width: max-content; 55 | height: 20px; 56 | cursor: pointer; 57 | margin-right: 10px; 58 | margin-left: 15px; 59 | vertical-align: middle; 60 | box-shadow: none; 61 | } 62 | #file-info{ 63 | text-align: center; 64 | width: 100%; 65 | } 66 | #file-info span{ 67 | vertical-align: middle; 68 | } 69 | #file-info button{ 70 | margin-top: 10px; 71 | margin-bottom: 8px; 72 | } 73 | #file-info img{ 74 | vertical-align: middle; 75 | } 76 | #caption_area{ 77 | margin-left: 10px; 78 | } 79 | #caption_area span{ 80 | display: inline-block; 81 | vertical-align: middle; 82 | } 83 | 84 | @media (prefers-color-scheme: light) { 85 | .binary-input { 86 | border: 1px solid #ccc; 87 | } 88 | 89 | .binary-input:focus { 90 | border-color: #66afe9; 91 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6) 92 | } 93 | 94 | #bottom-area { 95 | background-color: white; 96 | } 97 | 98 | #update-tag-color { 99 | background-color: lightgray; 100 | color: black; 101 | } 102 | } 103 | 104 | @media (prefers-color-scheme: dark) { 105 | body { 106 | background-color: #1b202b; 107 | color: #cbcdce; 108 | } 109 | 110 | .binary-input { 111 | border: 1px solid #000000; 112 | background-color: #3f3f46; 113 | color: #cbcdce; 114 | } 115 | 116 | .binary-input:focus { 117 | border-color: #000000; 118 | box-shadow: inset 0 1px 1px #222225, 0 0 8px rgba(67, 68, 82, 0.93) 119 | } 120 | 121 | #bottom-area { 122 | background-color: #1b202b; 123 | } 124 | 125 | #update-tag-color { 126 | background-color: #3a4150; 127 | color: #cbcdce; 128 | } 129 | #drag{ 130 | filter: invert(80%); 131 | } 132 | } -------------------------------------------------------------------------------- /src/renderer/css/dumpHistory.css: -------------------------------------------------------------------------------- 1 | .selected .dump-item { 2 | border-radius: 10px; 3 | } 4 | body { 5 | font-family: Arial, sans-serif; 6 | margin-bottom: 90px; 7 | user-select: none; 8 | } 9 | 10 | hr { 11 | border: 0; 12 | padding-top: 1px; 13 | background: linear-gradient(to right, transparent, #d0d0d5, transparent); 14 | } 15 | 16 | #dumpsList { 17 | list-style: none; 18 | padding: 0; 19 | margin: 0 auto; 20 | width: 80%; 21 | } 22 | 23 | .dump-item { 24 | margin-bottom: 5px; 25 | margin-top: 5px; 26 | cursor: pointer; 27 | padding: 5px; 28 | display: flex; 29 | justify-content: space-between; 30 | align-items: center; 31 | height: 25px; 32 | text-align: center; 33 | } 34 | 35 | #buttons { 36 | position: fixed; 37 | bottom: 0; 38 | left: 0; 39 | right: 0; 40 | display: flex; 41 | justify-content: center; 42 | z-index: 1; 43 | padding-top: 10px; 44 | padding-bottom: 20px; 45 | } 46 | 47 | #buttons button { 48 | border: none; 49 | border-radius: 10px; 50 | width: 80px; 51 | height: 30px; 52 | cursor: pointer; 53 | margin: 10px 10px 20px 15px; 54 | } 55 | #buttons button:hover{ 56 | transition: 80ms; 57 | } 58 | #buttons button:disabled { 59 | opacity: 0.5; 60 | box-shadow: none; 61 | cursor: not-allowed; 62 | } 63 | #dumpsList li span{ 64 | text-overflow: ellipsis; 65 | overflow: hidden; 66 | white-space: nowrap; 67 | font-size: 14px; 68 | } 69 | .dump-action-button { 70 | cursor: pointer; 71 | background-color: transparent; 72 | border: none; 73 | width: 30px; 74 | height: 30px; 75 | } 76 | .dump-action-button:hover { 77 | border-radius: 20%; 78 | } 79 | .dump-action-button-img{ 80 | width: 100%; 81 | height: 100%; 82 | vertical-align: middle; 83 | text-align: center; 84 | } 85 | .dump-action-edit{ 86 | width: 100%; 87 | font-size: 14px; 88 | padding: 3px; 89 | outline: 0; 90 | border-radius: 6px; 91 | } 92 | .dump-item-filename{ 93 | min-width: calc(100% - 60px); 94 | text-align: left; 95 | } 96 | 97 | @media (prefers-color-scheme: light) { 98 | .selected .dump-item { 99 | background-color: #D2DEF9; 100 | } 101 | 102 | #buttons { 103 | background-color: white; 104 | } 105 | 106 | #buttons button { 107 | background-color: #f4f5fc; 108 | color: black; 109 | box-shadow: 0 6px 12px rgb(65 104 207 / 20%); 110 | } 111 | 112 | #buttons button:hover { 113 | background-color: #4168cf; 114 | color: white; 115 | } 116 | 117 | #buttons button:disabled { 118 | background-color: #e0e0e0; 119 | color: #a0a0a0; 120 | } 121 | 122 | .dump-action-button:hover { 123 | background-color: rgba(162, 161, 161, 0.37); 124 | } 125 | 126 | .dump-action-edit { 127 | border-color: #66afe9; 128 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6) 129 | } 130 | } 131 | @media (prefers-color-scheme: dark) { 132 | body { 133 | background-color: #1b202b; 134 | color: #cbcdce; 135 | } 136 | 137 | .selected .dump-item { 138 | background-color: #32426b; 139 | } 140 | 141 | #buttons { 142 | background-color: #1b202b; 143 | } 144 | 145 | #buttons button { 146 | background-color: #384151; 147 | color: #cbcdce; 148 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); 149 | } 150 | 151 | #buttons button:hover { 152 | background-color: #4c5463; 153 | color: #cbcdce; 154 | } 155 | 156 | #buttons button:disabled { 157 | background-color: #1a1a1a; 158 | color: #a0a0a0; 159 | } 160 | 161 | .dump-action-button:hover { 162 | background-color: rgba(162, 161, 161, 0.37); 163 | } 164 | 165 | .dump-action-edit { 166 | background-color: #3f3f46; 167 | color: #cbcdce; 168 | border-color: #000000; 169 | box-shadow: inset 0 1px 1px #222225, 0 0 8px rgba(67, 68, 82, 0.93) 170 | } 171 | .invert-color-when-dark{ 172 | filter: invert(80%); 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /src/renderer/css/index.css: -------------------------------------------------------------------------------- 1 | :root{ 2 | --side-bar-width: 40px; 3 | --bottom-bar-height: 40px; 4 | --console-height: 340px; 5 | } 6 | @font-face{ 7 | font-family: 'SourceCodePro'; 8 | src: url('../assets/font/SourceCodePro-Regular.ttf'); 9 | font-weight: normal; 10 | font-style: normal; 11 | } 12 | img{ 13 | pointer-events:none; 14 | } 15 | body { 16 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif; 17 | margin: 50px 0 0; 18 | max-width: 38rem; 19 | padding: 2rem; 20 | user-select: none; 21 | } 22 | select{ 23 | width: 120px; 24 | } 25 | #title-bar { 26 | -webkit-app-region: drag; 27 | height: 40px; 28 | margin-top: 0; 29 | padding-top: 0; 30 | position: fixed; 31 | top: 0; 32 | left: 0; 33 | right: 0; 34 | } 35 | .title{ 36 | display: flex; 37 | float: right; 38 | align-items: center; 39 | margin-right: 135px; 40 | } 41 | .title span{ 42 | display:inline-block; 43 | text-align: center; 44 | line-height: 40px; 45 | font-size: 16px; 46 | } 47 | .title img{ 48 | display: none; 49 | width: 36px; 50 | height: 36px; 51 | 52 | } 53 | .deviceConfigForm{ 54 | display: flex; 55 | height: 28px; 56 | float: right; 57 | } 58 | .deviceConfigForm .bar-button{ 59 | margin-left: 10px; 60 | margin-top: 2px; 61 | width: 36px; 62 | height: 36px; 63 | -webkit-app-region: none; 64 | } 65 | .bar-button:hover{ 66 | border-radius: 6px; 67 | } 68 | .selection{ 69 | display: flex; 70 | -webkit-app-region: none; 71 | height: 28px; 72 | margin-top: 6px; 73 | padding-left: 10px; 74 | border-radius: 6px; 75 | } 76 | .selection:hover{ 77 | border-radius: 6px; 78 | } 79 | .selection .selection-value{ 80 | width: 80%; 81 | line-height: 28px; 82 | display: inline-block; 83 | border: none; 84 | outline: none; 85 | cursor: pointer; 86 | background: transparent; 87 | user-select: none; 88 | font-size: 13px; 89 | } 90 | .selection-value::placeholder { 91 | opacity: 1; 92 | } 93 | .down-arrow { 94 | border-top: 1px solid; 95 | border-right: 1px solid; 96 | width: 5px; 97 | height: 5px; 98 | transform: rotate(135deg); 99 | margin-top: 10px; 100 | } 101 | 102 | .dropdown-menus{ 103 | position: absolute; 104 | top: 38px; 105 | min-width: 170px; 106 | display: none; 107 | border-radius: 8px; 108 | overflow-y: scroll; 109 | min-height: 42px; 110 | ::-webkit-scrollbar: none; 111 | } 112 | .dropdown-menus::-webkit-scrollbar{ 113 | display: none; 114 | } 115 | 116 | .usb-ports-list .dropdown-menus{ 117 | position: absolute; 118 | max-height: 200px; 119 | } 120 | .tools-list { 121 | margin-right: 20px; 122 | } 123 | .tools-list .dropdown-menus{ 124 | position: absolute; 125 | right: 20px; 126 | } 127 | .dropdown-menu{ 128 | padding: 6px 0; 129 | margin: 0 5px 0 5px; 130 | list-style: none; 131 | } 132 | .menu-item{ 133 | width: inherit; 134 | height: 30px; 135 | cursor: pointer; 136 | line-height: 30px; 137 | padding-left: 10px; 138 | padding-right: 20px; 139 | font-size: 13px; 140 | user-select: none; 141 | } 142 | .menu-item:hover{ 143 | outline: 0; 144 | border-radius: 5px; 145 | } 146 | 147 | .bar-button{ 148 | text-align: center; 149 | background-color: transparent; 150 | border: 0; 151 | } 152 | #left-bar .bar-button{ 153 | margin-top: 5px; 154 | width: 35px; 155 | height: 35px; 156 | } 157 | .button-img{ 158 | width: 80%; 159 | border: none; 160 | vertical-align: middle; 161 | } 162 | .bar-button:hover{ 163 | border-radius: 6px; 164 | } 165 | 166 | 167 | .bottom-bar-item{ 168 | display: flex; 169 | align-items: center; 170 | } 171 | #check-update{ 172 | display: block; 173 | margin-left: 20px; 174 | } 175 | .bottom-bar-item span{ 176 | white-space: nowrap; 177 | display: inline-block; 178 | overflow: hidden; 179 | text-overflow: ellipsis; 180 | font-size: 14px; 181 | padding-right: 5px; 182 | } 183 | #status-indicator { 184 | width: 10px; 185 | height: 10px; 186 | background-color: transparent; 187 | border-radius: 50%; 188 | display: inline-block; 189 | margin-right: 5px; 190 | margin-left: 15px; 191 | } 192 | #timer img{ 193 | width: 15px; 194 | margin-right: 5px; 195 | } 196 | 197 | .bar-button .tool-tip-text { 198 | visibility: hidden; 199 | text-align: center; 200 | font-size: 14px; 201 | border-radius: 6px; 202 | position: absolute; 203 | left: 45px; 204 | vertical-align: middle; 205 | padding: 10px; 206 | } 207 | .bar-button:hover .tool-tip-text { 208 | visibility: visible; 209 | } 210 | .main-button-area{ 211 | width: 700px; 212 | margin: 0 25px; 213 | } 214 | .main-button{ 215 | margin-left: 10px; 216 | margin-right: 10px; 217 | margin-bottom: 40px; 218 | border: none; 219 | width: 150px; 220 | height: 55px; 221 | border-radius: 12px; 222 | font-size: 15px; 223 | cursor: pointer; 224 | vertical-align: middle; 225 | } 226 | .main-button:hover{ 227 | transition: 130ms; 228 | } 229 | 230 | .bottom-area{ 231 | border-radius: 20px; 232 | position: fixed; 233 | z-index: 999; 234 | left: 30px; 235 | right: 30px; 236 | bottom: 0; 237 | } 238 | 239 | #left-bar{ 240 | display: inline-block; 241 | padding-top: 10px; 242 | outline: none; 243 | width: var(--side-bar-width); 244 | height: calc(var(--console-height) + 30px); 245 | bottom: var(--bottom-bar-height); 246 | text-align: center; 247 | border-top-left-radius: 20px; 248 | } 249 | #log{ 250 | border: none; 251 | resize: none; 252 | height: var(--console-height); 253 | padding: 20px 20px 20px 20px; 254 | outline: none; 255 | color: #54ad6c; 256 | background-color: #151728; 257 | font-family: "SourceCodePro", "Heiti SC", serif; 258 | font-size: 14px; 259 | border-top-right-radius: 20px; 260 | vertical-align: bottom; 261 | width: calc(100% - 86px); 262 | } 263 | #bottom-bar{ 264 | display: flex; 265 | align-items: center; 266 | height: var(--bottom-bar-height); 267 | box-sizing: border-box; 268 | margin-top: 0; 269 | padding-top: 0; 270 | } 271 | #check-update{ 272 | font-size: 14px; 273 | cursor: pointer; 274 | border: none; 275 | border-radius: 6px; 276 | padding-top: 5px; 277 | padding-bottom: 5px; 278 | } 279 | .windows-control button{ 280 | background-color: transparent; 281 | border: none; 282 | width: 45px; 283 | height: 40px; 284 | -webkit-app-region: none; 285 | } 286 | .windows-control button img{ 287 | width: 50%; 288 | vertical-align: middle; 289 | } 290 | #app-title-icon{ 291 | width: 28px; 292 | height: 28px; 293 | margin-right: 8px; 294 | vertical-align: middle; 295 | } 296 | 297 | @media (prefers-color-scheme: light) { 298 | body { 299 | background-color: #f7f8fa; 300 | } 301 | 302 | #title-bar { 303 | background-color: #f7f8fa; 304 | box-shadow: 0 6px 12px rgb(0 0 0 / 10%); 305 | } 306 | 307 | .bar-button:hover { 308 | background-color: #f7f8fa; 309 | } 310 | 311 | .selection { 312 | background-color: #4168cf; 313 | } 314 | 315 | .selection .selection-value { 316 | color: white; 317 | } 318 | 319 | .selection:hover{ 320 | background-color: #3c5eb3; 321 | } 322 | 323 | .selection-value::placeholder { 324 | color: white; 325 | } 326 | 327 | .down-arrow { 328 | border-color: white; 329 | } 330 | 331 | .dropdown-menus { 332 | border: 1px solid rgba(0, 0, 0, .15); 333 | -webkit-box-shadow: 0 6px 12px rgb(0 0 0 / 18%); 334 | box-shadow: 0 6px 12px rgb(0 0 0 / 18%); 335 | background-color: white; 336 | } 337 | 338 | .menu-item:hover { 339 | background: #D2DEF9; 340 | } 341 | 342 | .bar-button:hover { 343 | background-color: #dddfe3; 344 | } 345 | 346 | .bar-button .tool-tip-text { 347 | background-color: #27282d; 348 | border: 1px solid #fff; 349 | color: #fff; 350 | } 351 | 352 | .main-button { 353 | background-color: #f4f5fc; 354 | color: #333434; 355 | box-shadow: 0 6px 12px rgb(65 104 207 / 20%); 356 | } 357 | 358 | .main-button:hover { 359 | background-color: #4168cf; 360 | color: white; 361 | } 362 | 363 | .bottom-area { 364 | box-shadow: 0 6px 12px rgb(0 0 0 / 50%); 365 | background-color: #151728; 366 | } 367 | 368 | #left-bar { 369 | background-color: #f7f8fa; 370 | border-top: 1px solid #ebecf0; 371 | border-left: 1px solid #ebecf0; 372 | } 373 | 374 | #bottom-bar { 375 | background-color: #f7f8fa; 376 | border-top: 1px solid #ebecf0; 377 | border-left: 1px solid #ebecf0; 378 | border-right: 1px solid #ebecf0; 379 | } 380 | 381 | #check-update { 382 | color: #333434; 383 | background-color: #dddfe3; 384 | } 385 | 386 | #close-app:hover { 387 | background-color: #eb7171; 388 | } 389 | 390 | #minimize-app:hover { 391 | background-color: #ebecf0; 392 | } 393 | } 394 | 395 | @media (prefers-color-scheme: dark) { 396 | body { 397 | background-color: #1b202b; 398 | color: #cbcdce; 399 | } 400 | 401 | #title-bar { 402 | background-color: #1b202b; 403 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); 404 | } 405 | 406 | .selection { 407 | background-color: #4369c7; 408 | } 409 | 410 | .selection .selection-value { 411 | color: white; 412 | } 413 | 414 | .selection:hover{ 415 | background-color: #3c5eb3; 416 | } 417 | 418 | .selection-value::placeholder { 419 | color: white; 420 | } 421 | 422 | .down-arrow { 423 | border-color: #cbcdce; 424 | } 425 | 426 | .dropdown-menus { 427 | border: 1px solid rgba(255, 255, 255, 0.1); 428 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); 429 | background-color: #2b2d30; 430 | } 431 | 432 | .menu-item:hover { 433 | background: #32426b; 434 | } 435 | 436 | .bar-button:hover { 437 | background-color: #4e5055; 438 | } 439 | 440 | .bar-button .tool-tip-text { 441 | background-color: #293b40; 442 | border: 1px solid #1e1f22; 443 | color: #cbcdce; 444 | } 445 | 446 | .main-button { 447 | background-color: #384151; 448 | color: #cbcdce; 449 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); 450 | } 451 | 452 | .main-button:hover { 453 | background-color: #4c5463; 454 | color: #cbcdce; 455 | } 456 | 457 | .bottom-area { 458 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3); 459 | background-color: #151728; 460 | } 461 | 462 | #left-bar { 463 | background-color: #2b2d30; 464 | border-top: 1px solid #1e1f22; 465 | border-left: 1px solid #1e1f22; 466 | } 467 | 468 | #bottom-bar { 469 | background-color: #2b2d30; 470 | border-top: 1px solid #1e1f22; 471 | border-left: 1px solid #1e1f22; 472 | border-right: 1px solid #1e1f22; 473 | } 474 | 475 | #check-update { 476 | color: #cbcdce; 477 | background-color: #1e355f; 478 | } 479 | 480 | #close-app:hover { 481 | background-color: #eb7171; 482 | } 483 | 484 | #minimize-app:hover { 485 | background-color: #b3b3b3; 486 | } 487 | 488 | img{ 489 | filter: invert(80%); 490 | } 491 | #minimize-app:hover img{ 492 | filter: invert(0); 493 | } 494 | #close-app:hover img{ 495 | filter: invert(0); 496 | } 497 | #app-title-icon{ 498 | filter: invert(0); 499 | } 500 | } 501 | 502 | -------------------------------------------------------------------------------- /src/renderer/css/scrollBar.css: -------------------------------------------------------------------------------- 1 | /* 正常模式下的样式 */ 2 | ::-webkit-scrollbar { 3 | width: 8px; 4 | height: 10px; 5 | background-color: rgba(245, 245, 245, 0.3); 6 | border-radius: 5px; 7 | } 8 | 9 | ::-webkit-scrollbar-button { 10 | background-color: #e5e5e5; 11 | border-radius: 5px; 12 | } 13 | 14 | ::-webkit-scrollbar-thumb { 15 | background-color: #c2c2c2; 16 | border-radius: 5px; 17 | min-height: 30px; 18 | min-width: 30px; 19 | } 20 | 21 | ::-webkit-scrollbar-thumb:hover { 22 | background-color: #a7a7a7; 23 | } 24 | 25 | ::-webkit-scrollbar-track { 26 | background-color: rgba(245, 245, 245, 0.3); 27 | border-radius: 5px; 28 | } 29 | 30 | ::-webkit-scrollbar-button:start:decrement, 31 | ::-webkit-scrollbar-button:end:increment { 32 | display: none; 33 | } 34 | 35 | /* 深色模式下的样式 */ 36 | @media (prefers-color-scheme: dark) { 37 | ::-webkit-scrollbar { 38 | background-color: #333333; 39 | } 40 | 41 | ::-webkit-scrollbar-button { 42 | background-color: #444444; 43 | } 44 | 45 | ::-webkit-scrollbar-thumb { 46 | background-color: #444547; 47 | } 48 | 49 | ::-webkit-scrollbar-thumb:hover { 50 | background-color: #545457; 51 | } 52 | 53 | ::-webkit-scrollbar-track { 54 | background-color: #333333; 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/renderer/css/subWindow.css: -------------------------------------------------------------------------------- 1 | @font-face{ 2 | font-family: 'SourceCodePro'; 3 | src: url('../assets/font/SourceCodePro-Regular.ttf'); 4 | font-weight: normal; 5 | font-style: normal; 6 | } 7 | 8 | body{ 9 | user-select: none; 10 | text-align: center; 11 | margin-top: 20px; 12 | } 13 | 14 | .sub-title{ 15 | text-decoration: underline; 16 | font-size: 14px; 17 | font-family: "黑体", "Times New Roman", serif; 18 | margin-bottom: 10px; 19 | } 20 | 21 | .hr-edge-weak { 22 | border: 0; 23 | padding-top: 1px; 24 | margin-top: 20px; 25 | margin-bottom: 10px; 26 | } 27 | 28 | .title{ 29 | font-size: 14px; 30 | font-family: "黑体", "Times New Roman", serif; 31 | margin-top: 20px; 32 | } 33 | 34 | .final-button button{ 35 | border: none; 36 | border-radius: 10px; 37 | width: 80px; 38 | height: 30px; 39 | margin-top: 20px; 40 | cursor: pointer; 41 | margin-right: 15px; 42 | margin-left: 15px; 43 | } 44 | .final-button button:hover{ 45 | transition: 130ms; 46 | } 47 | 48 | input[type="text"]{ 49 | outline-style: none ; 50 | border-radius: 6px; 51 | padding: 6px; 52 | width: 200px; 53 | font-size: 14px; 54 | font-family: "SourceCodePro", serif; 55 | margin-top: 20px; 56 | } 57 | input[type="text"]:focus{ 58 | outline: 0; 59 | } 60 | 61 | .radio-group{ 62 | margin-top: 20px; 63 | display:inline-block; 64 | width: 200px; 65 | text-align: center; 66 | margin-right: 10px; 67 | } 68 | 69 | input[type="radio"]{ 70 | display: none; 71 | } 72 | input[type="radio"] + .radio-wrapper{ 73 | display: inline-block; 74 | line-height: 30px; 75 | height: 30px; 76 | width: 40%; 77 | border-radius: 40px; 78 | cursor: pointer; 79 | margin-left: 4.5%; 80 | margin-right: 4.5%; 81 | } 82 | input[type="radio"]:checked + .radio-wrapper{ 83 | transition: 130ms; 84 | } 85 | input[type="radio"]:disabled + .radio-wrapper{ 86 | transition: 0ms; 87 | cursor: not-allowed; 88 | box-shadow: none; 89 | } 90 | 91 | label:not(.radio-wrapper):not(.checkbox-wrapper){ 92 | display: inline-block; 93 | padding-right: 8px; 94 | width:80px; 95 | vertical-align: center; 96 | direction: rtl; 97 | white-space: nowrap; 98 | } 99 | #dict-file{ 100 | display: inline-block; 101 | width: 200px; 102 | text-align: right; 103 | } 104 | button{ 105 | outline: 0; 106 | border: none; 107 | border-radius: 10px; 108 | width: 80px; 109 | height: 40px; 110 | cursor: pointer; 111 | margin-right: 10px; 112 | margin-left: 15px; 113 | vertical-align: middle; 114 | } 115 | button:hover{ 116 | transition: 80ms; 117 | } 118 | input{ 119 | outline: 0; 120 | } 121 | input:disabled{ 122 | box-shadow: none; 123 | cursor: not-allowed; 124 | } 125 | 126 | @media (prefers-color-scheme: light) { 127 | .hr-edge-weak { 128 | background: linear-gradient(to right, transparent, #d0d0d5, transparent); 129 | } 130 | 131 | .final-button button { 132 | background-color: #f4f5fc; 133 | color: black; 134 | box-shadow: 0 6px 12px rgb(65 104 207 / 20%); 135 | } 136 | 137 | .final-button button:hover { 138 | background-color: #4168cf; 139 | color: white; 140 | } 141 | 142 | input[type="text"] { 143 | border: 1px solid #ccc; 144 | } 145 | 146 | input[type="text"]:focus { 147 | border-color: #66afe9; 148 | box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6) 149 | } 150 | 151 | input[type="radio"] + .radio-wrapper { 152 | background-color: white; 153 | color: black; 154 | box-shadow: 0 6px 12px rgb(65 104 207 / 20%); 155 | } 156 | 157 | input[type="radio"]:checked + .radio-wrapper { 158 | background-color: #4168cf; 159 | color: white; 160 | } 161 | 162 | input[type="radio"]:disabled + .radio-wrapper { 163 | color: #ccc; 164 | background-color: #e0e0e0; 165 | } 166 | 167 | button { 168 | background-color: #f4f5fc; 169 | color: black; 170 | box-shadow: 0 6px 12px rgb(65 104 207 / 20%); 171 | } 172 | 173 | button:hover { 174 | background-color: #4168cf; 175 | color: white; 176 | } 177 | 178 | input:disabled { 179 | background-color: #e0e0e0; 180 | color: #a0a0a0; 181 | } 182 | } 183 | 184 | @media (prefers-color-scheme: dark) { 185 | body { 186 | background-color: #1b202b; 187 | color: #cbcdce; 188 | } 189 | 190 | .hr-edge-weak { 191 | background: linear-gradient(to right, transparent, #d0d0d5, transparent); 192 | } 193 | 194 | .final-button button { 195 | background-color: #384151; 196 | color: #cbcdce; 197 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); 198 | } 199 | 200 | .final-button button:hover { 201 | background-color: #4c5463; 202 | color: #cbcdce; 203 | } 204 | 205 | input[type="text"] { 206 | border: 1px solid #000000; 207 | background-color: #3f3f46; 208 | color: #cbcdce; 209 | } 210 | 211 | input[type="text"]:focus { 212 | border-color: #000000; 213 | box-shadow: inset 0 1px 1px #222225, 0 0 8px rgba(67, 68, 82, 0.93) 214 | } 215 | 216 | input[type="radio"] + .radio-wrapper { 217 | background-color: #2d333f; 218 | color: #cbcdce; 219 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); 220 | } 221 | 222 | input[type="radio"]:checked + .radio-wrapper { 223 | background-color: #1f3062; 224 | color: white; 225 | } 226 | 227 | input[type="radio"]:disabled + .radio-wrapper { 228 | color: #ccc; 229 | background-color: #1a1a1a; 230 | } 231 | 232 | button { 233 | background-color: #384151; 234 | color: #cbcdce; 235 | box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2); 236 | } 237 | 238 | button:hover { 239 | background-color: #4c5463; 240 | color: #cbcdce; 241 | } 242 | 243 | input:disabled { 244 | background-color: #1a1a1a; 245 | color: #a0a0a0; 246 | } 247 | } -------------------------------------------------------------------------------- /src/renderer/html/about.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ html_about }} 6 | 7 | 8 | 9 | 10 |
11 |
12 | icon 13 |
14 |
15 |
16 |

{{ app_name }}

17 |
18 | {{ html_version_code }} 19 | 20 | 21 |
22 |
23 | {{ html_builder }} 24 | 25 |
26 |
27 | {{ html_open_source_repository }} 28 | https://github.com/GSWXXN/NFCToolsGUI 29 |
30 |
31 | {{ html_license: }} 32 | AGPL-3.0 33 |
34 | 50 |
51 |
52 |
53 | 54 | 55 | 73 | 74 | -------------------------------------------------------------------------------- /src/renderer/html/dictTest.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ html_please_input_known_keys }} 6 | 7 | 8 | 9 | 10 |
{{ html_input_test_info }}
11 |
12 | 13 | 14 |
15 | {{ html_build_in_dictionary }} 16 | 17 |
18 |
19 | 20 | 21 |
22 | 23 |
24 | 25 | 26 | 27 | 28 |
29 | 30 |
31 | 32 | 33 | 34 |
35 |
36 |
37 | 38 | 43 |
44 | 45 | 46 | 47 | 48 | 63 | -------------------------------------------------------------------------------- /src/renderer/html/dumpComparator.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ html_dump_comparator }} 6 | 7 | 8 | 9 | 10 |
11 | {{ html_dump }} (A): 12 | 13 |
14 | {{ html_dump }} (B): 15 | 16 |
17 |
18 | 19 |
20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/renderer/html/dumpEditor.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ html_dump_editor }} 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |
15 |
16 | drag 17 | {{ html_current_file }}: 18 | 19 |
20 |
21 | 22 | 23 |
24 |
25 | 26 |
27 | {{ html_caption }}: 28 | {{ html_uid_manufacture_info }} 29 | | 30 | {{ html_key_a }} 31 | | 32 | {{ html_key_b }} 33 | | 34 | {{ html_access_control }} 35 | 36 |
37 |
38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /src/renderer/html/dumpHistory.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ html_dump_history }} 6 | 7 | 8 | 9 | 10 |
    11 | 12 |
    13 | 14 | 15 | 16 |
    17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /src/renderer/html/hardNested.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
    14 | 15 |
    {{ html_known_info }}
    16 | 17 | 18 |
    19 | 20 | 21 |
    22 | 23 |
    24 | 25 | 26 | 27 | 28 |
    29 | 30 | 31 |
    32 | 33 |
    {{ html_target_sector_info }}
    34 | 35 | 36 | 37 |
    38 | 39 |
    40 | 41 | 42 | 43 | 44 |
    45 | 46 |


    47 | 48 | 49 | 50 | 51 |

    52 | 53 |
    54 | 55 | 65 | 66 |
    67 | 68 | 94 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /src/renderer/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
    10 |
    11 |
    12 |
    13 | 14 | 15 | 16 |
    17 | 20 |
    21 | 22 | 23 |
    24 | 27 | 36 | 37 | 38 | 39 |
    40 | 41 | 49 |
    50 | 51 |
    52 | icon 53 | {{ app_name }} 54 |
    55 |
    56 | 57 |
    58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 |
    67 | 68 |
    69 |
    70 | 74 | 78 | 82 | 86 |
    87 | 88 |
    89 |
    90 |
    91 | {{ indicator_free }} 92 |
    93 |
    94 | {{ html_timer }} 95 | {{ html_timer }} 96 | 97 |
    98 |
    99 | {{ html_current_version }} 100 | 101 | 102 |
    103 |
    104 |
    105 | 106 | 107 | 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /src/renderer/html/inputkeys.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
    {{ html_please_input_known_keys_split_by_comma }}
    10 | 11 |
    12 |
    13 | 14 | 15 |
    16 | 17 | 18 | -------------------------------------------------------------------------------- /src/renderer/html/settings.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Title 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
    16 | 17 |
    18 | 19 | 20 | -------------------------------------------------------------------------------- /src/renderer/js/dumpComparator.js: -------------------------------------------------------------------------------- 1 | let dumpA = [] 2 | let dumpB = [] 3 | 4 | window['electronAPI'].onUpdateDumpComparatorFile((event, data) => { 5 | window['electronAPI'].execAction('dump-comparator-choose-file', {type: 'A', path: data.A}) 6 | window['electronAPI'].execAction('dump-comparator-choose-file', {type: 'B', path: data.B}) 7 | }) 8 | 9 | $(document).on('mousedown', function(event) { 10 | if (event.target.tagName.toLowerCase() !== 'input' && window.getSelection().toString() !== '') { 11 | window.getSelection().removeAllRanges(); 12 | } 13 | }); 14 | 15 | $('#dump-A').click(() => {window['electronAPI'].execAction('dump-comparator-choose-file', {type: 'A'})}) 16 | $('#dump-B').click(() => {window['electronAPI'].execAction('dump-comparator-choose-file', {type: 'B'})}) 17 | 18 | window['electronAPI'].onOpenDumpFile((event, data) => { 19 | const pathArray = data.url.split(/[\/\\]/g) 20 | if (data.type === 'A') { 21 | dumpA = data.data 22 | $('#dump-A').text(pathArray[pathArray.length - 1]) 23 | } else if (data.type === 'B') { 24 | dumpB = data.data 25 | $('#dump-B').text(pathArray[pathArray.length - 1]) 26 | } 27 | 28 | if (dumpA.length > 0 && dumpB.length > 0) { showMarkedDump(dumpA, dumpB, 4, 32) } 29 | 30 | }) 31 | 32 | function markDifferentStrings(dumpA, dumpB, subArrLength, strLength) { 33 | const minLength = Math.min(dumpA.length, dumpB.length); 34 | const markedDumpA = []; 35 | const markedDumpB = []; 36 | 37 | for (let i = 0; i < minLength; i++) { 38 | const markedSubArrA = []; 39 | const markedSubArrB = []; 40 | 41 | for (let j = 0; j < subArrLength; j++) { 42 | let markedStrA = ""; 43 | let markedStrB = ""; 44 | let hasDifference = false; 45 | 46 | for (let k = 0; k < strLength; k++) { 47 | if (dumpA[i][j][k] !== dumpB[i][j][k]) { 48 | markedStrA += `${dumpA[i][j][k]}`; 49 | markedStrB += `${dumpB[i][j][k]}`; 50 | hasDifference = true; 51 | } else { 52 | markedStrA += dumpA[i][j][k]; 53 | markedStrB += dumpB[i][j][k]; 54 | } 55 | } 56 | 57 | markedSubArrA.push(hasDifference ? markedStrA : dumpA[i][j]); 58 | markedSubArrB.push(hasDifference ? markedStrB : dumpB[i][j]); 59 | } 60 | 61 | markedDumpA.push(markedSubArrA); 62 | markedDumpB.push(markedSubArrB); 63 | } 64 | 65 | if (dumpA.length > dumpB.length) { 66 | for (let i = minLength; i < dumpA.length; i++) { 67 | const markedSubArrA = []; 68 | 69 | for (let j = 0; j < subArrLength; j++) { 70 | markedSubArrA.push(`${dumpA[i][j]}`); 71 | } 72 | 73 | markedDumpA.push(markedSubArrA); 74 | markedDumpB.push(""); 75 | } 76 | } else if (dumpB.length > dumpA.length) { 77 | for (let i = minLength; i < dumpB.length; i++) { 78 | const markedSubArrB = []; 79 | 80 | for (let j = 0; j < subArrLength; j++) { 81 | markedSubArrB.push(`${dumpB[i][j]}`); 82 | } 83 | markedDumpA.push(""); 84 | markedDumpB.push(markedSubArrB); 85 | } 86 | } 87 | 88 | return [markedDumpA, markedDumpB]; 89 | } 90 | 91 | function showMarkedDump(dumpA, dumpB, subArrLength, strLength) { 92 | const [markedDumpA, markedDumpB] = markDifferentStrings(dumpA, dumpB, subArrLength, strLength); 93 | 94 | // 获取页面中的容器元素 95 | const container = $("#compare-container"); 96 | container.empty() 97 | 98 | // 遍历 dumpA 和 dumpB 的子数组,生成包含标记的字符串,将它们插入到页面上 99 | let sector = 0 100 | markedDumpA.forEach((subArrA, index) => { 101 | container.append($("
    ").html(`${i18n("html_sector")} ${sector++}`).addClass('sector-tag')) 102 | const subArrB = markedDumpB[index] 103 | const row = $("
    ") 104 | subArrA.forEach((strA, j) => { 105 | const strB = subArrB[j]; 106 | 107 | row.append($("
    ").html(`A: ${strA}`).addClass('dump-text')) 108 | row.append($("
    ").html(`B: ${strB}`).addClass('dump-text')) 109 | row.append($("
    ")) 110 | }); 111 | container.append(row) 112 | container.append("
    ") 113 | }); 114 | } 115 | -------------------------------------------------------------------------------- /src/renderer/js/dumpEditor.js: -------------------------------------------------------------------------------- 1 | let currentFilePath = null 2 | 3 | window['electronAPI'].onUpdateDumpEditorFile((event, data) => { 4 | window['electronAPI'].execAction('dump-editor-choose-file', data) 5 | }) 6 | 7 | $('#drag').on('dragstart', (e) => { 8 | e.preventDefault() 9 | if (currentFilePath) window['electronAPI'].startDrag(currentFilePath) 10 | }) 11 | 12 | // buttons 13 | $('#choose-file').click(() => {window['electronAPI'].execAction('dump-editor-choose-file')}) 14 | $('#save-file').click(() => { 15 | if (checkData(true)) { 16 | window['electronAPI'].execAction( 17 | 'dump-editor-save', 18 | { 19 | url: currentFilePath, 20 | hexData:$('.binary-input').map((i, el) => el.innerText).get().join('').replace(/\n/g, '') 21 | } 22 | ) 23 | } else { 24 | alert(i18n("html_data_format_wrong")) 25 | } 26 | }) 27 | $('#update-tag-color').click(() => { 28 | if (checkData()) { 29 | $('#binary-data-content').find('.binary-input').each((i, item) => { 30 | item.innerHTML = updateTagColor(item.innerText, !i) 31 | }) 32 | } else { 33 | alert(i18n("html_data_format_wrong")) 34 | } 35 | }) 36 | 37 | window['electronAPI'].onOpenDumpFile((event, data) => { 38 | let sector = 0; 39 | const container = $('#binary-data-content') 40 | container.empty() 41 | currentFilePath = data.url 42 | 43 | const pathArray = data.url.split(/[\/\\]/g) 44 | $('#current-file').text(pathArray[pathArray.length - 1]) 45 | 46 | data.data.forEach((item, i)=> { 47 | const label = $(`${i18n("html_sector")} ${sector++}`) 48 | const textarea = $(`
    ${updateTagColor(item, !i)}
    `) 49 | 50 | container.append($('
    ')) 51 | container.append(label) 52 | container.append(textarea) 53 | label.width(textarea.width()) 54 | }) 55 | }) 56 | 57 | window['electronAPI'].onSavedDumpFile(() => { 58 | alert(i18n("html_save_success")) 59 | }) 60 | 61 | function updateTagColor(data, isBlock0 = false) { 62 | const splitData = data.split("\n") 63 | if (isBlock0) {splitData[0] = `${splitData[0]}`} 64 | splitData[3] = `${splitData[3].substring(0, 12)}` + 65 | `${splitData[3].substring(12, 18)}` + 66 | `${splitData[3].substring(18, 20)}` + 67 | `${splitData[3].substring(20)}` 68 | return splitData.join("\n") 69 | } 70 | 71 | function checkData(isCheckContent = false) { 72 | let isDataValid = true 73 | 74 | const styles = { 75 | invalid: { 76 | 'border-color': '#e96666', 77 | 'box-shadow': 'inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(223,102,102,.6)' 78 | }, 79 | valid: { 80 | 'border-color': '#ccc', 81 | 'box-shadow': 'none' 82 | } 83 | } 84 | 85 | $('#binary-data-content').find('.binary-input').each((i, item) => { 86 | const splitData = item.innerText.split("\n"); 87 | const valid = splitData.length === 4 && splitData.every(data => data.length === 32 && (!isCheckContent || /^[0-9A-Fa-f]+$/.test(data))); 88 | $(item).css(valid ? styles.valid : styles.invalid); 89 | isDataValid = isDataValid && valid; 90 | }); 91 | return isDataValid 92 | } -------------------------------------------------------------------------------- /src/renderer/js/dumpHistory.js: -------------------------------------------------------------------------------- 1 | let isEditingFileName = false; 2 | 3 | const $compareDumpsButton = $('#compareDumpsButton') 4 | const $editDumpButton = $('#editDumpButton') 5 | 6 | window["electronAPI"].onCreateDumpHistoryWindow((_event, dumps) => { 7 | const $dumpsList = $('#dumpsList'); 8 | $dumpsList.empty(); 9 | 10 | dumps.forEach(dump => { 11 | const $fileName = $('').addClass('dump-item-filename').text(dump); 12 | const $dumpItem = $('
    ').addClass('dump-item').append($fileName).click(function() { 13 | if (!isEditingFileName) { 14 | $(this).parent().toggleClass('selected') 15 | updateBottomButtonStatus(); 16 | } 17 | }); 18 | 19 | // 删除按钮 20 | const delIMG = $('').attr('src', '../assets/icon/svg/del.svg').addClass("dump-action-button-img") 21 | const $deleteButton = $('