├── .gitattributes
├── README.md
├── desql.py
├── LICENSE
└── android_analyzer.py
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RawAnalyzer
2 | 安卓手机数据电子取证分析工具
3 |
4 | ## 如何使用?
5 |
6 | 环境:Kali Linux
7 |
8 | 安装依赖:
9 |
10 | ```
11 | apt install python python-pip python3 python3-pip
12 | apt install sqlitebrowser libsqlite3-dev libsqlcipher-dev libsqlcipher0 adb
13 | apt install python3-pyqt5 python3-pyqt5.qtwebkit
14 | pip install pysqlcipher
15 | ```
16 |
17 | 运行工具:
18 |
19 | `python3 android_analyzer.py`
20 |
21 | ## 许可协议
22 | RawAnalyzer 采用 GPLv3 许可协议。查看 LICENSE 文件了解更多。
--------------------------------------------------------------------------------
/desql.py:
--------------------------------------------------------------------------------
1 | import sys
2 | import os
3 | from pysqlcipher import dbapi2 as sqlite
4 | import traceback
5 |
6 | def main():
7 | argv = sys.argv
8 | if len(argv) != 4:
9 | print 'usage: python desql.py encrypted_file password decrypted_file'
10 | return
11 | encrypted_file = argv[1]
12 | password = argv[2]
13 | decrypted_file = argv[3]
14 | conn = sqlite.connect(encrypted_file)
15 | c = conn.cursor()
16 | try:
17 | c.execute("PRAGMA key = '" + password + "';")
18 | c.execute("PRAGMA cipher_use_hmac = OFF;")
19 | c.execute("PRAGMA cipher_page_size = 1024;")
20 | c.execute("PRAGMA kdf_iter = 4000;")
21 | c.execute("ATTACH DATABASE '" + decrypted_file + "' AS wechatdecrypted KEY '';")
22 | c.execute( "SELECT sqlcipher_export( 'wechatdecrypted' );" )
23 | c.execute( "DETACH DATABASE wechatdecrypted;" )
24 | c.close()
25 | print 'Decrypt Success!'
26 | except:
27 | c.close()
28 | os.remove(decrypted_file)
29 | print 'Decrypt Error!'
30 | print 'Exception:'
31 | print traceback.format_exc()
32 |
33 | if __name__ == '__main__':
34 | main()
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 3, 29 June 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 General Public License is a free, copyleft license for
11 | software and other kinds of works.
12 |
13 | The licenses for most software and other practical works are designed
14 | to take away your freedom to share and change the works. By contrast,
15 | the GNU General Public License is intended to guarantee your freedom to
16 | share and change all versions of a program--to make sure it remains free
17 | software for all its users. We, the Free Software Foundation, use the
18 | GNU General Public License for most of our software; it applies also to
19 | any other work released this way by its authors. You can apply it to
20 | your programs, too.
21 |
22 | When we speak of free software, we are referring to freedom, not
23 | price. Our General Public Licenses are designed to make sure that you
24 | have the freedom to distribute copies of free software (and charge for
25 | them if you wish), that you receive source code or can get it if you
26 | want it, that you can change the software or use pieces of it in new
27 | free programs, and that you know you can do these things.
28 |
29 | To protect your rights, we need to prevent others from denying you
30 | these rights or asking you to surrender the rights. Therefore, you have
31 | certain responsibilities if you distribute copies of the software, or if
32 | you modify it: responsibilities to respect the freedom of others.
33 |
34 | For example, if you distribute copies of such a program, whether
35 | gratis or for a fee, you must pass on to the recipients the same
36 | freedoms that you received. You must make sure that they, too, receive
37 | or can get the source code. And you must show them these terms so they
38 | know their rights.
39 |
40 | Developers that use the GNU GPL protect your rights with two steps:
41 | (1) assert copyright on the software, and (2) offer you this License
42 | giving you legal permission to copy, distribute and/or modify it.
43 |
44 | For the developers' and authors' protection, the GPL clearly explains
45 | that there is no warranty for this free software. For both users' and
46 | authors' sake, the GPL requires that modified versions be marked as
47 | changed, so that their problems will not be attributed erroneously to
48 | authors of previous versions.
49 |
50 | Some devices are designed to deny users access to install or run
51 | modified versions of the software inside them, although the manufacturer
52 | can do so. This is fundamentally incompatible with the aim of
53 | protecting users' freedom to change the software. The systematic
54 | pattern of such abuse occurs in the area of products for individuals to
55 | use, which is precisely where it is most unacceptable. Therefore, we
56 | have designed this version of the GPL to prohibit the practice for those
57 | products. If such problems arise substantially in other domains, we
58 | stand ready to extend this provision to those domains in future versions
59 | of the GPL, as needed to protect the freedom of users.
60 |
61 | Finally, every program is threatened constantly by software patents.
62 | States should not allow patents to restrict development and use of
63 | software on general-purpose computers, but in those that do, we wish to
64 | avoid the special danger that patents applied to a free program could
65 | make it effectively proprietary. To prevent this, the GPL assures that
66 | patents cannot be used to render the program non-free.
67 |
68 | The precise terms and conditions for copying, distribution and
69 | modification follow.
70 |
71 | TERMS AND CONDITIONS
72 |
73 | 0. Definitions.
74 |
75 | "This License" refers to version 3 of the GNU General Public License.
76 |
77 | "Copyright" also means copyright-like laws that apply to other kinds of
78 | works, such as semiconductor masks.
79 |
80 | "The Program" refers to any copyrightable work licensed under this
81 | License. Each licensee is addressed as "you". "Licensees" and
82 | "recipients" may be individuals or organizations.
83 |
84 | To "modify" a work means to copy from or adapt all or part of the work
85 | in a fashion requiring copyright permission, other than the making of an
86 | exact copy. The resulting work is called a "modified version" of the
87 | earlier work or a work "based on" the earlier work.
88 |
89 | A "covered work" means either the unmodified Program or a work based
90 | on the Program.
91 |
92 | To "propagate" a work means to do anything with it that, without
93 | permission, would make you directly or secondarily liable for
94 | infringement under applicable copyright law, except executing it on a
95 | computer or modifying a private copy. Propagation includes copying,
96 | distribution (with or without modification), making available to the
97 | public, and in some countries other activities as well.
98 |
99 | To "convey" a work means any kind of propagation that enables other
100 | parties to make or receive copies. Mere interaction with a user through
101 | a computer network, with no transfer of a copy, is not conveying.
102 |
103 | An interactive user interface displays "Appropriate Legal Notices"
104 | to the extent that it includes a convenient and prominently visible
105 | feature that (1) displays an appropriate copyright notice, and (2)
106 | tells the user that there is no warranty for the work (except to the
107 | extent that warranties are provided), that licensees may convey the
108 | work under this License, and how to view a copy of this License. If
109 | the interface presents a list of user commands or options, such as a
110 | menu, a prominent item in the list meets this criterion.
111 |
112 | 1. Source Code.
113 |
114 | The "source code" for a work means the preferred form of the work
115 | for making modifications to it. "Object code" means any non-source
116 | form of a work.
117 |
118 | A "Standard Interface" means an interface that either is an official
119 | standard defined by a recognized standards body, or, in the case of
120 | interfaces specified for a particular programming language, one that
121 | is widely used among developers working in that language.
122 |
123 | The "System Libraries" of an executable work include anything, other
124 | than the work as a whole, that (a) is included in the normal form of
125 | packaging a Major Component, but which is not part of that Major
126 | Component, and (b) serves only to enable use of the work with that
127 | Major Component, or to implement a Standard Interface for which an
128 | implementation is available to the public in source code form. A
129 | "Major Component", in this context, means a major essential component
130 | (kernel, window system, and so on) of the specific operating system
131 | (if any) on which the executable work runs, or a compiler used to
132 | produce the work, or an object code interpreter used to run it.
133 |
134 | The "Corresponding Source" for a work in object code form means all
135 | the source code needed to generate, install, and (for an executable
136 | work) run the object code and to modify the work, including scripts to
137 | control those activities. However, it does not include the work's
138 | System Libraries, or general-purpose tools or generally available free
139 | programs which are used unmodified in performing those activities but
140 | which are not part of the work. For example, Corresponding Source
141 | includes interface definition files associated with source files for
142 | the work, and the source code for shared libraries and dynamically
143 | linked subprograms that the work is specifically designed to require,
144 | such as by intimate data communication or control flow between those
145 | subprograms and other parts of the work.
146 |
147 | The Corresponding Source need not include anything that users
148 | can regenerate automatically from other parts of the Corresponding
149 | Source.
150 |
151 | The Corresponding Source for a work in source code form is that
152 | same work.
153 |
154 | 2. Basic Permissions.
155 |
156 | All rights granted under this License are granted for the term of
157 | copyright on the Program, and are irrevocable provided the stated
158 | conditions are met. This License explicitly affirms your unlimited
159 | permission to run the unmodified Program. The output from running a
160 | covered work is covered by this License only if the output, given its
161 | content, constitutes a covered work. This License acknowledges your
162 | rights of fair use or other equivalent, as provided by copyright law.
163 |
164 | You may make, run and propagate covered works that you do not
165 | convey, without conditions so long as your license otherwise remains
166 | in force. You may convey covered works to others for the sole purpose
167 | of having them make modifications exclusively for you, or provide you
168 | with facilities for running those works, provided that you comply with
169 | the terms of this License in conveying all material for which you do
170 | not control copyright. Those thus making or running the covered works
171 | for you must do so exclusively on your behalf, under your direction
172 | and control, on terms that prohibit them from making any copies of
173 | your copyrighted material outside their relationship with you.
174 |
175 | Conveying under any other circumstances is permitted solely under
176 | the conditions stated below. Sublicensing is not allowed; section 10
177 | makes it unnecessary.
178 |
179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180 |
181 | No covered work shall be deemed part of an effective technological
182 | measure under any applicable law fulfilling obligations under article
183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184 | similar laws prohibiting or restricting circumvention of such
185 | measures.
186 |
187 | When you convey a covered work, you waive any legal power to forbid
188 | circumvention of technological measures to the extent such circumvention
189 | is effected by exercising rights under this License with respect to
190 | the covered work, and you disclaim any intention to limit operation or
191 | modification of the work as a means of enforcing, against the work's
192 | users, your or third parties' legal rights to forbid circumvention of
193 | technological measures.
194 |
195 | 4. Conveying Verbatim Copies.
196 |
197 | You may convey verbatim copies of the Program's source code as you
198 | receive it, in any medium, provided that you conspicuously and
199 | appropriately publish on each copy an appropriate copyright notice;
200 | keep intact all notices stating that this License and any
201 | non-permissive terms added in accord with section 7 apply to the code;
202 | keep intact all notices of the absence of any warranty; and give all
203 | recipients a copy of this License along with the Program.
204 |
205 | You may charge any price or no price for each copy that you convey,
206 | and you may offer support or warranty protection for a fee.
207 |
208 | 5. Conveying Modified Source Versions.
209 |
210 | You may convey a work based on the Program, or the modifications to
211 | produce it from the Program, in the form of source code under the
212 | terms of section 4, provided that you also meet all of these conditions:
213 |
214 | a) The work must carry prominent notices stating that you modified
215 | it, and giving a relevant date.
216 |
217 | b) The work must carry prominent notices stating that it is
218 | released under this License and any conditions added under section
219 | 7. This requirement modifies the requirement in section 4 to
220 | "keep intact all notices".
221 |
222 | c) You must license the entire work, as a whole, under this
223 | License to anyone who comes into possession of a copy. This
224 | License will therefore apply, along with any applicable section 7
225 | additional terms, to the whole of the work, and all its parts,
226 | regardless of how they are packaged. This License gives no
227 | permission to license the work in any other way, but it does not
228 | invalidate such permission if you have separately received it.
229 |
230 | d) If the work has interactive user interfaces, each must display
231 | Appropriate Legal Notices; however, if the Program has interactive
232 | interfaces that do not display Appropriate Legal Notices, your
233 | work need not make them do so.
234 |
235 | A compilation of a covered work with other separate and independent
236 | works, which are not by their nature extensions of the covered work,
237 | and which are not combined with it such as to form a larger program,
238 | in or on a volume of a storage or distribution medium, is called an
239 | "aggregate" if the compilation and its resulting copyright are not
240 | used to limit the access or legal rights of the compilation's users
241 | beyond what the individual works permit. Inclusion of a covered work
242 | in an aggregate does not cause this License to apply to the other
243 | parts of the aggregate.
244 |
245 | 6. Conveying Non-Source Forms.
246 |
247 | You may convey a covered work in object code form under the terms
248 | of sections 4 and 5, provided that you also convey the
249 | machine-readable Corresponding Source under the terms of this License,
250 | in one of these ways:
251 |
252 | a) Convey the object code in, or embodied in, a physical product
253 | (including a physical distribution medium), accompanied by the
254 | Corresponding Source fixed on a durable physical medium
255 | customarily used for software interchange.
256 |
257 | b) Convey the object code in, or embodied in, a physical product
258 | (including a physical distribution medium), accompanied by a
259 | written offer, valid for at least three years and valid for as
260 | long as you offer spare parts or customer support for that product
261 | model, to give anyone who possesses the object code either (1) a
262 | copy of the Corresponding Source for all the software in the
263 | product that is covered by this License, on a durable physical
264 | medium customarily used for software interchange, for a price no
265 | more than your reasonable cost of physically performing this
266 | conveying of source, or (2) access to copy the
267 | Corresponding Source from a network server at no charge.
268 |
269 | c) Convey individual copies of the object code with a copy of the
270 | written offer to provide the Corresponding Source. This
271 | alternative is allowed only occasionally and noncommercially, and
272 | only if you received the object code with such an offer, in accord
273 | with subsection 6b.
274 |
275 | d) Convey the object code by offering access from a designated
276 | place (gratis or for a charge), and offer equivalent access to the
277 | Corresponding Source in the same way through the same place at no
278 | further charge. You need not require recipients to copy the
279 | Corresponding Source along with the object code. If the place to
280 | copy the object code is a network server, the Corresponding Source
281 | may be on a different server (operated by you or a third party)
282 | that supports equivalent copying facilities, provided you maintain
283 | clear directions next to the object code saying where to find the
284 | Corresponding Source. Regardless of what server hosts the
285 | Corresponding Source, you remain obligated to ensure that it is
286 | available for as long as needed to satisfy these requirements.
287 |
288 | e) Convey the object code using peer-to-peer transmission, provided
289 | you inform other peers where the object code and Corresponding
290 | Source of the work are being offered to the general public at no
291 | charge under subsection 6d.
292 |
293 | A separable portion of the object code, whose source code is excluded
294 | from the Corresponding Source as a System Library, need not be
295 | included in conveying the object code work.
296 |
297 | A "User Product" is either (1) a "consumer product", which means any
298 | tangible personal property which is normally used for personal, family,
299 | or household purposes, or (2) anything designed or sold for incorporation
300 | into a dwelling. In determining whether a product is a consumer product,
301 | doubtful cases shall be resolved in favor of coverage. For a particular
302 | product received by a particular user, "normally used" refers to a
303 | typical or common use of that class of product, regardless of the status
304 | of the particular user or of the way in which the particular user
305 | actually uses, or expects or is expected to use, the product. A product
306 | is a consumer product regardless of whether the product has substantial
307 | commercial, industrial or non-consumer uses, unless such uses represent
308 | the only significant mode of use of the product.
309 |
310 | "Installation Information" for a User Product means any methods,
311 | procedures, authorization keys, or other information required to install
312 | and execute modified versions of a covered work in that User Product from
313 | a modified version of its Corresponding Source. The information must
314 | suffice to ensure that the continued functioning of the modified object
315 | code is in no case prevented or interfered with solely because
316 | modification has been made.
317 |
318 | If you convey an object code work under this section in, or with, or
319 | specifically for use in, a User Product, and the conveying occurs as
320 | part of a transaction in which the right of possession and use of the
321 | User Product is transferred to the recipient in perpetuity or for a
322 | fixed term (regardless of how the transaction is characterized), the
323 | Corresponding Source conveyed under this section must be accompanied
324 | by the Installation Information. But this requirement does not apply
325 | if neither you nor any third party retains the ability to install
326 | modified object code on the User Product (for example, the work has
327 | been installed in ROM).
328 |
329 | The requirement to provide Installation Information does not include a
330 | requirement to continue to provide support service, warranty, or updates
331 | for a work that has been modified or installed by the recipient, or for
332 | the User Product in which it has been modified or installed. Access to a
333 | network may be denied when the modification itself materially and
334 | adversely affects the operation of the network or violates the rules and
335 | protocols for communication across the network.
336 |
337 | Corresponding Source conveyed, and Installation Information provided,
338 | in accord with this section must be in a format that is publicly
339 | documented (and with an implementation available to the public in
340 | source code form), and must require no special password or key for
341 | unpacking, reading or copying.
342 |
343 | 7. Additional Terms.
344 |
345 | "Additional permissions" are terms that supplement the terms of this
346 | License by making exceptions from one or more of its conditions.
347 | Additional permissions that are applicable to the entire Program shall
348 | be treated as though they were included in this License, to the extent
349 | that they are valid under applicable law. If additional permissions
350 | apply only to part of the Program, that part may be used separately
351 | under those permissions, but the entire Program remains governed by
352 | this License without regard to the additional permissions.
353 |
354 | When you convey a copy of a covered work, you may at your option
355 | remove any additional permissions from that copy, or from any part of
356 | it. (Additional permissions may be written to require their own
357 | removal in certain cases when you modify the work.) You may place
358 | additional permissions on material, added by you to a covered work,
359 | for which you have or can give appropriate copyright permission.
360 |
361 | Notwithstanding any other provision of this License, for material you
362 | add to a covered work, you may (if authorized by the copyright holders of
363 | that material) supplement the terms of this License with terms:
364 |
365 | a) Disclaiming warranty or limiting liability differently from the
366 | terms of sections 15 and 16 of this License; or
367 |
368 | b) Requiring preservation of specified reasonable legal notices or
369 | author attributions in that material or in the Appropriate Legal
370 | Notices displayed by works containing it; or
371 |
372 | c) Prohibiting misrepresentation of the origin of that material, or
373 | requiring that modified versions of such material be marked in
374 | reasonable ways as different from the original version; or
375 |
376 | d) Limiting the use for publicity purposes of names of licensors or
377 | authors of the material; or
378 |
379 | e) Declining to grant rights under trademark law for use of some
380 | trade names, trademarks, or service marks; or
381 |
382 | f) Requiring indemnification of licensors and authors of that
383 | material by anyone who conveys the material (or modified versions of
384 | it) with contractual assumptions of liability to the recipient, for
385 | any liability that these contractual assumptions directly impose on
386 | those licensors and authors.
387 |
388 | All other non-permissive additional terms are considered "further
389 | restrictions" within the meaning of section 10. If the Program as you
390 | received it, or any part of it, contains a notice stating that it is
391 | governed by this License along with a term that is a further
392 | restriction, you may remove that term. If a license document contains
393 | a further restriction but permits relicensing or conveying under this
394 | License, you may add to a covered work material governed by the terms
395 | of that license document, provided that the further restriction does
396 | not survive such relicensing or conveying.
397 |
398 | If you add terms to a covered work in accord with this section, you
399 | must place, in the relevant source files, a statement of the
400 | additional terms that apply to those files, or a notice indicating
401 | where to find the applicable terms.
402 |
403 | Additional terms, permissive or non-permissive, may be stated in the
404 | form of a separately written license, or stated as exceptions;
405 | the above requirements apply either way.
406 |
407 | 8. Termination.
408 |
409 | You may not propagate or modify a covered work except as expressly
410 | provided under this License. Any attempt otherwise to propagate or
411 | modify it is void, and will automatically terminate your rights under
412 | this License (including any patent licenses granted under the third
413 | paragraph of section 11).
414 |
415 | However, if you cease all violation of this License, then your
416 | license from a particular copyright holder is reinstated (a)
417 | provisionally, unless and until the copyright holder explicitly and
418 | finally terminates your license, and (b) permanently, if the copyright
419 | holder fails to notify you of the violation by some reasonable means
420 | prior to 60 days after the cessation.
421 |
422 | Moreover, your license from a particular copyright holder is
423 | reinstated permanently if the copyright holder notifies you of the
424 | violation by some reasonable means, this is the first time you have
425 | received notice of violation of this License (for any work) from that
426 | copyright holder, and you cure the violation prior to 30 days after
427 | your receipt of the notice.
428 |
429 | Termination of your rights under this section does not terminate the
430 | licenses of parties who have received copies or rights from you under
431 | this License. If your rights have been terminated and not permanently
432 | reinstated, you do not qualify to receive new licenses for the same
433 | material under section 10.
434 |
435 | 9. Acceptance Not Required for Having Copies.
436 |
437 | You are not required to accept this License in order to receive or
438 | run a copy of the Program. Ancillary propagation of a covered work
439 | occurring solely as a consequence of using peer-to-peer transmission
440 | to receive a copy likewise does not require acceptance. However,
441 | nothing other than this License grants you permission to propagate or
442 | modify any covered work. These actions infringe copyright if you do
443 | not accept this License. Therefore, by modifying or propagating a
444 | covered work, you indicate your acceptance of this License to do so.
445 |
446 | 10. Automatic Licensing of Downstream Recipients.
447 |
448 | Each time you convey a covered work, the recipient automatically
449 | receives a license from the original licensors, to run, modify and
450 | propagate that work, subject to this License. You are not responsible
451 | for enforcing compliance by third parties with this License.
452 |
453 | An "entity transaction" is a transaction transferring control of an
454 | organization, or substantially all assets of one, or subdividing an
455 | organization, or merging organizations. If propagation of a covered
456 | work results from an entity transaction, each party to that
457 | transaction who receives a copy of the work also receives whatever
458 | licenses to the work the party's predecessor in interest had or could
459 | give under the previous paragraph, plus a right to possession of the
460 | Corresponding Source of the work from the predecessor in interest, if
461 | the predecessor has it or can get it with reasonable efforts.
462 |
463 | You may not impose any further restrictions on the exercise of the
464 | rights granted or affirmed under this License. For example, you may
465 | not impose a license fee, royalty, or other charge for exercise of
466 | rights granted under this License, and you may not initiate litigation
467 | (including a cross-claim or counterclaim in a lawsuit) alleging that
468 | any patent claim is infringed by making, using, selling, offering for
469 | sale, or importing the Program or any portion of it.
470 |
471 | 11. Patents.
472 |
473 | A "contributor" is a copyright holder who authorizes use under this
474 | License of the Program or a work on which the Program is based. The
475 | work thus licensed is called the contributor's "contributor version".
476 |
477 | A contributor's "essential patent claims" are all patent claims
478 | owned or controlled by the contributor, whether already acquired or
479 | hereafter acquired, that would be infringed by some manner, permitted
480 | by this License, of making, using, or selling its contributor version,
481 | but do not include claims that would be infringed only as a
482 | consequence of further modification of the contributor version. For
483 | purposes of this definition, "control" includes the right to grant
484 | patent sublicenses in a manner consistent with the requirements of
485 | this License.
486 |
487 | Each contributor grants you a non-exclusive, worldwide, royalty-free
488 | patent license under the contributor's essential patent claims, to
489 | make, use, sell, offer for sale, import and otherwise run, modify and
490 | propagate the contents of its contributor version.
491 |
492 | In the following three paragraphs, a "patent license" is any express
493 | agreement or commitment, however denominated, not to enforce a patent
494 | (such as an express permission to practice a patent or covenant not to
495 | sue for patent infringement). To "grant" such a patent license to a
496 | party means to make such an agreement or commitment not to enforce a
497 | patent against the party.
498 |
499 | If you convey a covered work, knowingly relying on a patent license,
500 | and the Corresponding Source of the work is not available for anyone
501 | to copy, free of charge and under the terms of this License, through a
502 | publicly available network server or other readily accessible means,
503 | then you must either (1) cause the Corresponding Source to be so
504 | available, or (2) arrange to deprive yourself of the benefit of the
505 | patent license for this particular work, or (3) arrange, in a manner
506 | consistent with the requirements of this License, to extend the patent
507 | license to downstream recipients. "Knowingly relying" means you have
508 | actual knowledge that, but for the patent license, your conveying the
509 | covered work in a country, or your recipient's use of the covered work
510 | in a country, would infringe one or more identifiable patents in that
511 | country that you have reason to believe are valid.
512 |
513 | If, pursuant to or in connection with a single transaction or
514 | arrangement, you convey, or propagate by procuring conveyance of, a
515 | covered work, and grant a patent license to some of the parties
516 | receiving the covered work authorizing them to use, propagate, modify
517 | or convey a specific copy of the covered work, then the patent license
518 | you grant is automatically extended to all recipients of the covered
519 | work and works based on it.
520 |
521 | A patent license is "discriminatory" if it does not include within
522 | the scope of its coverage, prohibits the exercise of, or is
523 | conditioned on the non-exercise of one or more of the rights that are
524 | specifically granted under this License. You may not convey a covered
525 | work if you are a party to an arrangement with a third party that is
526 | in the business of distributing software, under which you make payment
527 | to the third party based on the extent of your activity of conveying
528 | the work, and under which the third party grants, to any of the
529 | parties who would receive the covered work from you, a discriminatory
530 | patent license (a) in connection with copies of the covered work
531 | conveyed by you (or copies made from those copies), or (b) primarily
532 | for and in connection with specific products or compilations that
533 | contain the covered work, unless you entered into that arrangement,
534 | or that patent license was granted, prior to 28 March 2007.
535 |
536 | Nothing in this License shall be construed as excluding or limiting
537 | any implied license or other defenses to infringement that may
538 | otherwise be available to you under applicable patent law.
539 |
540 | 12. No Surrender of Others' Freedom.
541 |
542 | If conditions are imposed on you (whether by court order, agreement or
543 | otherwise) that contradict the conditions of this License, they do not
544 | excuse you from the conditions of this License. If you cannot convey a
545 | covered work so as to satisfy simultaneously your obligations under this
546 | License and any other pertinent obligations, then as a consequence you may
547 | not convey it at all. For example, if you agree to terms that obligate you
548 | to collect a royalty for further conveying from those to whom you convey
549 | the Program, the only way you could satisfy both those terms and this
550 | License would be to refrain entirely from conveying the Program.
551 |
552 | 13. Use with the GNU Affero General Public License.
553 |
554 | Notwithstanding any other provision of this License, you have
555 | permission to link or combine any covered work with a work licensed
556 | under version 3 of the GNU Affero General Public License into a single
557 | combined work, and to convey the resulting work. The terms of this
558 | License will continue to apply to the part which is the covered work,
559 | but the special requirements of the GNU Affero General Public License,
560 | section 13, concerning interaction through a network will apply to the
561 | combination as such.
562 |
563 | 14. Revised Versions of this License.
564 |
565 | The Free Software Foundation may publish revised and/or new versions of
566 | the GNU General Public License from time to time. Such new versions will
567 | be similar in spirit to the present version, but may differ in detail to
568 | address new problems or concerns.
569 |
570 | Each version is given a distinguishing version number. If the
571 | Program specifies that a certain numbered version of the GNU General
572 | Public License "or any later version" applies to it, you have the
573 | option of following the terms and conditions either of that numbered
574 | version or of any later version published by the Free Software
575 | Foundation. If the Program does not specify a version number of the
576 | GNU General Public License, you may choose any version ever published
577 | by the Free Software Foundation.
578 |
579 | If the Program specifies that a proxy can decide which future
580 | versions of the GNU General Public License can be used, that proxy's
581 | public statement of acceptance of a version permanently authorizes you
582 | to choose that version for the Program.
583 |
584 | Later license versions may give you additional or different
585 | permissions. However, no additional obligations are imposed on any
586 | author or copyright holder as a result of your choosing to follow a
587 | later version.
588 |
589 | 15. Disclaimer of Warranty.
590 |
591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599 |
600 | 16. Limitation of Liability.
601 |
602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610 | SUCH DAMAGES.
611 |
612 | 17. Interpretation of Sections 15 and 16.
613 |
614 | If the disclaimer of warranty and limitation of liability provided
615 | above cannot be given local legal effect according to their terms,
616 | reviewing courts shall apply local law that most closely approximates
617 | an absolute waiver of all civil liability in connection with the
618 | Program, unless a warranty or assumption of liability accompanies a
619 | copy of the Program in return for a fee.
620 |
621 | END OF TERMS AND CONDITIONS
622 |
623 | How to Apply These Terms to Your New Programs
624 |
625 | If you develop a new program, and you want it to be of the greatest
626 | possible use to the public, the best way to achieve this is to make it
627 | free software which everyone can redistribute and change under these terms.
628 |
629 | To do so, attach the following notices to the program. It is safest
630 | to attach them to the start of each source file to most effectively
631 | state the exclusion of warranty; and each file should have at least
632 | the "copyright" line and a pointer to where the full notice is found.
633 |
634 | {one line to give the program's name and a brief idea of what it does.}
635 | Copyright (C) 2018 {name of author}
636 |
637 | This program is free software: you can redistribute it and/or modify
638 | it under the terms of the GNU General Public License as published by
639 | the Free Software Foundation, either version 3 of the License, or
640 | (at your option) any later version.
641 |
642 | This program is distributed in the hope that it will be useful,
643 | but WITHOUT ANY WARRANTY; without even the implied warranty of
644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645 | GNU General Public License for more details.
646 |
647 | You should have received a copy of the GNU General Public License
648 | along with this program. If not, see .
649 |
650 | Also add information on how to contact you by electronic and paper mail.
651 |
652 | If the program does terminal interaction, make it output a short
653 | notice like this when it starts in an interactive mode:
654 |
655 | RawAnalyzer Copyright (C) 2018 impakho
656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657 | This is free software, and you are welcome to redistribute it
658 | under certain conditions; type `show c' for details.
659 |
660 | The hypothetical commands `show w' and `show c' should show the appropriate
661 | parts of the General Public License. Of course, your program's commands
662 | might be different; for a GUI interface, you would use an "about box".
663 |
664 | You should also get your employer (if you work as a programmer) or school,
665 | if any, to sign a "copyright disclaimer" for the program, if necessary.
666 | For more information on this, and how to apply and follow the GNU GPL, see
667 | .
668 |
669 | The GNU General Public License does not permit incorporating your program
670 | into proprietary programs. If your program is a subroutine library, you
671 | may consider it more useful to permit linking proprietary applications with
672 | the library. If this is what you want to do, use the GNU Lesser General
673 | Public License instead of this License. But first, please read
674 | .
--------------------------------------------------------------------------------
/android_analyzer.py:
--------------------------------------------------------------------------------
1 | import os, sys
2 | import re
3 | import codecs
4 | import threading
5 | import fcntl
6 | import subprocess
7 | import time
8 | import hashlib
9 | import traceback
10 | from PIL import Image
11 | from PIL.ExifTags import TAGS, GPSTAGS
12 | from PyQt5 import QtGui, QtCore, QtWidgets
13 | from PyQt5.QtCore import *
14 | from PyQt5.QtGui import *
15 | from PyQt5.QtWidgets import *
16 | from PyQt5.QtWebKit import *
17 | from PyQt5.QtWebKitWidgets import *
18 |
19 | openFilePath = ""
20 | openFileName = ""
21 | pt_offset = []
22 | pt_sector = []
23 | pt_type = []
24 | pt_name = []
25 | mount_dev = []
26 | mount_path = []
27 | image_format = ['jpg', 'jpeg', 'png', 'bmp', 'gif', 'tiff', 'tga']
28 | audio_format = ['mp3', 'wav', 'wmv', 'flac', 'ape', 'aac']
29 | video_format = ['mp4', 'mpg', 'mpeg', 'rm', 'rmvb', 'avi', 'wmv', 'mkv', '3gp', 'mov', 'flv', 'f4v', 'm4v', 'ts', 'mts', 'm2ts', 'vob']
30 | recover_image_format = ['jpg', 'jpeg', 'png', 'bmp', 'gif', 'rif']
31 | recover_media_format = ['wav', 'mp4', 'mpg', 'mpeg', 'avi', 'wmv', 'mov']
32 | recover_document_format = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf']
33 | recover_other_format = ['rar', 'zip', 'htm', 'html', 'exe', 'ole', 'sxc', 'sxi', 'sxw']
34 | map_url = "http://api.map.baidu.com/lbsapi/cloud/jsdemo/demo/a1_2.htm"
35 | map_data = []
36 |
37 | def calcLen(length):
38 | length1 = hex(length[3])[2:]
39 | length2 = hex(length[2])[2:]
40 | length3 = hex(length[1])[2:]
41 | length4 = hex(length[0])[2:]
42 | if len(length1) == 1: length1 = "0" + length1
43 | if len(length2) == 1: length2 = "0" + length2
44 | if len(length3) == 1: length3 = "0" + length3
45 | if len(length4) == 1: length4 = "0" + length4
46 | return int(length1+length2+length3+length4,16)
47 |
48 | def findMBR(filename,sector,offset):
49 | fd = open(filename,'rb')
50 | fd.seek(offset*sector)
51 | mbr = fd.read(sector)
52 | fd.close()
53 | if codecs.encode(mbr[-2:],'hex') != b"55aa": return
54 | mbr = mbr[-66:]
55 | for i in range(0,4):
56 | runDPT(filename,sector,offset,mbr[i*16:(i+1)*16])
57 |
58 | def runDPT(filename,sector,offset,dpt):
59 | flag = codecs.encode(dpt[4:5],'hex')
60 | if flag == b"00": return
61 | length = calcLen(dpt[8:12])
62 | if flag == b"05":
63 | findEBR(filename,sector,offset+length,offset+length)
64 | return
65 | pt_offset.append(offset+length)
66 | pt_sector.append(calcLen(dpt[12:16]))
67 | typePT(filename,sector,offset+length)
68 | namePT(filename,sector,offset+length)
69 |
70 | def findEBR(filename,sector,first,offset):
71 | fd = open(filename,'rb')
72 | fd.seek(offset*sector)
73 | ebr = fd.read(sector)
74 | fd.close()
75 | if codecs.encode(ebr[-2:],'hex') != b"55aa": return
76 | ebr = ebr[-66:]
77 | pt_offset.append(offset+calcLen(ebr[8:12]))
78 | pt_sector.append(calcLen(ebr[12:16]))
79 | typePT(filename,sector,offset+calcLen(ebr[8:12]))
80 | namePT(filename,sector,offset+calcLen(ebr[8:12]))
81 | if codecs.encode(ebr[20:21],'hex') == b"05":
82 | findEBR(filename,sector,first,first+calcLen(ebr[24:28]))
83 |
84 | def typePT(filename,sector,offset):
85 | fd = open(filename,'rb')
86 | fd.seek(offset*sector)
87 | dbr = fd.read(sector*3)
88 | fd.close()
89 | if codecs.encode(dbr[sector*2+56:sector*2+58],'hex') == b"53ef":
90 | pt_type.append("EXTX")
91 | return
92 | if codecs.encode(dbr[sector-2:sector],'hex') == b"55aa":
93 | if dbr[3:7] == "NTFS":
94 | pt_type.append("NTFS")
95 | return
96 | if dbr[82:87] == "FAT32":
97 | pt_type.append("FAT32")
98 | return
99 | if dbr[54:59] == "FAT16":
100 | pt_type.append("FAT16")
101 | return
102 | if dbr[54:59] == "FAT12":
103 | pt_type.append("FAT12")
104 | return
105 | pt_type.append("Uknown")
106 |
107 | def namePT(filename,sector,offset):
108 | fd = open(filename,'rb')
109 | fd.seek(offset*sector)
110 | dbr = fd.read(sector*3)
111 | fd.close()
112 | if codecs.encode(dbr[sector*2+56:sector*2+58],'hex') == b"53ef":
113 | pt_name.append(str(dbr[sector*2+120:sector*2+152].strip(b'\x00').strip(b'\x20'),'ascii'))
114 | return
115 | if codecs.encode(dbr[sector-2:sector],'hex') == b"55aa":
116 | if dbr[3:7] == "NTFS":
117 | pt_name.append(str(dbr[72:80].strip(b'\x00').strip(b'\x20'),'ascii'))
118 | return
119 | if dbr[82:87] == "FAT32":
120 | pt_name.append(str(dbr[71:82].strip(b'\x00').strip(b'\x20'),'ascii'))
121 | return
122 | if dbr[54:59] == "FAT16":
123 | pt_name.append(str(dbr[43:54].strip(b'\x00').strip(b'\x20'),'ascii'))
124 | return
125 | if dbr[54:59] == "FAT12":
126 | pt_name.append(str(dbr[43:54].strip(b'\x00').strip(b'\x20'),'ascii'))
127 | return
128 | pt_name.append("")
129 |
130 | def map_getMinMax():
131 | if len(map_data) <= 0: return
132 | minLat = 9999
133 | minLon = 9999
134 | maxLat = -9999
135 | maxLon = -9999
136 | for metadata in map_data:
137 | if metadata[1] < minLat: minLat = metadata[1]
138 | if metadata[1] > maxLat: maxLat = metadata[1]
139 | if metadata[2] < minLon: minLon = metadata[2]
140 | if metadata[2] > maxLon: maxLon = metadata[2]
141 | return minLat, maxLat, minLon, maxLon
142 |
143 | def map_getCenter():
144 | if len(map_data) <= 0: return
145 | minLat, maxLat, minLon, maxLon = map_getMinMax()
146 | centerLat = (minLat + maxLat) / 2
147 | centerLon = (minLon + maxLon) / 2
148 | return centerLat, centerLon
149 |
150 | def map_getZoom():
151 | if len(map_data) <= 0: return
152 | minLat, maxLat, minLon, maxLon = map_getMinMax()
153 | zoomLat = (maxLat - minLat) * 111110 / 9
154 | zoomLon = (maxLon - minLon) * 111110 / 9
155 | zoom = zoomLat
156 | if zoomLat < zoomLon: zoom = zoomLon
157 | if zoom <= 20: return 19
158 | if zoom <= 50: return 18
159 | if zoom <= 100: return 17
160 | if zoom <= 200: return 16
161 | if zoom <= 500: return 15
162 | if zoom <= 1000: return 14
163 | if zoom <= 2000: return 13
164 | if zoom <= 5000: return 12
165 | if zoom <= 10000: return 11
166 | if zoom <= 20000: return 10
167 | if zoom <= 25000: return 9
168 | if zoom <= 50000: return 8
169 | if zoom <= 100000: return 7
170 | if zoom <= 200000: return 6
171 | if zoom <= 500000: return 5
172 | if zoom <= 1000000: return 4
173 | if zoom <= 2000000: return 3
174 | if zoom <= 5000000: return 2
175 | return 1
176 |
177 | def map_hideCpy(webView):
178 | webView.page().mainFrame().evaluateJavaScript("document.getElementsByClassName('BMap_cpyCtrl')[0].style.display = 'none';")
179 | webView.page().mainFrame().evaluateJavaScript("document.getElementById('zoomer').previousSibling.style.display = 'none';")
180 |
181 | class App(QMainWindow):
182 |
183 | def __init__(self):
184 | super().__init__()
185 | self.title = 'Android手机取证工具'
186 | self.left = 150
187 | self.top = 150
188 | self.width = 800
189 | self.height = 500
190 | self.setWindowTitle(self.title)
191 | self.setGeometry(self.left, self.top, self.width, self.height)
192 |
193 | self.table_widget = MyTableWidget(self)
194 | self.setCentralWidget(self.table_widget)
195 |
196 | self.show()
197 |
198 | def closeEvent(self, event):
199 | os._exit(0)
200 |
201 | class MyTableWidget(QWidget):
202 |
203 | def __init__(self, parent):
204 | super(QWidget, self).__init__(parent)
205 | self.layout = QVBoxLayout(self)
206 |
207 | # Initialize tab screen
208 | self.tabs = QTabWidget()
209 | self.tab1 = QWidget()
210 | self.tab2 = QWidget()
211 | self.tab3 = QWidget()
212 | self.tab4 = QWidget()
213 | self.tab5 = QWidget()
214 | self.tab6 = QWidget()
215 | self.tab7 = QWidget()
216 | self.tabs.resize(800, 500)
217 |
218 | # Add tabs
219 | self.tabs.addTab(self.tab1, "镜像文件分析")
220 | self.tabs.addTab(self.tab2, "文件内容搜索")
221 | self.tabs.addTab(self.tab3, "特征文件搜索")
222 | self.tabs.addTab(self.tab4, "相似图片搜索")
223 | self.tabs.addTab(self.tab5, "文件数据恢复")
224 | self.tabs.addTab(self.tab6, "GPS轨迹分析")
225 | self.tabs.addTab(self.tab7, "数据库分析")
226 |
227 | # Tab 1
228 | self.tab1.layout = QVBoxLayout(self)
229 | # button_openfile
230 | self.tab1.button_openfile = QPushButton("分析镜像文件")
231 | self.tab1.button_openfile.clicked.connect(self.tab1_openfile_click)
232 | # button_savefile
233 | self.tab1.button_savefile = QPushButton("保存分区文件")
234 | self.tab1.button_savefile.clicked.connect(self.tab1_savefile_click)
235 | # button_repairfile
236 | self.tab1.button_repairfile = QPushButton("修复分区文件")
237 | self.tab1.button_repairfile.clicked.connect(self.tab1_repairfile_click)
238 | # button_mountfile
239 | self.tab1.button_mountfile = QPushButton("挂载分区文件")
240 | self.tab1.button_mountfile.clicked.connect(self.tab1_mountfile_click)
241 | # button_umountdrive
242 | self.tab1.button_umountdrive = QPushButton("卸载分区")
243 | self.tab1.button_umountdrive.clicked.connect(self.tab1_umountdrive_click)
244 | # list_filedetail
245 | self.tab1.list_filedetail = QListWidget(self)
246 | # list_mountdetail
247 | self.tab1.list_mountdetail = QListWidget(self)
248 | # label_sectoroffset
249 | self.tab1.label_sectoroffset = QLabel("扇区偏移:")
250 | # textbox_sectoroffset
251 | self.tab1.textbox_sectoroffset = QLineEdit("0")
252 | # label_sectorsize
253 | self.tab1.label_sectorsize = QLabel("扇区大小:")
254 | # textbox_sectorsize
255 | self.tab1.textbox_sectorsize = QLineEdit("512")
256 | # label_blocksize
257 | self.tab1.label_blocksize = QLabel("块大小:")
258 | # textbox_blocksize
259 | self.tab1.textbox_blocksize = QLineEdit("4096")
260 | # label_repairfs
261 | self.tab1.label_repairfs = QLabel("文件系统:")
262 | # textbox_repairfs
263 | self.tab1.textbox_repairfs = QLineEdit("ext4")
264 | # label_mountparams
265 | self.tab1.label_mountparams = QLabel("挂载参数:")
266 | # textbox_mountparams
267 | self.tab1.textbox_mountparams = QLineEdit("-o loop,ro,noexec,noload")
268 | # button_adb
269 | self.tab1.button_adb = QPushButton("ADB一键提取数据(需要ROOT)")
270 | self.tab1.button_adb.clicked.connect(self.tab1_adb_click)
271 | # Add widgets to tab
272 | self.tab1.layout1 = QHBoxLayout(self)
273 | self.tab1.layout2 = QHBoxLayout(self)
274 | self.tab1.layout3 = QHBoxLayout(self)
275 | self.tab1.layout4 = QHBoxLayout(self)
276 | self.tab1.layout5 = QHBoxLayout(self)
277 | self.tab1.layout6 = QHBoxLayout(self)
278 | self.tab1.layout1.addWidget(self.tab1.button_openfile)
279 | self.tab1.layout1.addWidget(self.tab1.button_savefile)
280 | self.tab1.layout1.addWidget(self.tab1.button_repairfile)
281 | self.tab1.layout1.addWidget(self.tab1.button_mountfile)
282 | self.tab1.layout1.addWidget(self.tab1.button_umountdrive)
283 | self.tab1.layout2.addWidget(self.tab1.list_filedetail)
284 | self.tab1.layout2.addWidget(self.tab1.list_mountdetail)
285 | self.tab1.layout3.addWidget(self.tab1.label_sectoroffset)
286 | self.tab1.layout3.addWidget(self.tab1.textbox_sectoroffset)
287 | self.tab1.layout3.addWidget(self.tab1.label_sectorsize)
288 | self.tab1.layout3.addWidget(self.tab1.textbox_sectorsize)
289 | self.tab1.layout4.addWidget(self.tab1.label_blocksize)
290 | self.tab1.layout4.addWidget(self.tab1.textbox_blocksize)
291 | self.tab1.layout4.addWidget(self.tab1.label_repairfs)
292 | self.tab1.layout4.addWidget(self.tab1.textbox_repairfs)
293 | self.tab1.layout5.addWidget(self.tab1.label_mountparams)
294 | self.tab1.layout5.addWidget(self.tab1.textbox_mountparams)
295 | self.tab1.layout6.addWidget(self.tab1.button_adb)
296 | self.tab1.layout.addLayout(self.tab1.layout1)
297 | self.tab1.layout.addLayout(self.tab1.layout2)
298 | self.tab1.layout.addLayout(self.tab1.layout3)
299 | self.tab1.layout.addLayout(self.tab1.layout4)
300 | self.tab1.layout.addLayout(self.tab1.layout5)
301 | self.tab1.layout.addStretch()
302 | self.tab1.layout.addLayout(self.tab1.layout6)
303 | self.tab1.layout.addStretch()
304 | self.tab1.setLayout(self.tab1.layout)
305 |
306 | # Tab 2
307 | self.tab2.layout = QVBoxLayout(self)
308 | # label_searchdir
309 | self.tab2.label_searchdir = QLabel("搜索目录:")
310 | # textbox_searchdir
311 | self.tab2.textbox_searchdir = QLineEdit(self)
312 | # button_searchdir
313 | self.tab2.button_searchdir = QPushButton("选择目录")
314 | self.tab2.button_searchdir.clicked.connect(self.tab2_searchdir_click)
315 | # label_searchkeyword
316 | self.tab2.label_searchkeyword = QLabel("关键词:")
317 | # textbox_search
318 | self.tab2.textbox_search = QLineEdit(self)
319 | # label_searchtype
320 | self.tab2.label_searchtype = QLabel("类型:")
321 | # buttongroup_searchtype
322 | self.tab2.buttongroup_searchtype = QButtonGroup(self)
323 | # radiobutton_string
324 | self.tab2.radiobutton_string = QRadioButton("字符串")
325 | self.tab2.radiobutton_string.setChecked(True)
326 | # radiobutton_hex
327 | self.tab2.radiobutton_hex = QRadioButton("16进制")
328 | # button_search
329 | self.tab2.button_search = QPushButton("搜索")
330 | self.tab2.button_search.clicked.connect(self.tab2_search_click)
331 | # label_searchsize
332 | self.tab2.label_searchsize = QLabel("大小:")
333 | # buttongroup_searchsize
334 | self.tab2.buttongroup_searchsize = QButtonGroup(self)
335 | # radiobutton_sizeoff
336 | self.tab2.radiobutton_sizeoff = QRadioButton("无限制")
337 | self.tab2.radiobutton_sizeoff.setChecked(True)
338 | # radiobutton_sizeon
339 | self.tab2.radiobutton_sizeon = QRadioButton("自定义")
340 | # label_sizesm
341 | self.tab2.label_sizesm = QLabel("大于")
342 | self.tab2.label_sizesm.setFixedWidth(30)
343 | # textbox_sizesm
344 | self.tab2.textbox_sizesm = QLineEdit("0")
345 | self.tab2.textbox_sizesm.setFixedWidth(60)
346 | # combobox_sizesm
347 | self.tab2.combobox_sizesm = QComboBox(self)
348 | self.tab2.combobox_sizesm.setFixedWidth(80)
349 | self.tab2.combobox_sizesm.addItem("KB")
350 | self.tab2.combobox_sizesm.addItem("MB")
351 | self.tab2.combobox_sizesm.addItem("GB")
352 | # label_sizebg
353 | self.tab2.label_sizebg = QLabel("小于")
354 | self.tab2.label_sizebg.setFixedWidth(30)
355 | # textbox_sizebg
356 | self.tab2.textbox_sizebg = QLineEdit("512")
357 | self.tab2.textbox_sizebg.setFixedWidth(60)
358 | # combobox_sizebg
359 | self.tab2.combobox_sizebg = QComboBox(self)
360 | self.tab2.combobox_sizebg.setFixedWidth(80)
361 | self.tab2.combobox_sizebg.addItem("KB")
362 | self.tab2.combobox_sizebg.addItem("MB")
363 | self.tab2.combobox_sizebg.addItem("GB")
364 | self.tab2.combobox_sizebg.setCurrentIndex(1)
365 | # label_searchtime
366 | self.tab2.label_searchtime = QLabel("修改时间:")
367 | # buttongroup_searchtime
368 | self.tab2.buttongroup_searchtime = QButtonGroup(self)
369 | # radiobutton_timeoff
370 | self.tab2.radiobutton_timeoff = QRadioButton("无限制")
371 | self.tab2.radiobutton_timeoff.setChecked(True)
372 | # radiobutton_timeon
373 | self.tab2.radiobutton_timeon = QRadioButton("自定义")
374 | # label_timesm
375 | self.tab2.label_timesm = QLabel("大于")
376 | self.tab2.label_timesm.setFixedWidth(30)
377 | # datetime_timesm
378 | self.tab2.datetime_timesm = QDateTimeEdit(self)
379 | self.tab2.datetime_timesm.setCalendarPopup(True)
380 | self.tab2.datetime_timesm_dt = QDateTime()
381 | self.tab2.datetime_timesm_dt.setTime_t(time.time() - 1296000)
382 | self.tab2.datetime_timesm.setDateTime(self.tab2.datetime_timesm_dt)
383 | # label_timebg
384 | self.tab2.label_timebg = QLabel("小于")
385 | self.tab2.label_timebg.setFixedWidth(30)
386 | # datetime_timebg
387 | self.tab2.datetime_timebg = QDateTimeEdit(self)
388 | self.tab2.datetime_timebg.setCalendarPopup(True)
389 | self.tab2.datetime_timebg_dt = QDateTime()
390 | self.tab2.datetime_timebg_dt.setTime_t(time.time())
391 | self.tab2.datetime_timebg.setDateTime(self.tab2.datetime_timebg_dt)
392 | # label_searchresult
393 | self.tab2.label_searchresult = QLabel("搜索结果:")
394 | # list_searchresult
395 | self.tab2.list_searchresult = QListWidget(self)
396 | # Add widgets to tab
397 | self.tab2.layout1 = QHBoxLayout(self)
398 | self.tab2.layout2 = QHBoxLayout(self)
399 | self.tab2.layout3 = QHBoxLayout(self)
400 | self.tab2.layout4 = QHBoxLayout(self)
401 | self.tab2.layout5 = QHBoxLayout(self)
402 | self.tab2.layout6 = QHBoxLayout(self)
403 | self.tab2.layout7 = QHBoxLayout(self)
404 | self.tab2.layout1.addWidget(self.tab2.label_searchdir)
405 | self.tab2.layout1.addWidget(self.tab2.textbox_searchdir)
406 | self.tab2.layout1.addWidget(self.tab2.button_searchdir)
407 | self.tab2.layout2.addWidget(self.tab2.label_searchkeyword)
408 | self.tab2.layout2.addWidget(self.tab2.textbox_search)
409 | self.tab2.layout3.addWidget(self.tab2.label_searchtype)
410 | self.tab2.buttongroup_searchtype.addButton(self.tab2.radiobutton_string)
411 | self.tab2.buttongroup_searchtype.addButton(self.tab2.radiobutton_hex)
412 | self.tab2.layout3.addWidget(self.tab2.radiobutton_string)
413 | self.tab2.layout3.addWidget(self.tab2.radiobutton_hex)
414 | self.tab2.layout3.addWidget(self.tab2.button_search)
415 | self.tab2.layout4.addWidget(self.tab2.label_searchsize)
416 | self.tab2.buttongroup_searchsize.addButton(self.tab2.radiobutton_sizeoff)
417 | self.tab2.buttongroup_searchsize.addButton(self.tab2.radiobutton_sizeon)
418 | self.tab2.layout4.addWidget(self.tab2.radiobutton_sizeoff)
419 | self.tab2.layout4.addWidget(self.tab2.radiobutton_sizeon)
420 | self.tab2.layout4.addWidget(self.tab2.label_sizesm)
421 | self.tab2.layout4.addWidget(self.tab2.textbox_sizesm)
422 | self.tab2.layout4.addWidget(self.tab2.combobox_sizesm)
423 | self.tab2.layout4.addWidget(self.tab2.label_sizebg)
424 | self.tab2.layout4.addWidget(self.tab2.textbox_sizebg)
425 | self.tab2.layout4.addWidget(self.tab2.combobox_sizebg)
426 | self.tab2.layout5.addWidget(self.tab2.label_searchtime)
427 | self.tab2.buttongroup_searchtime.addButton(self.tab2.radiobutton_timeoff)
428 | self.tab2.buttongroup_searchtime.addButton(self.tab2.radiobutton_timeon)
429 | self.tab2.layout5.addWidget(self.tab2.radiobutton_timeoff)
430 | self.tab2.layout5.addWidget(self.tab2.radiobutton_timeon)
431 | self.tab2.layout5.addWidget(self.tab2.label_timesm)
432 | self.tab2.layout5.addWidget(self.tab2.datetime_timesm)
433 | self.tab2.layout5.addWidget(self.tab2.label_timebg)
434 | self.tab2.layout5.addWidget(self.tab2.datetime_timebg)
435 | self.tab2.layout6.addWidget(self.tab2.label_searchresult)
436 | self.tab2.layout7.addWidget(self.tab2.list_searchresult)
437 | self.tab2.layout.addLayout(self.tab2.layout1)
438 | self.tab2.layout.addLayout(self.tab2.layout2)
439 | self.tab2.layout.addLayout(self.tab2.layout3)
440 | self.tab2.layout.addLayout(self.tab2.layout4)
441 | self.tab2.layout.addLayout(self.tab2.layout5)
442 | self.tab2.layout.addStretch()
443 | self.tab2.layout.addLayout(self.tab2.layout6)
444 | self.tab2.layout.addLayout(self.tab2.layout7)
445 | self.tab2.layout.addStretch()
446 | self.tab2.setLayout(self.tab2.layout)
447 |
448 | # Tab 3
449 | self.tab3.layout = QVBoxLayout(self)
450 | # label_searchdir
451 | self.tab3.label_searchdir = QLabel("搜索目录:")
452 | # textbox_searchdir
453 | self.tab3.textbox_searchdir = QLineEdit(self)
454 | # button_searchdir
455 | self.tab3.button_searchdir = QPushButton("选择目录")
456 | self.tab3.button_searchdir.clicked.connect(self.tab3_searchdir_click)
457 | # label_searchtype
458 | self.tab3.label_searchtype = QLabel("类型:")
459 | # buttongroup_searchtype
460 | self.tab3.buttongroup_searchtype = QButtonGroup(self)
461 | # radiobutton_image
462 | self.tab3.radiobutton_image = QRadioButton("图片")
463 | self.tab3.radiobutton_image.setFixedWidth(60)
464 | self.tab3.radiobutton_image.setChecked(True)
465 | # combobox_image
466 | self.tab3.combobox_image = QComboBox(self)
467 | self.tab3.combobox_image.setFixedWidth(80)
468 | self.tab3.combobox_image.addItem("所有")
469 | for i in image_format:
470 | self.tab3.combobox_image.addItem("." + i)
471 | # radiobutton_audio
472 | self.tab3.radiobutton_audio = QRadioButton("音频")
473 | self.tab3.radiobutton_audio.setFixedWidth(60)
474 | # combobox_audio
475 | self.tab3.combobox_audio = QComboBox(self)
476 | self.tab3.combobox_audio.setFixedWidth(80)
477 | self.tab3.combobox_audio.addItem("所有")
478 | for i in audio_format:
479 | self.tab3.combobox_audio.addItem("." + i)
480 | # radiobutton_video
481 | self.tab3.radiobutton_video = QRadioButton("视频")
482 | self.tab3.radiobutton_video.setFixedWidth(60)
483 | # combobox_video
484 | self.tab3.combobox_video = QComboBox(self)
485 | self.tab3.combobox_video.setFixedWidth(80)
486 | self.tab3.combobox_video.addItem("所有")
487 | for i in video_format:
488 | self.tab3.combobox_video.addItem("." + i)
489 | # button_search
490 | self.tab3.button_search = QPushButton("搜索")
491 | self.tab3.button_search.clicked.connect(self.tab3_search_click)
492 | # label_searchsize
493 | self.tab3.label_searchsize = QLabel("大小:")
494 | # buttongroup_searchsize
495 | self.tab3.buttongroup_searchsize = QButtonGroup(self)
496 | # radiobutton_sizeoff
497 | self.tab3.radiobutton_sizeoff = QRadioButton("无限制")
498 | self.tab3.radiobutton_sizeoff.setChecked(True)
499 | # radiobutton_sizeon
500 | self.tab3.radiobutton_sizeon = QRadioButton("自定义")
501 | # label_sizesm
502 | self.tab3.label_sizesm = QLabel("大于")
503 | self.tab3.label_sizesm.setFixedWidth(30)
504 | # textbox_sizesm
505 | self.tab3.textbox_sizesm = QLineEdit("0")
506 | self.tab3.textbox_sizesm.setFixedWidth(60)
507 | # combobox_sizesm
508 | self.tab3.combobox_sizesm = QComboBox(self)
509 | self.tab3.combobox_sizesm.setFixedWidth(80)
510 | self.tab3.combobox_sizesm.addItem("KB")
511 | self.tab3.combobox_sizesm.addItem("MB")
512 | self.tab3.combobox_sizesm.addItem("GB")
513 | # label_sizebg
514 | self.tab3.label_sizebg = QLabel("小于")
515 | self.tab3.label_sizebg.setFixedWidth(30)
516 | # textbox_sizebg
517 | self.tab3.textbox_sizebg = QLineEdit("512")
518 | self.tab3.textbox_sizebg.setFixedWidth(60)
519 | # combobox_sizebg
520 | self.tab3.combobox_sizebg = QComboBox(self)
521 | self.tab3.combobox_sizebg.setFixedWidth(80)
522 | self.tab3.combobox_sizebg.addItem("KB")
523 | self.tab3.combobox_sizebg.addItem("MB")
524 | self.tab3.combobox_sizebg.addItem("GB")
525 | self.tab3.combobox_sizebg.setCurrentIndex(1)
526 | # label_searchtime
527 | self.tab3.label_searchtime = QLabel("修改时间:")
528 | # buttongroup_searchtime
529 | self.tab3.buttongroup_searchtime = QButtonGroup(self)
530 | # radiobutton_timeoff
531 | self.tab3.radiobutton_timeoff = QRadioButton("无限制")
532 | self.tab3.radiobutton_timeoff.setChecked(True)
533 | # radiobutton_timeon
534 | self.tab3.radiobutton_timeon = QRadioButton("自定义")
535 | # label_timesm
536 | self.tab3.label_timesm = QLabel("大于")
537 | self.tab3.label_timesm.setFixedWidth(30)
538 | # datetime_timesm
539 | self.tab3.datetime_timesm = QDateTimeEdit(self)
540 | self.tab3.datetime_timesm.setCalendarPopup(True)
541 | self.tab3.datetime_timesm_dt = QDateTime()
542 | self.tab3.datetime_timesm_dt.setTime_t(time.time() - 1296000)
543 | self.tab3.datetime_timesm.setDateTime(self.tab2.datetime_timesm_dt)
544 | # label_timebg
545 | self.tab3.label_timebg = QLabel("小于")
546 | self.tab3.label_timebg.setFixedWidth(30)
547 | # datetime_timebg
548 | self.tab3.datetime_timebg = QDateTimeEdit(self)
549 | self.tab3.datetime_timebg.setCalendarPopup(True)
550 | self.tab3.datetime_timebg_dt = QDateTime()
551 | self.tab3.datetime_timebg_dt.setTime_t(time.time())
552 | self.tab3.datetime_timebg.setDateTime(self.tab2.datetime_timebg_dt)
553 | # label_searchresult
554 | self.tab3.label_searchresult = QLabel("搜索结果:")
555 | # list_searchresult
556 | self.tab3.list_searchresult = QListWidget(self)
557 | # Add widgets to tab
558 | self.tab3.layout1 = QHBoxLayout(self)
559 | self.tab3.layout2 = QHBoxLayout(self)
560 | self.tab3.layout3 = QHBoxLayout(self)
561 | self.tab3.layout4 = QHBoxLayout(self)
562 | self.tab3.layout5 = QHBoxLayout(self)
563 | self.tab3.layout6 = QHBoxLayout(self)
564 | self.tab3.layout1.addWidget(self.tab3.label_searchdir)
565 | self.tab3.layout1.addWidget(self.tab3.textbox_searchdir)
566 | self.tab3.layout1.addWidget(self.tab3.button_searchdir)
567 | self.tab3.layout2.addWidget(self.tab3.label_searchtype)
568 | self.tab3.layout2.addStretch()
569 | self.tab3.buttongroup_searchtype.addButton(self.tab3.radiobutton_image)
570 | self.tab3.buttongroup_searchtype.addButton(self.tab3.radiobutton_audio)
571 | self.tab3.buttongroup_searchtype.addButton(self.tab3.radiobutton_video)
572 | self.tab3.layout2.addWidget(self.tab3.radiobutton_image)
573 | self.tab3.layout2.addWidget(self.tab3.combobox_image)
574 | self.tab3.layout2.addStretch()
575 | self.tab3.layout2.addWidget(self.tab3.radiobutton_audio)
576 | self.tab3.layout2.addWidget(self.tab3.combobox_audio)
577 | self.tab3.layout2.addStretch()
578 | self.tab3.layout2.addWidget(self.tab3.radiobutton_video)
579 | self.tab3.layout2.addWidget(self.tab3.combobox_video)
580 | self.tab3.layout2.addStretch()
581 | self.tab3.layout2.addWidget(self.tab3.button_search)
582 | self.tab3.layout3.addWidget(self.tab3.label_searchsize)
583 | self.tab3.buttongroup_searchsize.addButton(self.tab3.radiobutton_sizeoff)
584 | self.tab3.buttongroup_searchsize.addButton(self.tab3.radiobutton_sizeon)
585 | self.tab3.layout3.addWidget(self.tab3.radiobutton_sizeoff)
586 | self.tab3.layout3.addWidget(self.tab3.radiobutton_sizeon)
587 | self.tab3.layout3.addWidget(self.tab3.label_sizesm)
588 | self.tab3.layout3.addWidget(self.tab3.textbox_sizesm)
589 | self.tab3.layout3.addWidget(self.tab3.combobox_sizesm)
590 | self.tab3.layout3.addWidget(self.tab3.label_sizebg)
591 | self.tab3.layout3.addWidget(self.tab3.textbox_sizebg)
592 | self.tab3.layout3.addWidget(self.tab3.combobox_sizebg)
593 | self.tab3.layout4.addWidget(self.tab3.label_searchtime)
594 | self.tab3.buttongroup_searchtime.addButton(self.tab3.radiobutton_timeoff)
595 | self.tab3.buttongroup_searchtime.addButton(self.tab3.radiobutton_timeon)
596 | self.tab3.layout4.addWidget(self.tab3.radiobutton_timeoff)
597 | self.tab3.layout4.addWidget(self.tab3.radiobutton_timeon)
598 | self.tab3.layout4.addWidget(self.tab3.label_timesm)
599 | self.tab3.layout4.addWidget(self.tab3.datetime_timesm)
600 | self.tab3.layout4.addWidget(self.tab3.label_timebg)
601 | self.tab3.layout4.addWidget(self.tab3.datetime_timebg)
602 | self.tab3.layout5.addWidget(self.tab3.label_searchresult)
603 | self.tab3.layout6.addWidget(self.tab3.list_searchresult)
604 | self.tab3.layout.addLayout(self.tab3.layout1)
605 | self.tab3.layout.addLayout(self.tab3.layout2)
606 | self.tab3.layout.addLayout(self.tab3.layout3)
607 | self.tab3.layout.addLayout(self.tab3.layout4)
608 | self.tab3.layout.addStretch()
609 | self.tab3.layout.addLayout(self.tab3.layout5)
610 | self.tab3.layout.addLayout(self.tab3.layout6)
611 | self.tab3.layout.addStretch()
612 | self.tab3.setLayout(self.tab3.layout)
613 |
614 | # Tab 4
615 | self.tab4.layout = QVBoxLayout(self)
616 | # label_searchdir
617 | self.tab4.label_searchdir = QLabel("搜索目录:")
618 | # textbox_searchdir
619 | self.tab4.textbox_searchdir = QLineEdit(self)
620 | # button_searchdir
621 | self.tab4.button_searchdir = QPushButton("选择目录")
622 | self.tab4.button_searchdir.clicked.connect(self.tab4_searchdir_click)
623 | # label_searchpic
624 | self.tab4.label_searchpic = QLabel("源图片:")
625 | # textbox_search
626 | self.tab4.textbox_search = QLineEdit(self)
627 | # button_searchpic
628 | self.tab4.button_searchpic = QPushButton("选择图片")
629 | self.tab4.button_searchpic.clicked.connect(self.tab4_searchpic_click)
630 | # button_search
631 | self.tab4.button_search = QPushButton("搜索")
632 | self.tab4.button_search.clicked.connect(self.tab4_search_click)
633 | # label_searchsize
634 | self.tab4.label_searchsize = QLabel("大小:")
635 | # buttongroup_searchsize
636 | self.tab4.buttongroup_searchsize = QButtonGroup(self)
637 | # radiobutton_sizeoff
638 | self.tab4.radiobutton_sizeoff = QRadioButton("无限制")
639 | self.tab4.radiobutton_sizeoff.setChecked(True)
640 | # radiobutton_sizeon
641 | self.tab4.radiobutton_sizeon = QRadioButton("自定义")
642 | # label_sizesm
643 | self.tab4.label_sizesm = QLabel("大于")
644 | self.tab4.label_sizesm.setFixedWidth(30)
645 | # textbox_sizesm
646 | self.tab4.textbox_sizesm = QLineEdit("0")
647 | self.tab4.textbox_sizesm.setFixedWidth(60)
648 | # combobox_sizesm
649 | self.tab4.combobox_sizesm = QComboBox(self)
650 | self.tab4.combobox_sizesm.setFixedWidth(80)
651 | self.tab4.combobox_sizesm.addItem("KB")
652 | self.tab4.combobox_sizesm.addItem("MB")
653 | self.tab4.combobox_sizesm.addItem("GB")
654 | # label_sizebg
655 | self.tab4.label_sizebg = QLabel("小于")
656 | self.tab4.label_sizebg.setFixedWidth(30)
657 | # textbox_sizebg
658 | self.tab4.textbox_sizebg = QLineEdit("512")
659 | self.tab4.textbox_sizebg.setFixedWidth(60)
660 | # combobox_sizebg
661 | self.tab4.combobox_sizebg = QComboBox(self)
662 | self.tab4.combobox_sizebg.setFixedWidth(80)
663 | self.tab4.combobox_sizebg.addItem("KB")
664 | self.tab4.combobox_sizebg.addItem("MB")
665 | self.tab4.combobox_sizebg.addItem("GB")
666 | self.tab4.combobox_sizebg.setCurrentIndex(1)
667 | # label_searchtime
668 | self.tab4.label_searchtime = QLabel("修改时间:")
669 | # buttongroup_searchtime
670 | self.tab4.buttongroup_searchtime = QButtonGroup(self)
671 | # radiobutton_timeoff
672 | self.tab4.radiobutton_timeoff = QRadioButton("无限制")
673 | self.tab4.radiobutton_timeoff.setChecked(True)
674 | # radiobutton_timeon
675 | self.tab4.radiobutton_timeon = QRadioButton("自定义")
676 | # label_timesm
677 | self.tab4.label_timesm = QLabel("大于")
678 | self.tab4.label_timesm.setFixedWidth(30)
679 | # datetime_timesm
680 | self.tab4.datetime_timesm = QDateTimeEdit(self)
681 | self.tab4.datetime_timesm.setCalendarPopup(True)
682 | self.tab4.datetime_timesm_dt = QDateTime()
683 | self.tab4.datetime_timesm_dt.setTime_t(time.time() - 1296000)
684 | self.tab4.datetime_timesm.setDateTime(self.tab2.datetime_timesm_dt)
685 | # label_timebg
686 | self.tab4.label_timebg = QLabel("小于")
687 | self.tab4.label_timebg.setFixedWidth(30)
688 | # datetime_timebg
689 | self.tab4.datetime_timebg = QDateTimeEdit(self)
690 | self.tab4.datetime_timebg.setCalendarPopup(True)
691 | self.tab4.datetime_timebg_dt = QDateTime()
692 | self.tab4.datetime_timebg_dt.setTime_t(time.time())
693 | self.tab4.datetime_timebg.setDateTime(self.tab2.datetime_timebg_dt)
694 | # label_searchresult
695 | self.tab4.label_searchresult = QLabel("搜索结果:")
696 | # list_searchresult
697 | self.tab4.list_searchresult = QListWidget(self)
698 | # Add widgets to tab
699 | self.tab4.layout1 = QHBoxLayout(self)
700 | self.tab4.layout2 = QHBoxLayout(self)
701 | self.tab4.layout3 = QHBoxLayout(self)
702 | self.tab4.layout4 = QHBoxLayout(self)
703 | self.tab4.layout5 = QHBoxLayout(self)
704 | self.tab4.layout6 = QHBoxLayout(self)
705 | self.tab4.layout1.addWidget(self.tab4.label_searchdir)
706 | self.tab4.layout1.addWidget(self.tab4.textbox_searchdir)
707 | self.tab4.layout1.addWidget(self.tab4.button_searchdir)
708 | self.tab4.layout2.addWidget(self.tab4.label_searchpic)
709 | self.tab4.layout2.addWidget(self.tab4.textbox_search)
710 | self.tab4.layout2.addWidget(self.tab4.button_searchpic)
711 | self.tab4.layout2.addWidget(self.tab4.button_search)
712 | self.tab4.layout3.addWidget(self.tab4.label_searchsize)
713 | self.tab4.buttongroup_searchsize.addButton(self.tab4.radiobutton_sizeoff)
714 | self.tab4.buttongroup_searchsize.addButton(self.tab4.radiobutton_sizeon)
715 | self.tab4.layout3.addWidget(self.tab4.radiobutton_sizeoff)
716 | self.tab4.layout3.addWidget(self.tab4.radiobutton_sizeon)
717 | self.tab4.layout3.addWidget(self.tab4.label_sizesm)
718 | self.tab4.layout3.addWidget(self.tab4.textbox_sizesm)
719 | self.tab4.layout3.addWidget(self.tab4.combobox_sizesm)
720 | self.tab4.layout3.addWidget(self.tab4.label_sizebg)
721 | self.tab4.layout3.addWidget(self.tab4.textbox_sizebg)
722 | self.tab4.layout3.addWidget(self.tab4.combobox_sizebg)
723 | self.tab4.layout4.addWidget(self.tab4.label_searchtime)
724 | self.tab4.buttongroup_searchtime.addButton(self.tab4.radiobutton_timeoff)
725 | self.tab4.buttongroup_searchtime.addButton(self.tab4.radiobutton_timeon)
726 | self.tab4.layout4.addWidget(self.tab4.radiobutton_timeoff)
727 | self.tab4.layout4.addWidget(self.tab4.radiobutton_timeon)
728 | self.tab4.layout4.addWidget(self.tab4.label_timesm)
729 | self.tab4.layout4.addWidget(self.tab4.datetime_timesm)
730 | self.tab4.layout4.addWidget(self.tab4.label_timebg)
731 | self.tab4.layout4.addWidget(self.tab4.datetime_timebg)
732 | self.tab4.layout5.addWidget(self.tab4.label_searchresult)
733 | self.tab4.layout6.addWidget(self.tab4.list_searchresult)
734 | self.tab4.layout.addLayout(self.tab4.layout1)
735 | self.tab4.layout.addLayout(self.tab4.layout2)
736 | self.tab4.layout.addLayout(self.tab4.layout3)
737 | self.tab4.layout.addLayout(self.tab4.layout4)
738 | self.tab4.layout.addStretch()
739 | self.tab4.layout.addLayout(self.tab4.layout5)
740 | self.tab4.layout.addLayout(self.tab4.layout6)
741 | self.tab4.layout.addStretch()
742 | self.tab4.setLayout(self.tab4.layout)
743 |
744 | # Tab 5
745 | self.tab5.layout = QVBoxLayout(self)
746 | # label_recoverfile
747 | self.tab5.label_recoverfile = QLabel("镜像文件:")
748 | # textbox_recoverfile
749 | self.tab5.textbox_recoverfile = QLineEdit(self)
750 | # button_recoverfile
751 | self.tab5.button_recoverfile = QPushButton("选择文件")
752 | self.tab5.button_recoverfile.clicked.connect(self.tab5_recoverfile_click)
753 | # label_recoverdir
754 | self.tab5.label_recoverdir = QLabel("输出目录:")
755 | # textbox_recoverdir
756 | self.tab5.textbox_recoverdir = QLineEdit(self)
757 | # button_recoverdir
758 | self.tab5.button_recoverdir = QPushButton("选择目录")
759 | self.tab5.button_recoverdir.clicked.connect(self.tab5_recoverdir_click)
760 | # button_recover
761 | self.tab5.button_recover = QPushButton("恢复")
762 | self.tab5.button_recover.clicked.connect(self.tab5_recover_click)
763 | # label_recoveroption
764 | self.tab5.label_recoveroption = QLabel("选项:")
765 | # checkbox_indirect
766 | self.tab5.checkbox_indirect = QCheckBox("间接块检测(仅支持UNIX文件系统)")
767 | # checkbox_corrupted
768 | self.tab5.checkbox_corrupted = QCheckBox("写出所有文件头(无纠错检测)")
769 | # checkbox_quick
770 | self.tab5.checkbox_quick = QCheckBox("快速模式(按512字节搜索)")
771 | # label_recovertype
772 | self.tab5.label_recovertype = QLabel("类型:")
773 | # buttongroup_recovertype
774 | self.tab5.buttongroup_recovertype = QButtonGroup(self)
775 | # radiobutton_all
776 | self.tab5.radiobutton_all = QRadioButton("所有已知")
777 | self.tab5.radiobutton_all.setChecked(True)
778 | # radiobutton_image
779 | self.tab5.radiobutton_image = QRadioButton("图片")
780 | # radiobutton_media
781 | self.tab5.radiobutton_media = QRadioButton("音视频")
782 | # radiobutton_document
783 | self.tab5.radiobutton_document = QRadioButton("文档")
784 | # radiobutton_other
785 | self.tab5.radiobutton_other = QRadioButton("其它")
786 | # label_recovertype_empty
787 | self.tab5.label_recovertype_empty = QLabel(self)
788 | self.tab5.label_recovertype_empty.setFixedWidth(200)
789 | # list_recovertype_image
790 | self.tab5.list_recovertype_image = QListWidget(self)
791 | self.tab5.list_recovertype_image.setFixedWidth(100)
792 | self.tab5.list_recovertype_image.setFixedHeight(120)
793 | self.tab5.list_recovertype_image.setSelectionMode(2)
794 | for i in recover_image_format:
795 | self.tab5.list_recovertype_image.addItem(i)
796 | # list_recovertype_media
797 | self.tab5.list_recovertype_media = QListWidget(self)
798 | self.tab5.list_recovertype_media.setFixedWidth(100)
799 | self.tab5.list_recovertype_media.setFixedHeight(120)
800 | self.tab5.list_recovertype_media.setSelectionMode(2)
801 | for i in recover_media_format:
802 | self.tab5.list_recovertype_media.addItem(i)
803 | # list_recovertype_document
804 | self.tab5.list_recovertype_document = QListWidget(self)
805 | self.tab5.list_recovertype_document.setFixedWidth(100)
806 | self.tab5.list_recovertype_document.setFixedHeight(120)
807 | self.tab5.list_recovertype_document.setSelectionMode(2)
808 | for i in recover_document_format:
809 | self.tab5.list_recovertype_document.addItem(i)
810 | # list_recovertype_other
811 | self.tab5.list_recovertype_other = QListWidget(self)
812 | self.tab5.list_recovertype_other.setFixedWidth(100)
813 | self.tab5.list_recovertype_other.setFixedHeight(120)
814 | self.tab5.list_recovertype_other.setSelectionMode(2)
815 | for i in recover_other_format:
816 | self.tab5.list_recovertype_other.addItem(i)
817 | # label_recoverresult
818 | self.tab5.label_recoverresult = QLabel("恢复结果:")
819 | # list_recoverresult
820 | self.tab5.list_recoverresult = QListWidget(self)
821 | # Add widgets to tab
822 | self.tab5.layout1 = QHBoxLayout(self)
823 | self.tab5.layout2 = QHBoxLayout(self)
824 | self.tab5.layout3 = QHBoxLayout(self)
825 | self.tab5.layout4 = QHBoxLayout(self)
826 | self.tab5.layout5 = QHBoxLayout(self)
827 | self.tab5.layout6 = QHBoxLayout(self)
828 | self.tab5.layout7 = QHBoxLayout(self)
829 | self.tab5.layout1.addWidget(self.tab5.label_recoverfile)
830 | self.tab5.layout1.addWidget(self.tab5.textbox_recoverfile)
831 | self.tab5.layout1.addWidget(self.tab5.button_recoverfile)
832 | self.tab5.layout2.addWidget(self.tab5.label_recoverdir)
833 | self.tab5.layout2.addWidget(self.tab5.textbox_recoverdir)
834 | self.tab5.layout2.addWidget(self.tab5.button_recoverdir)
835 | self.tab5.layout2.addWidget(self.tab5.button_recover)
836 | self.tab5.layout3.addWidget(self.tab5.label_recoveroption)
837 | self.tab5.layout3.addWidget(self.tab5.checkbox_indirect)
838 | self.tab5.layout3.addWidget(self.tab5.checkbox_corrupted)
839 | self.tab5.layout3.addWidget(self.tab5.checkbox_quick)
840 | self.tab5.layout4.addWidget(self.tab5.label_recovertype)
841 | self.tab5.buttongroup_recovertype.addButton(self.tab5.radiobutton_all)
842 | self.tab5.buttongroup_recovertype.addButton(self.tab5.radiobutton_image)
843 | self.tab5.buttongroup_recovertype.addButton(self.tab5.radiobutton_media)
844 | self.tab5.buttongroup_recovertype.addButton(self.tab5.radiobutton_document)
845 | self.tab5.buttongroup_recovertype.addButton(self.tab5.radiobutton_other)
846 | self.tab5.layout4.addWidget(self.tab5.radiobutton_all)
847 | self.tab5.layout4.addWidget(self.tab5.radiobutton_image)
848 | self.tab5.layout4.addWidget(self.tab5.radiobutton_media)
849 | self.tab5.layout4.addWidget(self.tab5.radiobutton_document)
850 | self.tab5.layout4.addWidget(self.tab5.radiobutton_other)
851 | self.tab5.layout5.addWidget(self.tab5.label_recovertype_empty)
852 | self.tab5.layout5.addWidget(self.tab5.list_recovertype_image)
853 | self.tab5.layout5.addWidget(self.tab5.list_recovertype_media)
854 | self.tab5.layout5.addWidget(self.tab5.list_recovertype_document)
855 | self.tab5.layout5.addWidget(self.tab5.list_recovertype_other)
856 | self.tab5.layout6.addWidget(self.tab5.label_recoverresult)
857 | self.tab5.layout7.addWidget(self.tab5.list_recoverresult)
858 | self.tab5.layout.addLayout(self.tab5.layout1)
859 | self.tab5.layout.addLayout(self.tab5.layout2)
860 | self.tab5.layout.addLayout(self.tab5.layout3)
861 | self.tab5.layout.addLayout(self.tab5.layout4)
862 | self.tab5.layout.addLayout(self.tab5.layout5)
863 | self.tab5.layout.addStretch()
864 | self.tab5.layout.addLayout(self.tab5.layout6)
865 | self.tab5.layout.addLayout(self.tab5.layout7)
866 | self.tab5.layout.addStretch()
867 | self.tab5.setLayout(self.tab5.layout)
868 |
869 | # Tab 6
870 | self.tab6.layout = QVBoxLayout(self)
871 | # label_gpsdir
872 | self.tab6.label_gpsdir = QLabel("目标目录:")
873 | # textbox_gpsdir
874 | self.tab6.textbox_gpsdir = QLineEdit(self)
875 | # button_gpsdir
876 | self.tab6.button_gpsdir = QPushButton("选择目录")
877 | self.tab6.button_gpsdir.clicked.connect(self.tab6_gpsdir_click)
878 | # button_search
879 | self.tab6.button_search = QPushButton("搜索")
880 | self.tab6.button_search.clicked.connect(self.tab6_search_click)
881 | # label_searchresult
882 | self.tab6.label_searchresult = QLabel("搜索结果:")
883 | # button_drawmap
884 | self.tab6.button_drawmap = QPushButton("绘制地图")
885 | self.tab6.button_drawmap.clicked.connect(self.tab6_drawmap_click)
886 | self.tab6.button_drawmap.setFixedWidth(120)
887 | # list_searchresult
888 | self.tab6.list_searchresult = QListWidget(self)
889 | self.tab6.list_searchresult.setFixedHeight(150)
890 | # webview_map
891 | self.tab6.webview_map = QWebView(self)
892 | self.tab6.webview_map.load(QUrl(map_url))
893 | self.tab6.webview_map.show()
894 | # Add widgets to tab
895 | self.tab6.layout1 = QHBoxLayout(self)
896 | self.tab6.layout2 = QHBoxLayout(self)
897 | self.tab6.layout3 = QHBoxLayout(self)
898 | self.tab6.layout4 = QHBoxLayout(self)
899 | self.tab6.layout1.addWidget(self.tab6.label_gpsdir)
900 | self.tab6.layout1.addWidget(self.tab6.textbox_gpsdir)
901 | self.tab6.layout1.addWidget(self.tab6.button_gpsdir)
902 | self.tab6.layout1.addWidget(self.tab6.button_search)
903 | self.tab6.layout2.addWidget(self.tab6.label_searchresult)
904 | self.tab6.layout2.addWidget(self.tab6.button_drawmap)
905 | self.tab6.layout3.addWidget(self.tab6.list_searchresult)
906 | self.tab6.layout4.addWidget(self.tab6.webview_map)
907 | self.tab6.layout.addLayout(self.tab6.layout1)
908 | self.tab6.layout.addLayout(self.tab6.layout2)
909 | self.tab6.layout.addLayout(self.tab6.layout3)
910 | self.tab6.layout.addLayout(self.tab6.layout4)
911 | self.tab6.setLayout(self.tab6.layout)
912 |
913 | # Tab 7
914 | self.tab7.layout = QVBoxLayout(self)
915 | # label_searchdir
916 | self.tab7.label_searchdir = QLabel("目标目录:")
917 | # textbox_searchdir
918 | self.tab7.textbox_searchdir = QLineEdit(self)
919 | # button_searchdir
920 | self.tab7.button_searchdir = QPushButton("选择目录")
921 | self.tab7.button_searchdir.clicked.connect(self.tab7_searchdir_click)
922 | # button_search
923 | self.tab7.button_search = QPushButton("搜索")
924 | self.tab7.button_search.clicked.connect(self.tab7_search_click)
925 | # label_searchresult
926 | self.tab7.label_searchresult = QLabel("搜索结果:")
927 | # list_searchresult
928 | self.tab7.list_searchresult = QListWidget(self)
929 | self.tab7.list_searchresult.setFixedHeight(250)
930 | self.tab7.list_searchresult.itemDoubleClicked.connect(self.tab7_searchresult_doubleclick)
931 | # label_wechat
932 | self.tab7.label_wechat = QLabel("微信解密:")
933 | # label_imei
934 | self.tab7.label_imei = QLabel("IMEI:")
935 | # textbox_imei
936 | self.tab7.textbox_imei = QLineEdit(self)
937 | # label_uin
938 | self.tab7.label_uin = QLabel("UIN:")
939 | # textbox_uin
940 | self.tab7.textbox_uin = QLineEdit(self)
941 | # button_wechat
942 | self.tab7.button_wechat = QPushButton("计算密码")
943 | self.tab7.button_wechat.clicked.connect(self.tab7_wechat_click)
944 | # button_wechat_decrypt
945 | self.tab7.button_wechat_decrypt = QPushButton("解密文件")
946 | self.tab7.button_wechat_decrypt.clicked.connect(self.tab7_wechat_decrypt_click)
947 | # Add widgets to tab
948 | self.tab7.layout1 = QHBoxLayout(self)
949 | self.tab7.layout2 = QHBoxLayout(self)
950 | self.tab7.layout3 = QHBoxLayout(self)
951 | self.tab7.layout4 = QHBoxLayout(self)
952 | self.tab7.layout1.addWidget(self.tab7.label_searchdir)
953 | self.tab7.layout1.addWidget(self.tab7.textbox_searchdir)
954 | self.tab7.layout1.addWidget(self.tab7.button_searchdir)
955 | self.tab7.layout1.addWidget(self.tab7.button_search)
956 | self.tab7.layout2.addWidget(self.tab7.label_searchresult)
957 | self.tab7.layout3.addWidget(self.tab7.list_searchresult)
958 | self.tab7.layout4.addWidget(self.tab7.label_wechat)
959 | self.tab7.layout4.addWidget(self.tab7.label_imei)
960 | self.tab7.layout4.addWidget(self.tab7.textbox_imei)
961 | self.tab7.layout4.addWidget(self.tab7.label_uin)
962 | self.tab7.layout4.addWidget(self.tab7.textbox_uin)
963 | self.tab7.layout4.addWidget(self.tab7.button_wechat)
964 | self.tab7.layout4.addWidget(self.tab7.button_wechat_decrypt)
965 | self.tab7.layout.addLayout(self.tab7.layout1)
966 | self.tab7.layout.addLayout(self.tab7.layout2)
967 | self.tab7.layout.addLayout(self.tab7.layout3)
968 | self.tab7.layout.addLayout(self.tab7.layout4)
969 | self.tab7.layout.addStretch()
970 | self.tab7.setLayout(self.tab7.layout)
971 |
972 | # Add tabs to widget
973 | self.layout.addWidget(self.tabs)
974 | self.setLayout(self.layout)
975 |
976 | # Tab Event
977 | self.tabs.currentChanged.connect(self.tabChanged)
978 |
979 | # Init Method
980 | self.tab1_refreshmount()
981 |
982 | def tabChanged(self):
983 | map_hideCpy(self.tab6.webview_map)
984 |
985 | def tab1_adb_click(self):
986 | saveFilePath = str(QFileDialog.getSaveFileName(self,"Save File","./","All Files (*)")[0])
987 | if saveFilePath:
988 | tab1_form1 = saveFilePath
989 | msgBox = QMessageBox()
990 | msgBox.setIcon(QMessageBox.Information)
991 | msgBox.setWindowTitle(' ')
992 | msgBox.setText('
提取中...
')
993 | msgBox.setStandardButtons(QMessageBox.Ok)
994 | okButton = msgBox.button(QMessageBox.Ok)
995 | okButton.setText(' 取消 ')
996 | c = Tab1ADBThread()
997 | t = threading.Thread(target=c.run, args=(msgBox, tab1_form1))
998 | t.start()
999 | msgBox.exec_()
1000 | if msgBox.clickedButton() == okButton: c.terminate()
1001 |
1002 | def tab1_openfile_click(self):
1003 | global openFilePath, openFileName, pt_offset, pt_sector, pt_type, pt_name
1004 | openFilePath = str(QFileDialog.getOpenFileName(self,"Select File","./","All Files (*)")[0])
1005 | if openFilePath:
1006 | openFileName = os.path.basename(openFilePath)
1007 | pt_offset = []
1008 | pt_sector = []
1009 | pt_type = []
1010 | pt_name = []
1011 | self.tab1.list_filedetail.clear()
1012 | sectorsize = int(self.tab1.textbox_sectorsize.text())
1013 | sectoroffset = int(self.tab1.textbox_sectoroffset.text())
1014 | findMBR(openFilePath,sectorsize,sectoroffset)
1015 | for i in range(len(pt_offset)):
1016 | sector_size = float(pt_sector[i])*sectorsize/1000/1000
1017 | sector = "%.2fMB" % sector_size
1018 | if sector_size > 1000:
1019 | sector_size = float(sector_size/1000)
1020 | sector = "%.2fGB" % sector_size
1021 | self.tab1.list_filedetail.addItem(pt_type[i]+" ["+pt_name[i]+"] "+sector)
1022 |
1023 | def tab1_savefile_click(self):
1024 | if len(pt_offset) < 1: return
1025 | selectItems = self.tab1.list_filedetail.selectedItems()
1026 | if len(selectItems) < 1: return
1027 | saveFilePath = str(QFileDialog.getSaveFileName(self,"Save File","./","All Files (*)")[0])
1028 | if saveFilePath:
1029 | ptId = int(self.tab1.list_filedetail.row(selectItems[0]))
1030 | tab1_form1 = openFilePath
1031 | tab1_form2 = saveFilePath
1032 | tab1_form3 = str(pt_offset[ptId])
1033 | tab1_form4 = str(pt_sector[ptId])
1034 | msgBox = QMessageBox()
1035 | msgBox.setIcon(QMessageBox.Information)
1036 | msgBox.setWindowTitle(' ')
1037 | msgBox.setText('
保存中...
')
1038 | msgBox.setStandardButtons(QMessageBox.Ok)
1039 | okButton = msgBox.button(QMessageBox.Ok)
1040 | okButton.setText(' 取消 ')
1041 | c = Tab1SaveFileThread()
1042 | t = threading.Thread(target=c.run, args=(msgBox, tab1_form1, tab1_form2, tab1_form3, tab1_form4))
1043 | t.start()
1044 | msgBox.exec_()
1045 | if msgBox.clickedButton() == okButton: c.terminate()
1046 |
1047 | def tab1_repairfile_click(self):
1048 | imageFilePath = str(QFileDialog.getOpenFileName(self,"Select Image File","./","All Files (*)")[0])
1049 | if imageFilePath:
1050 | offset = int(self.tab1.textbox_sectoroffset.text())
1051 | sector = int(self.tab1.textbox_sectorsize.text())
1052 | blocksize_unit = int(self.tab1.textbox_blocksize.text())
1053 | fd = open(imageFilePath,'rb')
1054 | fd.seek(offset*sector)
1055 | dbr = fd.read(sector*3)
1056 | fd.close()
1057 | blocksize = calcLen(dbr[sector*2+4:sector*2+8])
1058 | os.system("truncate -s "+str(blocksize*blocksize_unit)+" "+imageFilePath)
1059 | os.system("fsck."+self.tab1.textbox_repairfs.text()+" -y "+imageFilePath)
1060 |
1061 | def tab1_mountfile_click(self):
1062 | mountFilePath = str(QFileDialog.getOpenFileName(self,"Select Mount File","./","All Files (*)")[0])
1063 | if len(mountFilePath) < 1: return
1064 | mountPath = str(QFileDialog.getExistingDirectory(self,"Select Mount Directory","./"))
1065 | if mountPath:
1066 | os.system("mount "+self.tab1.textbox_mountparams.text()+" "+mountFilePath+" "+mountPath)
1067 | self.tab1_refreshmount()
1068 |
1069 | def tab1_umountdrive_click(self):
1070 | selectItems = self.tab1.list_mountdetail.selectedItems()
1071 | if len(selectItems) < 1: return
1072 | mountId = int(self.tab1.list_mountdetail.row(selectItems[0]))
1073 | os.system("umount "+mount_path[mountId])
1074 | self.tab1_refreshmount()
1075 |
1076 | def tab1_refreshmount(self):
1077 | global mount_dev, mount_path
1078 | self.tab1.list_mountdetail.clear()
1079 | mount_dev = []
1080 | mount_path = []
1081 | p = os.popen('mount')
1082 | for line in p.readlines():
1083 | temp = line.split(' ')
1084 | if len(temp) < 3: continue
1085 | if '/' in temp[0] and '/dev/sd' not in temp[0]:
1086 | mount_dev.append(temp[0])
1087 | mount_path.append(temp[2])
1088 | self.tab1.list_mountdetail.addItem("%s on %s" % (temp[0], temp[2]) )
1089 | p.close()
1090 |
1091 | def tab2_searchdir_click(self):
1092 | searchdir = str(QFileDialog.getExistingDirectory(self,"Select Search Directory","./"))
1093 | if searchdir:
1094 | self.tab2.textbox_searchdir.setText(searchdir)
1095 |
1096 | def tab2_search_click(self):
1097 | tab2_form1 = self.tab2.textbox_searchdir.text()
1098 | tab2_form2 = self.tab2.textbox_search.text()
1099 | tab2_form3 = self.tab2.radiobutton_string.isChecked()
1100 | tab2_form4 = self.tab2.radiobutton_hex.isChecked()
1101 | tab2_form5 = self.tab2.radiobutton_sizeoff.isChecked()
1102 | tab2_form6 = self.tab2.radiobutton_sizeon.isChecked()
1103 | tab2_form7 = self.tab2.textbox_sizesm.text()
1104 | tab2_form8 = self.tab2.combobox_sizesm.currentIndex()
1105 | tab2_form9 = self.tab2.textbox_sizebg.text()
1106 | tab2_form10 = self.tab2.combobox_sizebg.currentIndex()
1107 | tab2_form11 = self.tab2.radiobutton_timeoff.isChecked()
1108 | tab2_form12 = self.tab2.radiobutton_timeon.isChecked()
1109 | tab2_form13 = self.tab2.datetime_timesm.dateTime().toTime_t()
1110 | tab2_form14 = self.tab2.datetime_timebg.dateTime().toTime_t()
1111 | if not os.path.exists(tab2_form1):
1112 | QMessageBox.information(self, ' ', '搜索目录不存在')
1113 | return
1114 | if not tab2_form2:
1115 | QMessageBox.information(self, ' ', '请输入关键词')
1116 | return
1117 | if not tab2_form3 and not tab2_form4:
1118 | QMessageBox.information(self, ' ', '请选择类型')
1119 | return
1120 | if not tab2_form5 and not tab2_form6:
1121 | QMessageBox.information(self, ' ', '请选择大小')
1122 | return
1123 | if tab2_form6:
1124 | form6_correct = True
1125 | tab2_form7 = int(tab2_form7)
1126 | tab2_form9 = int(tab2_form9)
1127 | if tab2_form7 < 0 or tab2_form9 <= 0: form6_correct = False
1128 | for i in range(tab2_form8 + 1): tab2_form7 = tab2_form7 * 1024
1129 | for i in range(tab2_form10 + 1): tab2_form9 = tab2_form9 * 1024
1130 | if tab2_form7 > tab2_form9: form6_correct = False
1131 | if not form6_correct:
1132 | QMessageBox.information(self, ' ', '请正确输入大小范围')
1133 | return
1134 | if not tab2_form11 and not tab2_form12:
1135 | QMessageBox.information(self, ' ', '请选择修改时间')
1136 | return
1137 | if tab2_form12:
1138 | form12_correct = True
1139 | if tab2_form13 <= 0 or tab2_form14 <= 0: form12_correct = False
1140 | if tab2_form13 > tab2_form14: form12_correct = False
1141 | if not form12_correct:
1142 | QMessageBox.information(self, ' ', '请正确输入修改时间范围')
1143 | return
1144 | if tab2_form3: tab2_form3 = 1
1145 | if tab2_form4: tab2_form3 = 2
1146 | if tab2_form5: tab2_form4 = 1
1147 | if tab2_form6: tab2_form4 = 2
1148 | tab2_form5 = 0
1149 | tab2_form6 = 0
1150 | if tab2_form4 == 2:
1151 | tab2_form5 = tab2_form7
1152 | tab2_form6 = tab2_form9
1153 | if tab2_form11: tab2_form7 = 1
1154 | if tab2_form12: tab2_form7 = 2
1155 | tab2_form8 = 0
1156 | tab2_form9 = 0
1157 | if tab2_form7 == 2:
1158 | tab2_form8 = tab2_form13
1159 | tab2_form9 = tab2_form14
1160 | tab2_form10 = self.tab2.list_searchresult
1161 | msgBox = QMessageBox()
1162 | msgBox.setIcon(QMessageBox.Information)
1163 | msgBox.setWindowTitle(' ')
1164 | msgBox.setText('
搜素中...
')
1165 | msgBox.setStandardButtons(QMessageBox.Ok)
1166 | okButton = msgBox.button(QMessageBox.Ok)
1167 | okButton.setText(' 取消 ')
1168 | c = Tab2SearchThread()
1169 | t = threading.Thread(target=c.run, args=(msgBox, tab2_form1, tab2_form2, tab2_form3, tab2_form4, tab2_form5, tab2_form6, tab2_form7, tab2_form8, tab2_form9, tab2_form10))
1170 | t.start()
1171 | msgBox.exec_()
1172 | if msgBox.clickedButton() == okButton: c.terminate()
1173 |
1174 | def tab3_searchdir_click(self):
1175 | searchdir = str(QFileDialog.getExistingDirectory(self,"Select Search Directory","./"))
1176 | if searchdir:
1177 | self.tab3.textbox_searchdir.setText(searchdir)
1178 |
1179 | def tab3_search_click(self):
1180 | tab3_form1 = self.tab3.textbox_searchdir.text()
1181 | tab3_form2 = self.tab3.radiobutton_image.isChecked()
1182 | tab3_form3 = self.tab3.radiobutton_audio.isChecked()
1183 | tab3_form4 = self.tab3.radiobutton_video.isChecked()
1184 | tab3_form5 = self.tab3.combobox_image.currentIndex()
1185 | tab3_form6 = self.tab3.combobox_audio.currentIndex()
1186 | tab3_form7 = self.tab3.combobox_video.currentIndex()
1187 | tab3_form8 = self.tab3.radiobutton_sizeoff.isChecked()
1188 | tab3_form9 = self.tab3.radiobutton_sizeon.isChecked()
1189 | tab3_form10 = self.tab3.textbox_sizesm.text()
1190 | tab3_form11 = self.tab3.combobox_sizesm.currentIndex()
1191 | tab3_form12 = self.tab3.textbox_sizebg.text()
1192 | tab3_form13 = self.tab3.combobox_sizebg.currentIndex()
1193 | tab3_form14 = self.tab3.radiobutton_timeoff.isChecked()
1194 | tab3_form15 = self.tab3.radiobutton_timeon.isChecked()
1195 | tab3_form16 = self.tab3.datetime_timesm.dateTime().toTime_t()
1196 | tab3_form17 = self.tab3.datetime_timebg.dateTime().toTime_t()
1197 | if not os.path.exists(tab3_form1):
1198 | QMessageBox.information(self, ' ', '搜索目录不存在')
1199 | return
1200 | if not tab3_form2 and not tab3_form3 and not tab3_form4:
1201 | QMessageBox.information(self, ' ', '请选择类型')
1202 | return
1203 | if not tab3_form8 and not tab3_form9:
1204 | QMessageBox.information(self, ' ', '请选择大小')
1205 | return
1206 | if tab3_form9:
1207 | form9_correct = True
1208 | tab3_form10 = int(tab3_form10)
1209 | tab3_form12 = int(tab3_form12)
1210 | if tab3_form10 < 0 or tab3_form12 <= 0: form9_correct = False
1211 | for i in range(tab3_form11 + 1): tab3_form10 = tab3_form10 * 1024
1212 | for i in range(tab3_form13 + 1): tab3_form12 = tab3_form12 * 1024
1213 | if tab3_form10 > tab3_form12: form9_correct = False
1214 | if not form9_correct:
1215 | QMessageBox.information(self, ' ', '请正确输入大小范围')
1216 | return
1217 | if not tab3_form14 and not tab3_form15:
1218 | QMessageBox.information(self, ' ', '请选择修改时间')
1219 | return
1220 | if tab3_form15:
1221 | form15_correct = True
1222 | if tab3_form16 <= 0 or tab3_form17 <= 0: form15_correct = False
1223 | if tab3_form16 > tab3_form17: form15_correct = False
1224 | if not form15_correct:
1225 | QMessageBox.information(self, ' ', '请正确输入修改时间范围')
1226 | return
1227 | if tab3_form2:
1228 | tab3_form2 = 1
1229 | tab3_form3 = tab3_form5
1230 | elif tab3_form3:
1231 | tab3_form2 = 2
1232 | tab3_form3 = tab3_form6
1233 | elif tab3_form4:
1234 | tab3_form2 = 3
1235 | tab3_form3 = tab3_form7
1236 | if tab3_form8: tab3_form4 = 1
1237 | if tab3_form9: tab3_form4 = 2
1238 | tab3_form5 = 0
1239 | tab3_form6 = 0
1240 | if tab3_form4 == 2:
1241 | tab3_form5 = tab3_form10
1242 | tab3_form6 = tab3_form12
1243 | if tab3_form14: tab3_form7 = 1
1244 | if tab3_form15: tab3_form7 = 2
1245 | tab3_form8 = 0
1246 | tab3_form9 = 0
1247 | if tab3_form7 == 2:
1248 | tab3_form8 = tab3_form16
1249 | tab3_form9 = tab3_form17
1250 | tab3_form10 = self.tab3.list_searchresult
1251 | msgBox = QMessageBox()
1252 | msgBox.setIcon(QMessageBox.Information)
1253 | msgBox.setWindowTitle(' ')
1254 | msgBox.setText('
搜素中...
')
1255 | msgBox.setStandardButtons(QMessageBox.Ok)
1256 | okButton = msgBox.button(QMessageBox.Ok)
1257 | okButton.setText(' 取消 ')
1258 | c = Tab3SearchThread()
1259 | t = threading.Thread(target=c.run, args=(msgBox, tab3_form1, tab3_form2, tab3_form3, tab3_form4, tab3_form5, tab3_form6, tab3_form7, tab3_form8, tab3_form9, tab3_form10))
1260 | t.start()
1261 | msgBox.exec_()
1262 | if msgBox.clickedButton() == okButton: c.terminate()
1263 |
1264 | def tab4_searchdir_click(self):
1265 | searchdir = str(QFileDialog.getExistingDirectory(self,"Select Search Directory","./"))
1266 | if searchdir:
1267 | self.tab4.textbox_searchdir.setText(searchdir)
1268 |
1269 | def tab4_searchpic_click(self):
1270 | searchpic = str(QFileDialog.getOpenFileName(self,"Select Source Image","./","All Files (*)")[0])
1271 | if len(searchpic) < 1: return
1272 | self.tab4.textbox_search.setText(searchpic)
1273 |
1274 | def tab4_search_click(self):
1275 | tab4_form1 = self.tab4.textbox_searchdir.text()
1276 | tab4_form2 = self.tab4.textbox_search.text()
1277 | tab4_form3 = self.tab4.radiobutton_sizeoff.isChecked()
1278 | tab4_form4 = self.tab4.radiobutton_sizeon.isChecked()
1279 | tab4_form5 = self.tab4.textbox_sizesm.text()
1280 | tab4_form6 = self.tab4.combobox_sizesm.currentIndex()
1281 | tab4_form7 = self.tab4.textbox_sizebg.text()
1282 | tab4_form8 = self.tab4.combobox_sizebg.currentIndex()
1283 | tab4_form9 = self.tab4.radiobutton_timeoff.isChecked()
1284 | tab4_form10 = self.tab4.radiobutton_timeon.isChecked()
1285 | tab4_form11 = self.tab4.datetime_timesm.dateTime().toTime_t()
1286 | tab4_form12 = self.tab4.datetime_timebg.dateTime().toTime_t()
1287 | if not os.path.exists(tab4_form1):
1288 | QMessageBox.information(self, ' ', '搜索目录不存在')
1289 | return
1290 | if not os.path.exists(tab4_form2):
1291 | QMessageBox.information(self, ' ', '搜索源图片不存在')
1292 | return
1293 | if not tab4_form3 and not tab4_form4:
1294 | QMessageBox.information(self, ' ', '请选择大小')
1295 | return
1296 | if tab4_form4:
1297 | form4_correct = True
1298 | tab4_form5 = int(tab4_form5)
1299 | tab4_form7 = int(tab4_form7)
1300 | if tab4_form5 < 0 or tab4_form7 <= 0: form4_correct = False
1301 | for i in range(tab4_form6 + 1): tab4_form5 = tab4_form5 * 1024
1302 | for i in range(tab4_form8 + 1): tab4_form7 = tab4_form7 * 1024
1303 | if tab4_form5 > tab4_form7: form4_correct = False
1304 | if not form4_correct:
1305 | QMessageBox.information(self, ' ', '请正确输入大小范围')
1306 | return
1307 | if not tab4_form9 and not tab4_form10:
1308 | QMessageBox.information(self, ' ', '请选择修改时间')
1309 | return
1310 | if tab4_form10:
1311 | form10_correct = True
1312 | if tab4_form11 <= 0 or tab4_form12 <= 0: form10_correct = False
1313 | if tab4_form11 > tab4_form12: form10_correct = False
1314 | if not form10_correct:
1315 | QMessageBox.information(self, ' ', '请正确输入修改时间范围')
1316 | return
1317 | if tab4_form3: tab4_form3 = 1
1318 | if tab4_form4: tab4_form3 = 2
1319 | tab4_form4 = 0
1320 | tab4_form5 = 0
1321 | if tab4_form3 == 2:
1322 | tab4_form4 = tab4_form5
1323 | tab4_form5 = tab4_form7
1324 | if tab4_form9: tab4_form6 = 1
1325 | if tab4_form10: tab4_form6 = 2
1326 | tab4_form7 = 0
1327 | tab4_form8 = 0
1328 | if tab4_form6 == 2:
1329 | tab4_form7 = tab4_form11
1330 | tab4_form8 = tab4_form12
1331 | tab4_form9 = self.tab4.list_searchresult
1332 | msgBox = QMessageBox()
1333 | msgBox.setIcon(QMessageBox.Information)
1334 | msgBox.setWindowTitle(' ')
1335 | msgBox.setText('
搜素中...
')
1336 | msgBox.setStandardButtons(QMessageBox.Ok)
1337 | okButton = msgBox.button(QMessageBox.Ok)
1338 | okButton.setText(' 取消 ')
1339 | c = Tab4SearchThread()
1340 | t = threading.Thread(target=c.run, args=(msgBox, tab4_form1, tab4_form2, tab4_form3, tab4_form4, tab4_form5, tab4_form6, tab4_form7, tab4_form8, tab4_form9))
1341 | t.start()
1342 | msgBox.exec_()
1343 | if msgBox.clickedButton() == okButton: c.terminate()
1344 |
1345 | def tab5_recoverfile_click(self):
1346 | recoverfile = str(QFileDialog.getOpenFileName(self,"Select Image File","./","All Files (*)")[0])
1347 | if len(recoverfile) < 1: return
1348 | self.tab5.textbox_recoverfile.setText(recoverfile)
1349 |
1350 | def tab5_recoverdir_click(self):
1351 | recoverdir = str(QFileDialog.getExistingDirectory(self,"Select Recover Output Directory","./"))
1352 | if recoverdir:
1353 | self.tab5.textbox_recoverdir.setText(recoverdir)
1354 |
1355 | def tab5_recover_click(self):
1356 | tab5_form1 = self.tab5.textbox_recoverfile.text()
1357 | tab5_form2 = self.tab5.textbox_recoverdir.text()
1358 | tab5_form3 = self.tab5.checkbox_indirect.isChecked()
1359 | tab5_form4 = self.tab5.checkbox_corrupted.isChecked()
1360 | tab5_form5 = self.tab5.checkbox_quick.isChecked()
1361 | tab5_form6 = self.tab5.radiobutton_all.isChecked()
1362 | tab5_form7 = self.tab5.radiobutton_image.isChecked()
1363 | tab5_form8 = self.tab5.radiobutton_media.isChecked()
1364 | tab5_form9 = self.tab5.radiobutton_document.isChecked()
1365 | tab5_form10 = self.tab5.radiobutton_other.isChecked()
1366 | tab5_form11 = self.tab5.list_recovertype_image.selectedItems()
1367 | tab5_form12 = self.tab5.list_recovertype_media.selectedItems()
1368 | tab5_form13 = self.tab5.list_recovertype_document.selectedItems()
1369 | tab5_form14 = self.tab5.list_recovertype_other.selectedItems()
1370 | if not os.path.exists(tab5_form1):
1371 | QMessageBox.information(self, ' ', '镜像文件不存在')
1372 | return
1373 | if not os.path.exists(tab5_form2):
1374 | QMessageBox.information(self, ' ', '输出目录不存在')
1375 | return
1376 | if not tab5_form6 and not tab5_form7 and not tab5_form8 and not tab5_form9 and not tab5_form10:
1377 | QMessageBox.information(self, ' ', '请选择类型')
1378 | return
1379 | if tab5_form6: tab5_form6 = 1
1380 | if tab5_form7: tab5_form6 = 2
1381 | if tab5_form8: tab5_form6 = 3
1382 | if tab5_form9: tab5_form6 = 4
1383 | if tab5_form10: tab5_form6 = 5
1384 | tab5_form7 = ""
1385 | if tab5_form6 == 2:
1386 | if len(tab5_form11) > 0:
1387 | tab5_form11_text = []
1388 | for i in tab5_form11:
1389 | tab5_form11_text.append(i.text())
1390 | tab5_form7 = ','.join(tab5_form11_text)
1391 | else:
1392 | tab5_form7 = ','.join(recover_image_format)
1393 | if tab5_form6 == 3:
1394 | if len(tab5_form12) > 0:
1395 | tab5_form12_text = []
1396 | for i in tab5_form12:
1397 | tab5_form12_text.append(i.text())
1398 | tab5_form7 = ','.join(tab5_form12_text)
1399 | else:
1400 | tab5_form7 = ','.join(recover_media_format)
1401 | if tab5_form6 == 4:
1402 | if len(tab5_form13) > 0:
1403 | tab5_form13_text = []
1404 | for i in tab5_form13:
1405 | tab5_form13_text.append(i.text())
1406 | tab5_form7 = ','.join(tab5_form13_text)
1407 | else:
1408 | tab5_form7 = ','.join(recover_document_format)
1409 | if tab5_form6 == 5:
1410 | if len(tab5_form14) > 0:
1411 | tab5_form14_text = []
1412 | for i in tab5_form14:
1413 | tab5_form14_text.append(i.text())
1414 | tab5_form7 = ','.join(tab5_form14_text)
1415 | else:
1416 | tab5_form7 = ','.join(recover_other_format)
1417 | tab5_form8 = self.tab5.list_recoverresult
1418 | msgBox = QMessageBox()
1419 | msgBox.setIcon(QMessageBox.Information)
1420 | msgBox.setWindowTitle(' ')
1421 | msgBox.setText('
恢复中...
')
1422 | msgBox.setStandardButtons(QMessageBox.Ok)
1423 | okButton = msgBox.button(QMessageBox.Ok)
1424 | okButton.setText(' 取消 ')
1425 | c = Tab5RecoverThread()
1426 | t = threading.Thread(target=c.run, args=(msgBox, tab5_form1, tab5_form2, tab5_form3, tab5_form4, tab5_form5, tab5_form6, tab5_form7, tab5_form8))
1427 | t.start()
1428 | msgBox.exec_()
1429 | if msgBox.clickedButton() == okButton: c.terminate()
1430 |
1431 | def tab6_gpsdir_click(self):
1432 | gpsdir = str(QFileDialog.getExistingDirectory(self,"Select Target Directory","./"))
1433 | if gpsdir:
1434 | self.tab6.textbox_gpsdir.setText(gpsdir)
1435 |
1436 | def tab6_search_click(self):
1437 | tab6_form1 = self.tab6.textbox_gpsdir.text()
1438 | if not os.path.exists(tab6_form1):
1439 | QMessageBox.information(self, ' ', '目标目录不存在')
1440 | return
1441 | tab6_form2 = self.tab6.list_searchresult
1442 | tab6_form3 = self.tab6.webview_map
1443 | map_data = []
1444 | tab6_form3.page().mainFrame().evaluateJavaScript("map.clearOverlays();")
1445 | msgBox = QMessageBox()
1446 | msgBox.setIcon(QMessageBox.Information)
1447 | msgBox.setWindowTitle(' ')
1448 | msgBox.setText('
搜索中...
')
1449 | msgBox.setStandardButtons(QMessageBox.Ok)
1450 | okButton = msgBox.button(QMessageBox.Ok)
1451 | okButton.setText(' 取消 ')
1452 | c = Tab6GPSThread()
1453 | t = threading.Thread(target=c.run, args=(msgBox, tab6_form1, tab6_form2, tab6_form3))
1454 | t.start()
1455 | msgBox.exec_()
1456 | if msgBox.clickedButton() == okButton: c.terminate()
1457 |
1458 | def tab6_drawmap_click(self):
1459 | if len(map_data) <= 0: return
1460 | webView = self.tab6.webview_map
1461 | webView.page().mainFrame().evaluateJavaScript("map.clearOverlays();")
1462 | map_data_sorted = sorted(map_data, key=lambda metadata: metadata[0])
1463 | pre_metadata = 0
1464 | for metadata in map_data_sorted:
1465 | webView.page().mainFrame().evaluateJavaScript("map.addOverlay(new BMap.Marker(new BMap.Point(%f, %f)));" % (metadata[2], metadata[1]) )
1466 | if pre_metadata != 0:
1467 | webView.page().mainFrame().evaluateJavaScript("map.addOverlay(new BMap.Polyline([new BMap.Point(%f, %f), new BMap.Point(%f, %f)], {strokeColor: 'blue', strokeWeight: 6, strokeOpacity: 0.5}));" % (pre_metadata[2], pre_metadata[1], metadata[2], metadata[1]) )
1468 | pre_metadata = metadata
1469 | center_lat, center_lon = map_getCenter()
1470 | webView.page().mainFrame().evaluateJavaScript("map.centerAndZoom(new BMap.Point(%f, %f), %d);" % (center_lon, center_lat, map_getZoom()) )
1471 |
1472 | def tab7_searchdir_click(self):
1473 | searchdir = str(QFileDialog.getExistingDirectory(self,"Select Search Directory","./"))
1474 | if searchdir:
1475 | self.tab7.textbox_searchdir.setText(searchdir)
1476 |
1477 | def tab7_search_click(self):
1478 | tab7_form1 = self.tab7.textbox_searchdir.text()
1479 | if not os.path.exists(tab7_form1):
1480 | QMessageBox.information(self, ' ', '搜索目录不存在')
1481 | return
1482 | tab7_form2 = self.tab7.list_searchresult
1483 | msgBox = QMessageBox()
1484 | msgBox.setIcon(QMessageBox.Information)
1485 | msgBox.setWindowTitle(' ')
1486 | msgBox.setText('
搜素中...
')
1487 | msgBox.setStandardButtons(QMessageBox.Ok)
1488 | okButton = msgBox.button(QMessageBox.Ok)
1489 | okButton.setText(' 取消 ')
1490 | c = Tab7SearchThread()
1491 | t = threading.Thread(target=c.run, args=(msgBox, tab7_form1, tab7_form2))
1492 | t.start()
1493 | msgBox.exec_()
1494 | if msgBox.clickedButton() == okButton: c.terminate()
1495 |
1496 | def tab7_searchresult_doubleclick(self):
1497 | db_file = self.tab7.list_searchresult.currentItem().text().replace('DB: ','')
1498 | subprocess.Popen(['sqlitebrowser', db_file])
1499 |
1500 | def tab7_wechat_click(self):
1501 | tab7_form1 = self.tab7.textbox_imei.text()
1502 | tab7_form2 = self.tab7.textbox_uin.text()
1503 | if len(tab7_form1.strip()) <= 0:
1504 | QMessageBox.information(self, ' ', '请输入IMEI')
1505 | return
1506 | if len(tab7_form2.strip()) <= 0:
1507 | QMessageBox.information(self, ' ', '请输入UIN')
1508 | return
1509 | tab7_raw = "%s%s" % (tab7_form1.strip(), tab7_form2.strip())
1510 | tab7_md5 = hashlib.md5(tab7_raw.encode('utf-8')).hexdigest()
1511 | QMessageBox.information(self, ' ', '数据库密码:%s' % tab7_md5[:7])
1512 |
1513 | def tab7_wechat_decrypt_click(self):
1514 | tab7_form1 = self.tab7.textbox_imei.text()
1515 | tab7_form2 = self.tab7.textbox_uin.text()
1516 | if len(tab7_form1.strip()) <= 0:
1517 | QMessageBox.information(self, ' ', '请输入IMEI')
1518 | return
1519 | if len(tab7_form2.strip()) <= 0:
1520 | QMessageBox.information(self, ' ', '请输入UIN')
1521 | return
1522 | tab7_form3 = str(QFileDialog.getOpenFileName(self,"Select Encrypted Database File","./","All Files (*)")[0])
1523 | if len(tab7_form3) < 1: return
1524 | tab7_form4 = str(QFileDialog.getSaveFileName(self,"Save Decrypted Database File","./","All Files (*)")[0])
1525 | if not tab7_form4: return
1526 | tab7_raw = "%s%s" % (tab7_form1.strip(), tab7_form2.strip())
1527 | tab7_md5 = hashlib.md5(tab7_raw.encode('utf-8')).hexdigest()
1528 | tab7_form1 = tab7_form3
1529 | tab7_form2 = tab7_md5[:7]
1530 | tab7_form3 = tab7_form4
1531 | msgBox = QMessageBox()
1532 | msgBox.setIcon(QMessageBox.Information)
1533 | msgBox.setWindowTitle(' ')
1534 | msgBox.setText('
解密中...
')
1535 | msgBox.setStandardButtons(QMessageBox.Ok)
1536 | okButton = msgBox.button(QMessageBox.Ok)
1537 | okButton.setText(' 取消 ')
1538 | c = Tab7DecryptThread()
1539 | t = threading.Thread(target=c.run, args=(msgBox, tab7_form1, tab7_form2, tab7_form3))
1540 | t.start()
1541 | msgBox.exec_()
1542 | if msgBox.clickedButton() == okButton: c.terminate()
1543 |
1544 | class Tab1ADBThread:
1545 | def __init__(self):
1546 | self._running = True
1547 |
1548 | def terminate(self):
1549 | self._running = False
1550 |
1551 | def run(self, msgbox, saveFilePath):
1552 | time.sleep(1)
1553 | with open(saveFilePath, 'wb') as outfile:
1554 | process = None
1555 | process = subprocess.Popen(['adb', 'shell', 'su', '-c', 'dd if=/dev/block/mmcblk0 2>/dev/null'], stdout=outfile, stderr=subprocess.PIPE)
1556 | while process:
1557 | if not self._running:
1558 | process.kill()
1559 | break
1560 | if process.poll() != None: break
1561 | msgbox.done(0)
1562 |
1563 | class Tab1SaveFileThread:
1564 | def __init__(self):
1565 | self._running = True
1566 |
1567 | def terminate(self):
1568 | self._running = False
1569 |
1570 | def run(self, msgbox, openFilePath, saveFilePath, skipOffset, countSector):
1571 | time.sleep(1)
1572 | process = None
1573 | process = subprocess.Popen(['dd', 'if='+openFilePath, "of="+saveFilePath, "bs=512", "skip="+skipOffset, "count="+countSector], stdout=subprocess.PIPE)
1574 | while process:
1575 | if not self._running:
1576 | process.kill()
1577 | break
1578 | if process.poll() != None: break
1579 | msgbox.done(0)
1580 |
1581 | class Tab2SearchThread:
1582 | def __init__(self):
1583 | self._running = True
1584 |
1585 | def terminate(self):
1586 | self._running = False
1587 |
1588 | def run(self, msgbox, path, keyword, search_type, search_size, size_sm, size_bg, search_time, time_sm, time_bg, listView):
1589 | listView.clear()
1590 | time.sleep(1)
1591 | process = None
1592 | if search_type == 1:
1593 | process = subprocess.Popen(['grep', '-rl', keyword, path], stdout=subprocess.PIPE)
1594 | if search_type == 2:
1595 | if len(keyword) % 2 == 1: keyword = "0" + keyword
1596 | keyword = "\\x" + re.sub(r"(?<=\w)(?=(?:\w\w)+$)", "\\x", keyword)
1597 | process = subprocess.Popen(['grep', '-rlP', "^%s" % keyword, path], stdout=subprocess.PIPE)
1598 | while process:
1599 | if not self._running:
1600 | process.kill()
1601 | break
1602 | fd = process.stdout.fileno()
1603 | fl = fcntl.fcntl(fd, fcntl.F_GETFL)
1604 | fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
1605 | process_readline = str(process.stdout.readline())[2:-3]
1606 | if not process_readline:
1607 | if process.poll() != None: break
1608 | continue
1609 | search_additem = True
1610 | if search_size == 2:
1611 | filesize = os.path.getsize(process_readline)
1612 | if filesize < size_sm or filesize > size_bg:
1613 | search_additem = False
1614 | if search_time == 2:
1615 | filetime = os.path.getmtime(process_readline)
1616 | if filetime < time_sm or filetime > time_bg:
1617 | search_additem = False
1618 | if search_additem:
1619 | listView.insertItem(0, process_readline)
1620 | msgbox.done(0)
1621 |
1622 | class Tab3SearchThread:
1623 | def __init__(self):
1624 | self._running = True
1625 |
1626 | def terminate(self):
1627 | self._running = False
1628 |
1629 | def run(self, msgbox, path, search_type, search_format, search_size, size_sm, size_bg, search_time, time_sm, time_bg, listView):
1630 | listView.clear()
1631 | time.sleep(1)
1632 | for root, dirs, files in os.walk(path):
1633 | for filename in files:
1634 | if not self._running: break
1635 | filepath = "%s/%s" % (root, filename)
1636 | filename_ext = os.path.splitext(filename.lower())[1][1:]
1637 | search_additem = False
1638 | if search_type == 1:
1639 | if filename_ext in image_format:
1640 | if search_format == 0:
1641 | search_additem = True
1642 | if search_format > 0:
1643 | if filename_ext == image_format[search_format - 1]:
1644 | search_additem = True
1645 | if search_type == 2:
1646 | if filename_ext in audio_format:
1647 | if search_format == 0:
1648 | search_additem = True
1649 | if search_format > 0:
1650 | if filename_ext == audio_format[search_format - 1]:
1651 | search_additem = True
1652 | if search_type == 3:
1653 | if filename_ext in video_format:
1654 | if search_format == 0:
1655 | search_additem = True
1656 | if search_format > 0:
1657 | if filename_ext == video_format[search_format - 1]:
1658 | search_additem = True
1659 | if search_additem:
1660 | if search_size == 2:
1661 | filesize = os.path.getsize(filepath)
1662 | if filesize < size_sm or filesize > size_bg:
1663 | search_additem = False
1664 | if search_time == 2:
1665 | filetime = os.path.getmtime(filepath)
1666 | if filetime < time_sm or filetime > time_bg:
1667 | search_additem = False
1668 | if search_additem:
1669 | listView.insertItem(0, '%s: %s' % (filename_ext.upper(), filepath) )
1670 | msgbox.done(0)
1671 |
1672 | class Tab4SearchThread:
1673 | def __init__(self):
1674 | self._running = True
1675 |
1676 | def terminate(self):
1677 | self._running = False
1678 |
1679 | def calcHash(self, im):
1680 | try:
1681 | im = Image.open(im)
1682 | resize_width = 8
1683 | resize_height = 8
1684 | im = im.resize((resize_width, resize_height))
1685 | im = im.convert('L')
1686 | pixels = list(im.getdata())
1687 | difference = []
1688 | for row in range(resize_height):
1689 | row_start_index = row * resize_width
1690 | for col in range(resize_width - 1):
1691 | left_pixel_index = row_start_index + col
1692 | difference.append(pixels[left_pixel_index] > pixels[left_pixel_index + 1])
1693 | decimal_value = 0
1694 | hash_string = ""
1695 | for index, value in enumerate(difference):
1696 | if value:
1697 | decimal_value += value * (2 ** (index % 8))
1698 | if index % 8 == 7:
1699 | hash_string += str(hex(decimal_value)[2:].rjust(2, "0"))
1700 | decimal_value = 0
1701 | return hash_string
1702 | except:
1703 | pass
1704 | return 0
1705 |
1706 | def calcHamming(self, h1, h2):
1707 | difference = (int(h1, 16)) ^ (int(h2, 16))
1708 | return bin(difference).count("1")
1709 |
1710 | def run(self, msgbox, path, search_pic, search_size, size_sm, size_bg, search_time, time_sm, time_bg, listView):
1711 | listView.clear()
1712 | time.sleep(1)
1713 | source_hash = self.calcHash(search_pic)
1714 | if source_hash == 0:
1715 | msgbox.done(0)
1716 | return
1717 | for root, dirs, files in os.walk(path):
1718 | for filename in files:
1719 | if not self._running: break
1720 | filepath = "%s/%s" % (root, filename)
1721 | filename_ext = os.path.splitext(filename.lower())[1][1:]
1722 | if search_size == 2:
1723 | filesize = os.path.getsize(filepath)
1724 | if filesize < size_sm or filesize > size_bg:
1725 | continue
1726 | if search_time == 2:
1727 | filetime = os.path.getmtime(filepath)
1728 | if filetime < time_sm or filetime > time_bg:
1729 | continue
1730 | if filename_ext in image_format:
1731 | target_hash = self.calcHash(filepath)
1732 | if target_hash == 0: continue
1733 | hamming_distance = self.calcHamming(target_hash, source_hash)
1734 | listView.insertItem(0, '%d: %s' % (hamming_distance, filepath) )
1735 | listView.sortItems(0)
1736 | msgbox.done(0)
1737 |
1738 | class Tab5RecoverThread:
1739 | def __init__(self):
1740 | self._running = True
1741 |
1742 | def terminate(self):
1743 | self._running = False
1744 |
1745 | def run(self, msgbox, recover_file, recover_dir, option_indirect, option_corrupted, option_quick, recover_type, recover_format, listView):
1746 | listView.clear()
1747 | time.sleep(1)
1748 | command_line = ['foremost']
1749 | if option_indirect: command_line.append('-d')
1750 | if option_corrupted: command_line.append('-a')
1751 | if option_quick: command_line.append('-q')
1752 | command_line.append('-v')
1753 | if recover_type != 1 and len(recover_format) > 0:
1754 | command_line.append('-t')
1755 | command_line.append(recover_format)
1756 | command_line.append('-i')
1757 | command_line.append(recover_file)
1758 | command_line.append('-o')
1759 | command_line.append(recover_dir)
1760 | process = subprocess.Popen(command_line, stdout=subprocess.PIPE)
1761 | start_output = False
1762 | while process:
1763 | if not self._running:
1764 | process.kill()
1765 | break
1766 | fd = process.stdout.fileno()
1767 | fl = fcntl.fcntl(fd, fcntl.F_GETFL)
1768 | fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NONBLOCK)
1769 | process_readline = str(process.stdout.readline())[2:-3]
1770 | if not process_readline:
1771 | if process.poll() != None: break
1772 | continue
1773 | if not start_output and 'File Offset' in process_readline:
1774 | start_output = True
1775 | continue
1776 | if start_output and 'Finish:' in process_readline:
1777 | start_output = False
1778 | continue
1779 | if start_output and len(process_readline) > 5 and len(process_readline) < 64 and '\\t' in process_readline and 'foundat=' not in process_readline:
1780 | listView.insertItem(0, process_readline.replace('\\t', '\t'))
1781 | if 'ERROR' in process_readline:
1782 | listView.insertItem(0, process_readline.replace('\\t', '\t'))
1783 | msgbox.done(0)
1784 |
1785 | class Tab6GPSThread:
1786 | def __init__(self):
1787 | self._running = True
1788 |
1789 | def terminate(self):
1790 | self._running = False
1791 |
1792 | def get_exif_data(self, filepath):
1793 | try:
1794 | image = Image.open(filepath)
1795 | exif_data = {}
1796 | info = image._getexif()
1797 | if info:
1798 | for tag, value in info.items():
1799 | decoded = TAGS.get(tag, tag)
1800 | if decoded == "GPSInfo":
1801 | gps_data = {}
1802 | for t in value:
1803 | sub_decoded = GPSTAGS.get(t, t)
1804 | gps_data[sub_decoded] = value[t]
1805 | exif_data[decoded] = gps_data
1806 | else:
1807 | exif_data[decoded] = value
1808 | return exif_data
1809 | except:
1810 | pass
1811 | return 0
1812 |
1813 | def convert_to_degrees(self, value):
1814 | get_float = lambda x: float(x[0]) / float(x[1])
1815 | d = get_float(value[0])
1816 | m = get_float(value[1])
1817 | s = get_float(value[2])
1818 | return d + (m / 60.0) + (s / 3600.0)
1819 |
1820 | def get_lat_lon(self, exif_data):
1821 | try:
1822 | gps_latitude = exif_data["GPSInfo"]["GPSLatitude"]
1823 | gps_latitude_ref = exif_data["GPSInfo"]["GPSLatitudeRef"]
1824 | gps_longitude = exif_data["GPSInfo"]["GPSLongitude"]
1825 | gps_longitude_ref = exif_data["GPSInfo"]["GPSLongitudeRef"]
1826 | if gps_latitude and gps_latitude_ref and gps_longitude and gps_longitude_ref:
1827 | lat = self.convert_to_degrees(gps_latitude)
1828 | if gps_latitude_ref != 'N': lat = 0 - lat
1829 | lon = self.convert_to_degrees(gps_longitude)
1830 | if gps_longitude_ref != 'E': lon = 0 - lon
1831 | return lat, lon
1832 | except:
1833 | pass
1834 | return 0
1835 |
1836 | def get_time(self, exif_data):
1837 | try:
1838 | dateTime = exif_data["DateTimeOriginal"]
1839 | timeArray = time.strptime(dateTime, "%Y:%m:%d %H:%M:%S")
1840 | timestamp = time.mktime(timeArray)
1841 | return timestamp
1842 | except:
1843 | pass
1844 | return 0
1845 |
1846 | def run(self, msgbox, path, listView, webView):
1847 | listView.clear()
1848 | time.sleep(1)
1849 | for root, dirs, files in os.walk(path):
1850 | for filename in files:
1851 | if not self._running: break
1852 | filepath = "%s/%s" % (root, filename)
1853 | filename_ext = os.path.splitext(filename.lower())[1][1:]
1854 | if filename_ext in image_format:
1855 | exif_data = self.get_exif_data(filepath)
1856 | if exif_data == 0: continue
1857 | lat_lon = self.get_lat_lon(exif_data)
1858 | if lat_lon == 0: continue
1859 | time_stamp = self.get_time(exif_data)
1860 | if time_stamp == 0: time_stamp = os.path.getmtime(filepath)
1861 | date_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(time_stamp))
1862 | listView.insertItem(0, '[%s][%f, %f] %s' % (date_time, lat_lon[0], lat_lon[1], filepath) )
1863 | map_data.append((time_stamp, lat_lon[0], lat_lon[1]))
1864 | listView.sortItems(0)
1865 | msgbox.done(0)
1866 |
1867 | class Tab7SearchThread:
1868 | def __init__(self):
1869 | self._running = True
1870 |
1871 | def terminate(self):
1872 | self._running = False
1873 |
1874 | def run(self, msgbox, path, listView):
1875 | listView.clear()
1876 | time.sleep(1)
1877 | for root, dirs, files in os.walk(path):
1878 | for filename in files:
1879 | if not self._running: break
1880 | filepath = "%s/%s" % (root, filename)
1881 | filename_ext = os.path.splitext(filename.lower())[1][1:]
1882 | search_additem = False
1883 | if filename_ext == "db":
1884 | listView.insertItem(0, '%s: %s' % (filename_ext.upper(), filepath) )
1885 | msgbox.done(0)
1886 |
1887 | class Tab7DecryptThread:
1888 | def __init__(self):
1889 | self._running = True
1890 |
1891 | def terminate(self):
1892 | self._running = False
1893 |
1894 | def run(self, msgbox, encrypted_file, password, decrypted_file):
1895 | time.sleep(1)
1896 | process = subprocess.Popen(['python', 'desql.py', encrypted_file, password, decrypted_file], stdout=subprocess.PIPE)
1897 | start_output = False
1898 | while process:
1899 | if not self._running:
1900 | process.kill()
1901 | break
1902 | if process.poll() != None: break
1903 | msgbox.done(0)
1904 |
1905 | if __name__ == '__main__':
1906 | app = QApplication(sys.argv)
1907 | ex = App()
1908 | sys.exit(app.exec_())
--------------------------------------------------------------------------------