Update some tools, change license from MIT to GPLv3. If code is reused in commercial tools, those tools will automatically become GPLv3 and have to be open-sourced under GPLv3 as well.

This commit is contained in:
Bjoern Kerler 2023-07-22 15:36:45 +02:00
parent 76a2bf4d3f
commit b227c4c17e
70 changed files with 2339 additions and 292 deletions

View file

@ -1,4 +0,0 @@
[ViewState]
Mode=
Vid=
FolderType=Generic

View file

@ -1,19 +0,0 @@
<!--
Summary of the DPInst XML Elements:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff553383%28v=vs.85%29.aspx
Enabling Language Customization:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff544886%28v=vs.85%29.aspx
Customizing the Items That Appear on the Wizard Pages:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff540265%28v=vs.85%29.aspx
Dpinst.xml Example:
http://msdn.microsoft.com/en-us/library/windows/hardware/ff544778%28v=vs.85%29.aspx
-->
<?xml version="1.0"?>
<dpinst>
<forceIfDriverIsNotBetter>1</forceIfDriverIsNotBetter>
<installAllOrNone>1</installAllOrNone>
</dpinst>

View file

@ -1,2 +0,0 @@
Set oShell = CreateObject("WScript.Shell")
oShell.Run("""dpinst64.exe """ & "/SW")

View file

@ -1,2 +0,0 @@
Set oShell = CreateObject("WScript.Shell")
oShell.Run("""dpscat.exe""")

View file

@ -1,2 +0,0 @@
Set oShell = CreateObject("WScript.Shell")
oShell.Run("""dpinst64.exe /SW""")

Binary file not shown.

Binary file not shown.

687
LICENSE
View file

@ -1,21 +1,674 @@
MIT License GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (c) 2018 Bjoern Kerler Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Permission is hereby granted, free of charge, to any person obtaining a copy Preamble
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all The GNU General Public License is a free, copyleft license for
copies or substantial portions of the Software. software and other kinds of works.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR The licenses for most software and other practical works are designed
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, to take away your freedom to share and change the works. By contrast,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE the GNU General Public License is intended to guarantee your freedom to
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER share and change all versions of a program--to make sure it remains free
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, software for all its users. We, the Free Software Foundation, use the
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE GNU General Public License for most of our software; it applies also to
SOFTWARE. any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/licenses/why-not-lgpl.html>.

@ -1 +1 @@
Subproject commit e443e5c59f9f035c44024c3641b78e5175a365d5 Subproject commit a83850577f32faaf4694cda8f00666e0d9d34654

View file

@ -1,5 +1,6 @@
# Qualcomm Sahara / Firehose Attack Client / Diag Tools # Qualcomm Sahara / Firehose Attack Client / Diag Tools
(c) B. Kerler 2018-2023 (c) B. Kerler 2018-2023
Licensed under GPLv3 license.
## Why ## Why
@ -249,7 +250,7 @@ For Oneplus 6T, enter *#801#* on dialpad, set Engineer Mode and Serial to on and
- Oneplus 3T/5/6T/7T/8/8t/9/Nord CE/N10/N100 (Read-Only), BQ X, BQ X5, BQ X2, Gigaset ME Pure, ZTE MF210, ZTE MF920V, Sierra Wireless EM7455, Netgear MR1100-10EUS, Netgear MR5100 - Oneplus 3T/5/6T/7T/8/8t/9/Nord CE/N10/N100 (Read-Only), BQ X, BQ X5, BQ X2, Gigaset ME Pure, ZTE MF210, ZTE MF920V, Sierra Wireless EM7455, Netgear MR1100-10EUS, Netgear MR5100
- SIMCOM SIM8905E - SIMCOM SIM8905E
Published under MIT license Published under GPLv3 license
Additional license limitations: No use in commercial products without prior permit. Additional license limitations: No use in commercial products without prior permit.
Enjoy ! Enjoy !

1
boottodownload Symbolic link
View file

@ -0,0 +1 @@
edlclient/Tools/boottodwnload

102
edl
View file

@ -1,6 +1,11 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Qualcomm Sahara / Firehose Client (c) B.Kerler 2018-2023 # -*- coding: utf-8 -*-
# Licensed under MIT License # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
""" """
Usage: Usage:
edl -h | --help edl -h | --help
@ -96,8 +101,8 @@ Description:
Options: Options:
--loader=filename Use specific EDL loader, disable autodetection [default: None] --loader=filename Use specific EDL loader, disable autodetection [default: None]
--vid=vid Set usb vendor image_id used for EDL [default: -1] --vid=vid Set usb vendor id used for EDL [default: -1]
--pid=pid Set usb product image_id used for EDL [default: -1] --pid=pid Set usb product id used for EDL [default: -1]
--lun=lun Set lun to read/write from (UFS memory only) --lun=lun Set lun to read/write from (UFS memory only)
--maxpayload=bytes Set the maximum payload for EDL [default: 0x100000] --maxpayload=bytes Set the maximum payload for EDL [default: 0x100000]
--sectorsize=bytes Set default sector size --sectorsize=bytes Set default sector size
@ -188,7 +193,7 @@ class main(metaclass=LogBase):
self.vid = None self.vid = None
self.pid = None self.pid = None
def doconnect(self, loop): def doconnect(self, loop) -> dict:
while not self.cdc.connected: while not self.cdc.connected:
self.cdc.connected = self.cdc.connect(portname=self.portname) self.cdc.connected = self.cdc.connect(portname=self.portname)
if not self.cdc.connected: if not self.cdc.connected:
@ -302,53 +307,54 @@ class main(metaclass=LogBase):
mode = conninfo["mode"] mode = conninfo["mode"]
if mode == "sahara": if mode == "sahara":
cmd = conninfo["cmd"] cmd = conninfo["cmd"]
data = conninfo["data"]
if cmd == cmd_t.SAHARA_HELLO_REQ: if cmd == cmd_t.SAHARA_HELLO_REQ:
if data.mode == sahara_mode_t.SAHARA_MODE_MEMORY_DEBUG: if "data" in conninfo:
if args["memorydump"] or self.cdc.pid==0x900E: data = conninfo["data"]
time.sleep(0.5) if data.mode == sahara_mode_t.SAHARA_MODE_MEMORY_DEBUG:
print("Device is in memory dump mode, dumping memory") if args["memorydump"] or self.cdc.pid == 0x900E:
if args["--partitions"]: time.sleep(0.5)
self.sahara.debug_mode(args["--partitions"].split(",")) print("Device is in memory dump mode, dumping memory")
else: if args["--partitions"]:
self.sahara.debug_mode() self.sahara.debug_mode(args["--partitions"].split(","))
self.exit()
else:
print("Device is in streaming mode, uploading loader")
self.cdc.timeout = None
sahara_info = self.sahara.streaminginfo()
if sahara_info:
sahara_connect = self.sahara.connect()
if len(sahara_connect) == 3:
mode, cmd, resp = sahara_connect
else: else:
mode, resp = sahara_connect self.sahara.debug_mode()
self.exit()
else:
print("Device is in streaming mode, uploading loader")
self.cdc.timeout = None
sahara_info = self.sahara.streaminginfo()
if sahara_info:
sahara_connect = self.sahara.connect()
if len(sahara_connect) == 3:
mode, cmd, resp = sahara_connect
else:
mode, resp = sahara_connect
if mode == "sahara":
mode = self.sahara.upload_loader()
if "enprg" in self.sahara.programmer.lower():
mode = "load_enandprg"
elif "nprg" in self.sahara.programmer.lower():
mode = "load_nandprg"
elif mode != "":
mode = "load_" + mode
if "load_" in mode:
time.sleep(0.3)
else:
print("Error, couldn't find suitable enprg/nprg loader :(")
self.exit()
else:
sahara_info = self.sahara.cmd_info()
if sahara_info is not None:
resp = self.sahara.connect()
mode = resp["mode"]
if "data" in resp:
data = resp["data"]
if mode == "sahara": if mode == "sahara":
mode = self.sahara.upload_loader() mode = self.sahara.upload_loader()
if "enprg" in self.sahara.programmer.lower(): else:
mode = "load_enandprg" print("Error on sahara handshake, resetting.")
elif "nprg" in self.sahara.programmer.lower(): self.sahara.cmd_reset()
mode = "load_nandprg" sys.exit(1)
elif mode != "":
mode = "load_" + mode
if "load_" in mode:
time.sleep(0.3)
else:
print("Error, couldn't find suitable enprg/nprg loader :(")
self.exit()
else:
sahara_info = self.sahara.cmd_info()
if sahara_info is not None:
resp = self.sahara.connect()
mode = resp["mode"]
if "data" in resp:
data = resp["data"]
if mode == "sahara":
mode = self.sahara.upload_loader()
else:
print("Error on sahara handshake, resetting.")
self.sahara.cmd_reset()
sys.exit(1)
if mode == "error": if mode == "error":
print("Connection detected, quiting.") print("Connection detected, quiting.")
sys.exit(1) sys.exit(1)

View file

@ -1,3 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
vendor = { vendor = {
0x0000: "Qualcomm ", 0x0000: "Qualcomm ",
0x0001: "Foxconn/Sony ", 0x0001: "Foxconn/Sony ",

View file

@ -1,3 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
default_ids = [ default_ids = [
[0x05c6, 0x9008, -1], [0x05c6, 0x9008, -1],
[0x0fce, 0x9dde, -1], [0x0fce, 0x9dde, -1],

View file

@ -1,12 +1,19 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import serial import serial
import serial.tools.list_ports import serial.tools.list_ports
import inspect import inspect
import traceback import traceback
from binascii import hexlify from binascii import hexlify
from edlclient.Library.utils import * try:
from edlclient.Library.utils import *
except:
from Library.utils import *
class DeviceClass(metaclass=LogBase): class DeviceClass(metaclass=LogBase):

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2022 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import os.path import os.path
import time import time
import sys import sys
@ -20,8 +24,13 @@ import serial.tools.list_ports
import inspect import inspect
import traceback import traceback
from binascii import hexlify from binascii import hexlify
from edlclient.Library.utils import * try:
from edlclient.Library.Connection.devicehandler import DeviceClass from edlclient.Library.utils import *
from edlclient.Library.Connection.devicehandler import DeviceClass
except:
from Library.utils import *
from Library.Connection.devicehandler import DeviceClass
class serial_class(DeviceClass): class serial_class(DeviceClass):

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import io import io
import logging import logging
@ -9,17 +13,22 @@ import usb.util
import time import time
import inspect import inspect
import array import array
from edlclient.Library.utils import is_windows
import usb.backend.libusb0 import usb.backend.libusb0
if not is_windows():
import usb.backend.libusb1
from enum import Enum from enum import Enum
from binascii import hexlify from binascii import hexlify
from ctypes import c_void_p, c_int from ctypes import c_void_p, c_int
from edlclient.Library.utils import * try:
from edlclient.Library.utils import *
except:
from Library.utils import *
if not is_windows():
import usb.backend.libusb1
from struct import pack, calcsize from struct import pack, calcsize
import traceback import traceback
from edlclient.Library.Connection.devicehandler import DeviceClass try:
from edlclient.Library.Connection.devicehandler import DeviceClass
except:
from Library.Connection.devicehandler import DeviceClass
USB_DIR_OUT = 0 # to device USB_DIR_OUT = 0 # to device
USB_DIR_IN = 0x80 # to host USB_DIR_IN = 0x80 # to host

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import argparse import argparse
from edlclient.Library.Connection.usblib import * from edlclient.Library.Connection.usblib import *

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import logging import logging
from edlclient.Library.utils import LogBase from edlclient.Library.utils import LogBase

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import logging import logging
from edlclient.Library.utils import LogBase from edlclient.Library.utils import LogBase
@ -87,7 +91,7 @@ class modules(metaclass=LogBase):
else: else:
options[args[i]] = True options[args[i]] = True
if command == "": if command == "":
print("Valid commands are:\noemunlock\n") print("Valid commands are:\noemunlock, ops\n")
return False return False
if self.generic is not None and command == "oemunlock": if self.generic is not None and command == "oemunlock":
if "enable" in options: if "enable" in options:
@ -98,5 +102,46 @@ class modules(metaclass=LogBase):
self.error("Unknown mode given. Available are: enable, disable.") self.error("Unknown mode given. Available are: enable, disable.")
return False return False
return self.generic.oem_unlock(enable) return self.generic.oem_unlock(enable)
else: elif self.ops is not None and command == "ops":
print("Valid options are: oemunlock [enable,disable]") if self.devicemodel is not None:
enable = False
partition = "param"
if "enable" in options:
enable = True
elif "disable" in options:
enable = False
else:
self.error("Unknown mode given. Available are: enable, disable.")
return False
res = self.fh.detect_partition(self.args, partition)
if res[0]:
lun = res[1]
rpartition = res[2]
paramdata = self.fh.cmd_read_buffer(lun, rpartition.sector, rpartition.sectors, False)
if paramdata.data == b"":
self.error("Error on reading param partition.")
return False
wdata = self.ops.enable_ops(paramdata.data, enable,self.devicemodel,self.serial)
if wdata is not None:
self.ops.run()
if self.fh.cmd_program_buffer(lun, rpartition.sector, wdata, False):
self.info("Successfully set mode")
return True
else:
self.error("Error on writing param partition")
return False
else:
self.error("No param info generated, did you provide the devicemodel ?")
return False
else:
fpartitions = res[1]
self.error(f"Error: Couldn't detect partition: {partition}\nAvailable partitions:")
for lun in fpartitions:
for rpartition in fpartitions[lun]:
if self.args["--memory"].lower() == "emmc":
self.error("\t" + rpartition)
else:
self.error(lun + ":\t" + rpartition)
else:
self.error("A devicemodel is needed for this command")
return False

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
""" """
Usage: Usage:
@ -75,7 +79,7 @@ deviceconfig = {
# OP Nord, avicii # OP Nord, avicii
"20801": dict(version=2, cm="eacf50e7", param_mode=0), "20801": dict(version=2, cm="eacf50e7", param_mode=0),
# OP N10 5G Metro, billie8t # OP N10 5G Metro, billie8t
"20885": dict(version=3, cm="3a403a71", param_mode=1), "20885": dict(version=3, cm="3a403a71", param_mode=1),
# OP N10 5G Global, billie8 # OP N10 5G Global, billie8
@ -87,7 +91,7 @@ deviceconfig = {
# OP N100 Metro, billie2t # OP N100 Metro, billie2t
"20880": dict(version=3, cm="6ccf5913", param_mode=1), "20880": dict(version=3, cm="6ccf5913", param_mode=1),
# OP N100 Global, billie2 # OP N100 Global, billie2
"20881": dict(version=3, cm="fa9ff378", param_mode=1), "20881": dict(version=3, cm="fa9ff378", param_mode=1),
# OP N100 TMO, billie2t # OP N100 TMO, billie2t
"20882": dict(version=3, cm="4ca1e84e", param_mode=1), "20882": dict(version=3, cm="4ca1e84e", param_mode=1),
@ -127,7 +131,7 @@ class oneplus(metaclass=LogBase):
def __init__(self, fh, projid="18825", serial=123456, ATOBuild=0, Flash_Mode=0, cf=0, supported_functions=None, def __init__(self, fh, projid="18825", serial=123456, ATOBuild=0, Flash_Mode=0, cf=0, supported_functions=None,
args=None, loglevel=logging.INFO): args=None, loglevel=logging.INFO):
self.fh = fh self.fh = fh
self.__logger=self.__logger self.__logger = self.__logger
self.args = args self.args = args
self.ATOBuild = ATOBuild self.ATOBuild = ATOBuild
self.Flash_Mode = Flash_Mode self.Flash_Mode = Flash_Mode
@ -155,7 +159,16 @@ class oneplus(metaclass=LogBase):
logfilename = "log.txt" logfilename = "log.txt"
filehandler = logging.FileHandler(logfilename) filehandler = logging.FileHandler(logfilename)
self.__logger.addHandler(filehandler) self.__logger.addHandler(filehandler)
self.ops_parm = None try:
from edlclient.Library.Modules.oneplus_param import paramtools
if projid in deviceconfig:
mode = deviceconfig[projid]["param_mode"]
self.ops_parm = paramtools(mode=mode, serial=serial)
else:
self.ops_parm = paramtools(mode=0, serial=serial)
except ImportError as e:
self.__logger.error(str(e))
self.ops_parm = None
self.ops = self.convert_projid(fh, projid, serial) self.ops = self.convert_projid(fh, projid, serial)
def getprodkey(self, projid): def getprodkey(self, projid):
@ -227,6 +240,11 @@ class oneplus(metaclass=LogBase):
if self.ops.demacia(): if self.ops.demacia():
return self.ops.demacia() return self.ops.demacia()
def enable_ops(self, data, enable, projid, serial):
if self.ops_parm is not None:
return self.ops_parm.enable_ops(data, enable)
return None
def addpatch(self): def addpatch(self):
if "setprojmodel" in self.supported_functions or "setswprojmodel" in self.supported_functions: if "setprojmodel" in self.supported_functions or "setswprojmodel" in self.supported_functions:
pk, token = self.ops.generatetoken(True) pk, token = self.ops.generatetoken(True)

View file

@ -0,0 +1,994 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
"""
Usage:
oneplus_param.py param <filename> [--mode=mode] [--serial=serial]
oneplus_param.py ops <filename> [--mode=mode] [--serial=serial]
oneplus_param.py gencode <imei>
oneplus_param.py setparam <filename> <sid> <offset> <value> [--mode=mode] [--serial=serial]
"""
from enum import Enum
from struct import calcsize, pack, unpack
import hashlib
import zlib
import qrcode
try:
from edlclient.Library.cryptutils import cryptutils
except ImportError as e:
import os, sys, inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
try:
from cryptutils import cryptutils
except ImportError as e:
print(str(e))
try:
from edlclient.Library.Modules.oneplus_param import *
except ImportError:
pass
from binascii import unhexlify, hexlify
class sid(Enum):
PARAM_SID_PRODUCT = 0,
PARAM_SID_CONFIG = 1,
PARAM_SID_LCD = 2,
PARAM_SID_TP = 3,
PARAM_SID_TP_KPD = 4,
PARAM_SID_CAMERA = 5,
PARAM_SID_SENSORS = 6,
PARAM_SID_BATTERY = 7,
PARAM_SID_RTC = 8,
PARAM_SID_CRASH_RECORD = 9,
PARAM_SID_SALEINFO = 0xA,
PARAM_SID_MISC = 0xB,
PARAM_SID_DOWNLOAD = 0xC,
PARAM_SID_PHONE_HISTORY = 0xD,
PARAM_SID_DL_USERINFO = 0xE,
PARAM_SID_ENC_SECRECY = 0x12C,
PARAM_SID_ENC_CARRIER = 0x130,
PARAM_SID_ENC_MOBID = 0x134,
PARAM_SID_ENC_CVE = 0x138,
PARAM_SID_INVALID = -1
'''
CUSTOM_TYPE.NONE = new CUSTOM_TYPE("NONE", 0);
CUSTOM_TYPE.JCC = new CUSTOM_TYPE("JCC", 1); French edition
CUSTOM_TYPE.SW = new CUSTOM_TYPE("SW", 2); Star Wars
CUSTOM_TYPE.AVG = new CUSTOM_TYPE("AVG", 3); Avengers
CUSTOM_TYPE.MCL = new CUSTOM_TYPE("MCL", 4); McLaren
CUSTOM_TYPE.OPR_RETAIL = new CUSTOM_TYPE("OPR_RETAIL", 5);
CUSTOM_TYPE.CYB = new CUSTOM_TYPE("CYB", 6); Cyberpunk
CUSTOM_TYPE v0 = new CUSTOM_TYPE("CMCC", 7); China Mobile
'''
'''
SW_TYPE.DEFAULT = new SW_TYPE("DEFAULT", 0);
SW_TYPE.O2 = new SW_TYPE("O2", 1);
SW_TYPE.H2 = new SW_TYPE("H2", 2);
SW_TYPE.IN = new SW_TYPE("IN", 3);
SW_TYPE.EU = new SW_TYPE("EU", 4);
SW_TYPE.TMO = new SW_TYPE("TMO", 5);
SW_TYPE.SPRINT = new SW_TYPE("SPRINT", 6);
SW_TYPE.VERIZON = new SW_TYPE("VERIZON", 7);
SW_TYPE.ATT = new SW_TYPE("ATT", 8);
SW_TYPE v0 = new SW_TYPE("C532", 9);
'''
'''
CUSTOM_BACK_COVER_TYPE.NONE = new CUSTOM_BACK_COVER_TYPE("NONE", 0);
CUSTOM_BACK_COVER_TYPE.LCH = new CUSTOM_BACK_COVER_TYPE("LCH", 1);
CUSTOM_BACK_COVER_TYPE.MYH = new CUSTOM_BACK_COVER_TYPE("MYH", 2);
CUSTOM_BACK_COVER_TYPE.YYB = new CUSTOM_BACK_COVER_TYPE("YYB", 3);
CUSTOM_BACK_COVER_TYPE.HPH = new CUSTOM_BACK_COVER_TYPE("HPH", 4);
CUSTOM_BACK_COVER_TYPE.DGZ = new CUSTOM_BACK_COVER_TYPE("DGZ", 5);
CUSTOM_BACK_COVER_TYPE.OPGY = new CUSTOM_BACK_COVER_TYPE("OPGY", 6);
CUSTOM_BACK_COVER_TYPE.OPBL = new CUSTOM_BACK_COVER_TYPE("OPBL", 7);
CUSTOM_BACK_COVER_TYPE.OPGL = new CUSTOM_BACK_COVER_TYPE("OPGL", 8);
CUSTOM_BACK_COVER_TYPE.OPRD = new CUSTOM_BACK_COVER_TYPE("OPRD", 9);
CUSTOM_BACK_COVER_TYPE.OPHDBL = new CUSTOM_BACK_COVER_TYPE("OPHDBL", 10);
CUSTOM_BACK_COVER_TYPE.OPHDSL = new CUSTOM_BACK_COVER_TYPE("OPHDSL", 11);
CUSTOM_BACK_COVER_TYPE.OPHDMCL = new CUSTOM_BACK_COVER_TYPE("OPHDMCL", 12);
CUSTOM_BACK_COVER_TYPE.OPHDAGBL = new CUSTOM_BACK_COVER_TYPE("OPHDAGBL", 13);
CUSTOM_BACK_COVER_TYPE.OPINBLK = new CUSTOM_BACK_COVER_TYPE("OPINBLK", 14);
CUSTOM_BACK_COVER_TYPE.OPINGRN = new CUSTOM_BACK_COVER_TYPE("OPINGRN", 15);
CUSTOM_BACK_COVER_TYPE.OPINBLU = new CUSTOM_BACK_COVER_TYPE("OPINBLU", 16);
CUSTOM_BACK_COVER_TYPE.OPINGRD = new CUSTOM_BACK_COVER_TYPE("OPINGRD", 17);
CUSTOM_BACK_COVER_TYPE.OPINIB = new CUSTOM_BACK_COVER_TYPE("OPINIB", 18);
CUSTOM_BACK_COVER_TYPE.OPAVICGRIR = new CUSTOM_BACK_COVER_TYPE("OPAVICGRIR", 19);
CUSTOM_BACK_COVER_TYPE.OPAVICBLIC = new CUSTOM_BACK_COVER_TYPE("OPAVICBLIC", 20);
CUSTOM_BACK_COVER_TYPE.OPAVICGRFR = new CUSTOM_BACK_COVER_TYPE("OPAVICGRFR", 21);
CUSTOM_BACK_COVER_TYPE.OPKEBABGD = new CUSTOM_BACK_COVER_TYPE("OPKEBABGD", 22);
CUSTOM_BACK_COVER_TYPE.OPKEBABBG = new CUSTOM_BACK_COVER_TYPE("OPKEBABBG", 23);
CUSTOM_BACK_COVER_TYPE.OPKEBABSG = new CUSTOM_BACK_COVER_TYPE("OPKEBABSG", 24);
CUSTOM_BACK_COVER_TYPE.OPN1MB = new CUSTOM_BACK_COVER_TYPE("OPN1MB", 25);
CUSTOM_BACK_COVER_TYPE v0 = new CUSTOM_BACK_COVER_TYPE("OPN2GB", 26);
'''
class paramtools():
paramitems = {
sid.PARAM_SID_PRODUCT.value[0]: {
0x18: ["8c", "project_name"],
0x20: ["I", "hw_version"],
0x24: ["I", "rf_version"],
0x28: ["16c", "rf_config_str"],
0x38: ["I", "operator_num"],
0x3C: ["10c", "operator_str"],
0x4C: ["B", "Length PCBA_number"],
0x4D: ["27c", "pcba_number"],
0x68: ["I", "boot_aging_count"],
0x6C: ["48c", "ota_info"],
0x9C: ["80c", "firmware_info"],
0xEC: ["32c", "build_info"],
0x10C: ["I", "unknown_dword"],
0x1A0: ["I", "OemCheckResetDevInfo"] # if 1, then reset dev info. if 2, then do below, wth is this ?
},
sid.PARAM_SID_CONFIG.value[0]: {
0x18: ["B", "dump_enable"],
},
sid.PARAM_SID_CRASH_RECORD.value[0]: {
0x18: ["I", "crash_record_count"],
0x1c: ["20c", "Crash log 1"],
0x30: ["20c", "Crash log 2"],
0x44: ["20c", "Crash log 3"],
0x58: ["20c", "Crash log 4"],
0x6c: ["20c", "Crash log 5"],
0x80: ["20c", "Crash log 6"],
0x94: ["20c", "Crash log 7"],
0xa8: ["20c", "Crash log 8"],
0xbc: ["20c", "Crash log 9"],
0xd0: ["20c", "Crash log 10"],
0xe4: ["20c", "Crash log 11"],
0xf8: ["20c", "Crash log 12"],
0x10c: ["20c", "Crash log 13"],
0x120: ["20c", "Crash log 14"],
0x134: ["20c", "Crash log 15"],
0x15c: ["I", "restart_08_count"],
0x160: ["I", "restart_other_count"]
},
sid.PARAM_SID_SALEINFO.value[0]: { # 0xA, Param_saleinfo, PARAM_SID_SALEINFO
0x18: ["I", "is_rooted"],
0x1c: ["I", "root_time"],
0x20: ["16c", "flash_0"],
0x30: ["16c", "flash_1"],
0x40: ["16c", "flash_2"],
0x50: ["16c", "erase_0"],
0x60: ["16c", "erase_1"],
0x70: ["16c", "erase_2"],
0x80: ["I", "is_angela"],
# adb shell am start -n com.android.engineeringmode/.qualcomm.DiagEnabled --es "code" "angela"
# adb shell am start -n com.oneplus.factorymode/.qualcomm.DiagEnabled --es "code" "angela"
# disable: "setprop persist.sys.adb.engineermode 0" and "setprop persist.sys.adbroot 0" or call code *#8011#
0x88: ["I", "Unknown flag"],
0x8c: ["I", "Unknown value"],
0x90: ["I", "Unknown flag"],
},
sid.PARAM_SID_MISC.value[0]: { # 0xB
0x20: ["I", "Misc flag 1"],
0x24: ["44c", "Misc log a_1"],
0x50: ["I", "Misc flag a_2"],
0x54: ["44c", "Misc log a_2"],
0x80: ["I", "Misc flag a_3"],
0x84: ["44c", "Misc log a_3"],
0xb0: ["I", "Misc flag a_4"],
0xb4: ["44c", "Misc log a_4"],
0xe4: ["I", "Misc flag b_1"],
0xe8: ["44c", "Misc log b_1"],
0x114: ["I", "Misc flag b_2"],
0x118: ["44c", "Misc log b_2"],
0x144: ["I", "Misc flag b_3"],
0x148: ["44c", "Misc log b_3"],
0x174: ["I", "Misc flag b_4"],
0x178: ["44c", "Misc log b_4"],
0x1a8: ["I", "Misc flag c_1"],
0x1ac: ["44c", "Misc log c_1"],
0x1d8: ["I", "Misc flag c_2"],
0x1dc: ["44c", "Misc log c_2"],
0x208: ["I", "Misc flag c_3"],
0x20c: ["44c", "Misc log c_3"],
0x238: ["I", "Misc flag c_4"],
0x23c: ["44c", "Misc log c_4"],
},
sid.PARAM_SID_DOWNLOAD.value[0]: { # 0xC
0x18: ["24c", "Unknown date"],
0x30: ["B", "SMT_Download_Status"],
0x32: ["B", "Unknown flag"],
0x33: ["B", "Unknown flag"],
0x38: ["32c", "Unknown string_1"],
0xd8: ["24c", "Unknown date_1"],
0xF0: ["B", "Upgrade_Download_Status_1"],
0xF2: ["B", "Unknown flag_1"],
0xF8: ["32c", "Unknown string_2"],
0x118: ["24c", "Unknown date_2"],
0x130: ["B", "Upgrade_Download_Status_2"],
0x132: ["B", "Unknown flag_2"],
0x138: ["32c", "Unknown string_3"],
0x158: ["24c", "Unknown date_3"],
0x170: ["B", "Upgrade_Download_Status_3"],
0x172: ["B", "Unknown flag_3"],
0x178: ["32c", "Unknown string_4"],
0x188: ["24c", "Unknown date_4"],
0x198: ["I", "boot_stage"],
0x19C: ["I", "data_stage"],
0x1A0: ["B", "reset_devinfo"], # OemCheckResetRevInfo
0x1A4: ["B", "intranet_3t"],
0x1A8: ["B", "bootmode_3t"]
},
sid.PARAM_SID_PHONE_HISTORY.value[0]: { # 0xD
0x24: ["I", "Update_Count"],
0x28: ["I", "Unlock_Count"],
0x2c: ["I", "Unknown value"],
0x30: ["I", "param_poweroff_count"],
0x34: ["I", "abl_tamper"],
},
sid.PARAM_SID_DL_USERINFO.value[0]: { # 0xE
0x20: ["32c", "Computername_1"],
0x40: ["32c", "Username_1"],
0x60: ["I", "Flag_1"],
0x68: ["20c", "IP_1"],
0x7C: ["I", "Chksum_1_0"],
0xA0: ["32c", "Computername_2"],
0xC0: ["32c", "Username_2"],
0xE0: ["I", "Flag_2"],
0xE8: ["20c", "IP_2"],
0xFC: ["I", "Chksum_2"],
0x120: ["32c", "Computername_2"],
0x140: ["32c", "Username_2"],
0x160: ["I", "Flag_2"],
0x168: ["20c", "IP_2"],
0x17C: ["I", "Chksum_2"],
0x1A0: ["32c", "Computername_3"],
0x1C0: ["32c", "Username_3"],
0x1E0: ["I", "Flag_3"],
0x1E8: ["20c", "IP_3"],
0x1FC: ["I", "Chksum_3"],
},
0xB0: {
0x2b4: ["128B", "Unknown"]
},
sid.PARAM_SID_ENC_SECRECY.value[0]: { # 0x12C
0x80: ["I", "intranet"], # Allows factory commands via fastboot ops, *#808# engineermode
# dumpsys secrecy dump (persist)
# fastboot ops 4F50040TR18FTR7FSTD5F01
# fastboot ops help
0x84: ["I", "boottype"], # 0xA9E:"sdebug"; 0xB7:"debug";0xA0:"auto";0x0:"normal"
0x88: ["I", "ONLINE_CFG_TEST_ENV"],
0x8C: ["I", "TargetSWID"],
0x90: ["I", "AgingFlag"]
},
sid.PARAM_SID_ENC_CARRIER.value[0]: { # 0x130
0xA0: ["I", "CustFlag"],
0xA4: ["I", "CustFlagMigrationPlaintext"],
0xA8: ["I", "carrier_id"],
0xAC: ["I", "carrier_init_flag"]
},
sid.PARAM_SID_ENC_MOBID.value[0]: {
0x80: ["16c", "mobid/imei/meid1"],
0x90: ["I", "mobid/imei_flag"],
0x94: ["I", "Recondition flag (RCF)"],
0x98: ["19c", "Unknown date1"],
0xB0: ["19c", "Unknown date2"],
0xC8: ["19c", "Unknown date3"],
0xE0: ["8c", "Unknown_value_000000"],
0xE8: ["16c", "mobid/imei/meid2"],
0xF0: ["I", "mobid/meid flag"],
0xF8: ["I", "Unknown flag"]
},
sid.PARAM_SID_ENC_CVE.value[0]: {
0x80: ["16c", "CVE_SystemBlob_A"],
0x90: ["16c", "CVE_VendorBlob_A"],
0xA0: ["16c", "CVE_SystemBlob_B"],
0xB0: ["16c", "CVE_VendorBlob_B"],
0xC0: ["16c", "CVE_Current_BootImg_A"],
0xD0: ["16c", "CVE_Current_BootImg_B"],
0xE0: ["I", "PWD Index 1"],
0xE4: ["40c", "PWD Hash 1"],
0x114: ["40c", "PWD Hash 2"],
0x144: ["40c", "PWD Hash 3"],
0x174: ["40c", "PWD Hash 4"],
0x1a4: ["I", "PWD Index 2"],
0x1a8: ["40c", "PWD Hash 1"],
0x1d8: ["40c", "PWD Hash 2"],
0x208: ["40c", "PWD Hash 3"],
0x238: ["40c", "PWD Hash 4"],
0x268: ["I", "PWD Index 3"],
0x26c: ["40c", "PWD Hash 1"],
0x29c: ["40c", "PWD Hash 2"],
0x2cc: ["40c", "PWD Hash 3"],
0x2fc: ["40c", "PWD Hash 4"],
}
}
def __init__(self, mode, serial):
self.aes_iv = unhexlify("562E17996D093D28DDB3BA695A2E6F58")
self.aes_key = unhexlify("3030304F6E65506C7573383138303030")
if mode==1:
derivedkey=bytes.fromhex("a9264fbf8a"+("%08x"%serial)+"6b4487ea")[:0x1A]
derivedkey=hashlib.sha256(derivedkey).digest()[:16]
self.aes_key = derivedkey
def getparam(self, offset, sidindex):
if sidindex & 0x1FF in self.paramitems:
siditems = self.paramitems[sidindex & 0x1FF]
if offset in siditems:
return siditems[offset]
return None
def decryptsid(self, data):
aes = cryptutils().aes()
hash = cryptutils().hash()
header = data[:4 + 1 + 1]
magic, hv, cv = unpack("<IBB", header)
updatecounter = data[0x10]
if magic != 0xA0AD646A:
return None, None, None, None
enchash = data[0x80:0x90]
encdata = data[0x400:0x400 + 0xC00]
genenchash = hash.md5(encdata)
if genenchash != enchash:
print(
f"Generated hash doesn't match encrypted hash:\n{hexlify(genenchash).decode('utf-8')}\n{hexlify(enchash).decode('utf-8')}")
return None, None, None, None
decdata = aes.aes_cbc(self.aes_key, self.aes_iv, encdata)
dechash = decdata[:16]
itemdata = decdata[-0xB80:]
gendechash = hash.md5(itemdata)
if gendechash != dechash:
print(
f"Generated hash doesn't match decrypted hash:\n{hexlify(gendechash).decode('utf-8')}\n{hexlify(dechash).decode('utf-8')}")
return None, None, None, None
return itemdata, hv, cv, updatecounter
def encryptsid(self, itemdata, hv, cv, updatecounter):
aes = cryptutils().aes()
hash = cryptutils().hash()
magic = 0xA0AD646A
siddata = bytearray(b"\x00" * 0x1000)
siddata[:4 + 1 + 1] = pack("<IBB", magic, hv, cv)
siddata[0x10] = updatecounter + 1
header = bytearray(b"\00" * 0x80)
gendechash = hash.md5(itemdata)
header[0:16] = gendechash
decdata = header + itemdata
encdata = aes.aes_cbc(self.aes_key, self.aes_iv, decdata, False)
genenchash = hash.md5(encdata)
siddata[0x80:0x90] = genenchash
siddata[0x400:0x400 + 0xC00] = encdata
return siddata
def parse_encrypted(self, rdata, sid):
data = rdata[(sid * 0x400):(sid * 0x400) + 0x1000]
itemdata, hv, cv, updatecounter = self.decryptsid(data)
if itemdata != None:
itemdata = bytearray(itemdata)
print(
f"Offset {hex(sid * 0x400)}: hv {hex(hv)}, cv {hex(cv)}, increase_enc_update_counter {hex(updatecounter)}.")
i = 0
while i < len(itemdata):
offset = i + 0x80
param = self.getparam(offset, sid)
if param is None:
if i + 4 < len(itemdata):
value = unpack("<I", itemdata[i:i + 4])[0]
if value != 0x0:
print(f"Encrypted SID_Index {hex(sid)}, Offset {hex(offset)}: {hex(value)}")
i += 4
else:
length = self.parse_data(i, itemdata, offset, param, sid, True)
i += length
if length % 4:
i += 4 - (length % 4)
print()
def parse_encrypted_fields(self, rdata):
for sid in range(0x12c, 0x139):
self.parse_encrypted(rdata, sid)
# Backup
"""
for sid in range(0x32c, 0x339):
self.parse_encrypted(rdata, sid)
"""
def parse_decrypted_fields(self, rdata):
for pos in range(0x0, 0x40000, 0x400):
if pos >= len(rdata):
break
data = rdata[pos:pos + 0x18]
fm = data[0:0x10].replace(b'\x00', b'').decode('utf-8')
if fm != "":
print()
print(f"Offset {hex(pos)}: Field {fm}")
itemlength = unpack("<I", data[0x14:0x18])[0]
if itemlength == 0x0:
itemlength = 0x400
itemdata = rdata[pos + 0x18:pos + 0x18 + itemlength]
i = 0
while (i < len(itemdata) - 0x22):
sidindex = (pos // 0x400) & 0x1FF
offset = i + 0x18
# if sidindex==0x334 and offset==0x80:
# print(hexlify(itemdata).decode('utf-8'))
param = self.getparam(offset, sidindex)
if param is None:
if itemdata[i] != 0:
if i + 4 < len(itemdata):
value = unpack("<I", itemdata[i:i + 4])[0]
if value != 0x0:
print(f"SID_Index {hex(sidindex)}, Offset {hex(offset)}: {hex(value)}")
i += 4
else:
i += 1
else:
length = self.parse_data(i, itemdata, offset, param, sidindex)
i += length
if length > 4:
if (length % 4):
i += 4 - (length % 4)
def parse_data(self, i, itemdata, offset, param, sidindex, encrypted=False):
stype = param[0]
name = param[1]
length = calcsize(stype)
item = itemdata[i:i + length]
content = unpack(stype, item)
try:
content = "\"" + b"".join(content).replace(b'\x00', b'').decode('utf-8') + "\""
except:
if len(content) == 1:
content = hex(content[0])
else:
tm = ""
for item in content:
if item == 0:
break
tm += hex(item)
content = tm
offsetstr = hex(offset)
while len(offsetstr) < 5:
offsetstr = offsetstr[:2] + "0" + offsetstr[2:]
while len(name) < 30:
name = name + " "
if "PWD Hash" in name:
items = content.split(" ")
pwdhash = items[0][1:9]+"00000000000000000000000000000000000000000000000000000000"
valid = "True" if items[1] != "-1" else "False"
flag = items[2]
date = items[3] + " "+ items[4][:-1]
content = f"{date} ({valid},{flag}): {pwdhash}"
ff = f"SID_Index {hex(sidindex)}, Offset {offsetstr}: {name}: {content}"
if encrypted:
ff = "Encrypted " + ff
else:
ff = f"SID_Index {hex(sidindex)}, Offset {offsetstr}: {name}: {content}"
if encrypted:
ff = "Encrypted " + ff
print(ff)
return length
def setparamvalue(self, data, sid, offset, value):
if sid > 0x100:
rdata = data[sid * 0x400:(sid * 0x400) + 0x1000]
itemdata, hv, cv, updatecounter = self.decryptsid(rdata)
if itemdata is not None:
itemdata = bytearray(itemdata)
if isinstance(value, int):
itemdata[offset - 0x80:(offset + 4) - 0x80] = pack("<I", value)
elif isinstance(value, bytearray):
itemdata[offset - 0x80:(offset + len(value)) - 0x80] = value
# itemdata[0x84-0x80:(0x84+4)-0x80]=pack("<I",0xB7) #devkmsg_enable
mdata = self.encryptsid(itemdata, hv, cv, updatecounter)
data = bytearray(data)
data[sid * 0x400:(sid * 0x400) + 0x1000] = mdata
# data[(sid+0x200) * 0x400:((sid+0x200) * 0x400) + 0x1000] = mdata
else:
rdata = data[sid * 0x400:(sid * 0x400) + 0x1000]
data = bytearray(data)
rdata = bytearray(rdata)
if isinstance(value, int):
rdata[offset:offset + 4] = pack("<I", value)
elif isinstance(value, bytearray):
rdata[offset:(offset + len(value))] = value
data[sid * 0x400:(sid * 0x400) + 0x1000] = rdata
return data
def gencode(self, inparray):
res = []
for input in inparray:
m = hashlib.sha1()
m.update(bytes("ONEPLUS_" + input, 'utf-8'))
hash = m.hexdigest().lower()
crcdata = hex(zlib.crc32(bytes(hash, 'utf-8')))[2:]
while len(crcdata) < 8:
crcdata = '0' + crcdata
res.append(crcdata)
return res
def enable_ops(self, data, enable):
sid = 0x12C
offset = 0x80 # intranet
if enable:
value = 0x3
else:
value = 0x0
return self.setparamvalue(data, sid, offset, value)
'''
ONEPLUS_358240051111110 => sha1 = 99e489e03107817f14ac06a1bb52de3455423542 => CRC32 ->
ecec6492
ONEPLUS_YOU_CAN_PASS_NOW => sha1 = 9db4b7338e254669b8c703e77cbc9f119ade7fa6 => CRC32 -> 79707450 (wenn < 8, dann fill mit 0)
'''
'''
com.android.engineeringmode.encrypt
3439 = oem.cust.flag 1 = French custom edition
9339 = oem.cust.flag 2 = Indian edition
3392 = oem.cust.flag 0 = Normal edition
7668 = com.android.engineeringmode.manualtest.CheckRootStatusActivity
5646 = com.android.engineeringmode.manualtest.DecryptActivity
838 = com.android.engineeringmode.manualtest.CheckRootStatusActivity
com.oneplus.factorymode.CommonCommands
com.oem.engineermode.DoShellCommond
if(!arg18.getAction().equals(v1.mAction) && !arg18.getAction().equals(v1.na)) {
if((arg18.getAction().equals(v1.doshellcommond)) && ("get_config_params".equals(v0.getStringExtra("shell_cmd")))) {
adb shell am start -n com.oem.engineermode.DoShellCommond --es "shell_cmd" "get_config_params"
action android:name
adb shell am start -n com.android.engineeringmode/.qualcomm.DiagEnabled --es "code" "Angela"
79a6a933dfc9b1975e444d4e8481c64c771d8ab40b7ac72f8bc1a1bca1718bef
android.provider.Telephony.SECRET_CODE
*#66# com.android.engineeringmode.IMeiAndPcbCheck
*#99# com.android.engineeringmode.KeepSrceenOn
*#008# com.android.engineeringmode.LanguageSwitchToChineseActivity
*#268# com.android.engineeringmode.qualcomm.QualCommActivity
*#391# com.android.engineeringmode.SwitchSoftwareVersion
*#789# com.android.engineeringmode.qualcomm.ClearTelcelnetlock
*#800# com.android.engineeringmode.qualcomm.LogSwitch
*#800# com.oem.oemlogkit.OEMLogKitMainActivity
*#801# com.android.engineeringmode.qualcomm.DiagEnabled
*#802# com.android.engineeringmode.gps.GpsActivity
*#803# com.android.engineeringmode.wifitest.WifiSettings
*#804# com.android.engineeringmode.NetworkSearch
*#805# com.android.engineeringmode.bluetoothtest.BluetoothTest
*#806# com.android.engineeringmode.autoaging.AutoAgingMainListActivity
*#807# com.android.engineeringmode.autotest.AutoTest
*#808# com.android.engineeringmode.EngineerModeMain
*#808# com.android.engineeringmode.manualtest.ManualTest
*#809# com.android.engineeringmode.echotest.EchoTest
*#810# com.android.engineeringmode.SwitchSetupWizardActivity
*#814# com.android.engineeringmode.TDSNetworkSearch
*#818# com.android.engineeringmode.NetworkSearch_New
*#820# com.android.engineeringmode.DeleteNoNeedFilesActivity
*#824# com.android.engineeringmode.WCDMANetworkSearch
*#834# com.android.engineeringmode.LTENetworkSearch
*#838# com.android.engineeringmode.NetworkSearch_New
*#845# com.android.engineeringmode.wifitest.WifiApSettings
*#888# com.android.engineeringmode.PcbShow
*#899# com.oneplus.factorymode.aftersale.ChooseBackCoverColor
*#900# com.android.engineeringmode.BackCameraAdjusting
*#911# com.android.engineeringmode.PowerOff (Warning: Does factory reset)
*#912# com.android.engineeringmode.qualcomm.RecoverTelcelnetlock
*#912# com.android.engineeringmode.RebootManager
*#928# com.android.engineeringmode.wifitest.WifiFTMActivity
*#1234# com.android.engineeringmode.SHOW_ONEPLUS_VERSION
*#4321# com.android.engineeringmode.LanguageSwitchToZimbabweService
*#6776# com.android.engineeringmode.CheckSoftwareInfo
*#7327# com.oem.rftoolkit.RfToolkitCustomerService
*#7328# com.oem.rftoolkit.RfToolkitAgingTest
*#7332# com.oem.rftoolkit.RfToolkitFactory
*#8011# com.android.engineeringmode.NoUI
*#8017# com.android.engineeringmode.wifitest.WifiAdbHelper
*#8019# com.android.engineeringmode.wifitest.WifiSocketHelper
*#8020# com.android.engineeringmode.wifitest.WifiAdbHelper
*##*8110# com.android.engineeringmode.qualcomm.OtaSwitch
*#8668# com.oneplus.activation.action.STOP_ACTIVATION
*#8669# com.oneplus.activation.action.START_ACTIVATION
*#8778# com.android.engineeringmode.manualtest.MasterClear
*#8888# com.android.engineeringmode.manualtest.MasterClear
*#9886# com.oneplus.screensaver.off
*#9889# com.oneplus.screensaver.on
*#10000# com.android.engineeringmode.MarkResultShow
*#12345# com.android.activation.action.STOP_SERVICE
*#3954391# Switch activated
*##*37847# com.android.engineeringmode.manualtest.DeviceListActivity
*#2288379# com.android.engineeringmode.BatteryExtraInfo
*#36446337# com.android.engineeringmode.EngineeringMode
*#6776001# set_language en_US
*#6776007# set_language ru_RU
*#67760052# set_language es_MX
*#67760055# set_language pt_BR
*#67760066# set_language th_TH
*#67760062# set_language in_IN
*#67760084# set_language vi_VI
*#67760086# set_language zh_CN
*#67760886# set_language zh_TW
*#67760044# com.android.engineeringmode.LanguageSwitchToEnglishActivity
*#67766776# com.android.engineeringmode.oneplusConnectionADBActivity
*#677667764482# com.android.engineeringmode.UserAgentSwitchService
*#*#5646#*#* com.android.engineeringmode.manualtest.DecryptActivity
*#*#7668#*#* com.android.engineeringmode.manualtest.CheckRootStatusActivity
*#3439# = oem.cust.flag=1
*#9339# = oem.cust.flag=2
*#3392# = oem.cust.flag=0
fastboot ops 4F50040TR18FTR7FSTD5F01
fastboot ops help
fastboot ops 4F50040TR18FTR7FSTD5F01
fastboot ops devkmsg on
fastboot ops boottype debug
(bootloader) ops android_log_all
(bootloader) ops kernel_log_all
(bootloader) ops devkmsg
(bootloader) ops boottype [normal, debug, sdebug]
(bootloader) ops set_cust
(bootloader) ops force_adb
(bootloader) ops qeaging_data_img
(bootloader) ops unmount tempfs
(bootloader) ops mount tempfs
(bootloader) ops enable_dm_verity
(bootloader) ops disable_dm_verity
(bootloader) ops boot_mode [rf,ftm,wlan,normal]
(bootloader) ops selinux
(bootloader) ops dump
(bootloader) ops help
(bootloader) ops datafs
(bootloader) ops unforce_training
(bootloader) ops force_training
(bootloader) ops reboot-bootloader
(bootloader) ops reboot-shutdown
(bootloader) ops kmemleak undetect
(bootloader) ops kmemleak detect
(bootloader) ops unconsole
(bootloader) ops console
(bootloader) oem get_unlock_code
(bootloader) oem lock
(bootloader) oem unlock
(bootloader) download:
(bootloader) getvar:
(bootloader) reboot-bootloader
(bootloader) reboot
(bootloader) continue
(bootloader) oem device-info
(bootloader) oem select-display-panel
(bootloader) oem off-mode-charge
(bootloader) oem disable-charger-screen
(bootloader) oem enable-charger-screen
(bootloader) boot
(bootloader) flashing lock
(bootloader) flashing unlock
(bootloader) flashing get_unlock_ability
(bootloader) set_active
(bootloader) erase:
(bootloader) flash:
(bootloader) Varlist
(bootloader) hw-revision:20001
(bootloader) unlocked:no
(bootloader) off-mode-charge:1
(bootloader) charger-screen-enabled:1
(bootloader) battery-soc-ok:yes
(bootloader) battery-voltage:4360
(bootloader) version-baseband:
(bootloader) version-bootloader:
(bootloader) erase-block-size: 0x1000
(bootloader) logical-block-size: 0x1000
(bootloader) variant:SDM UFS
(bootloader) partition-type:fsc:raw
(bootloader) partition-size:fsc: 0x20000
(bootloader) partition-type:fsg:raw
(bootloader) partition-size:fsg: 0x200000
(bootloader) partition-type:modemst2:raw
(bootloader) partition-size:modemst2: 0x200000
(bootloader) partition-type:modemst1:raw
(bootloader) partition-size:modemst1: 0x200000
(bootloader) partition-type:ALIGN_TO_128K_2:raw
(bootloader) partition-size:ALIGN_TO_128K_2: 0x1A000
(bootloader) partition-type:ImageFv:raw
(bootloader) partition-size:ImageFv: 0x200000
(bootloader) partition-type:logdump:raw
(bootloader) partition-size:logdump: 0x4000000
(bootloader) partition-type:sti:raw
(bootloader) partition-size:sti: 0x200000
(bootloader) partition-type:logfs:raw
(bootloader) partition-size:logfs: 0x800000
(bootloader) partition-type:toolsfv:raw
(bootloader) partition-size:toolsfv: 0x100000
(bootloader) partition-type:limits:raw
(bootloader) partition-size:limits: 0x1000
(bootloader) partition-type:splash:raw
(bootloader) partition-size:splash: 0x20A4000
(bootloader) partition-type:spunvm:raw
(bootloader) partition-size:spunvm: 0x800000
(bootloader) partition-type:msadp:raw
(bootloader) partition-size:msadp: 0x40000
(bootloader) partition-type:apdp:raw
(bootloader) partition-size:apdp: 0x40000
(bootloader) partition-type:dip:raw
(bootloader) partition-size:dip: 0x100000
(bootloader) partition-type:devinfo:raw
(bootloader) partition-size:devinfo: 0x1000
(bootloader) partition-type:sec:raw
(bootloader) partition-size:sec: 0x4000
(bootloader) partition-type:op1:raw
(bootloader) partition-size:op1: 0x6400000
(bootloader) partition-type:aging:raw
(bootloader) partition-size:aging: 0x4000000
(bootloader) partition-type:minidump:raw
(bootloader) partition-size:minidump: 0x6400000
(bootloader) partition-type:fw_ufs8_b:raw
(bootloader) partition-size:fw_ufs8_b: 0x200000
(bootloader) partition-type:fw_ufs7_b:raw
(bootloader) partition-size:fw_ufs7_b: 0x200000
(bootloader) partition-type:fw_ufs6_b:raw
(bootloader) partition-size:fw_ufs6_b: 0x200000
(bootloader) partition-type:fw_ufs5_b:raw
(bootloader) partition-size:fw_ufs5_b: 0x200000
(bootloader) partition-type:fw_ufs4_b:raw
(bootloader) partition-size:fw_ufs4_b: 0x200000
(bootloader) partition-type:fw_ufs3_b:raw
(bootloader) partition-size:fw_ufs3_b: 0x200000
(bootloader) partition-type:fw_4u1ea_b:raw
(bootloader) partition-size:fw_4u1ea_b: 0x200000
(bootloader) partition-type:fw_4j1ed_b:raw
(bootloader) partition-size:fw_4j1ed_b: 0x200000
(bootloader) partition-type:LOGO_b:raw
(bootloader) partition-size:LOGO_b: 0x1000000
(bootloader) partition-type:storsec_b:raw
(bootloader) partition-size:storsec_b: 0x20000
(bootloader) partition-type:dtbo_b:raw
(bootloader) partition-size:dtbo_b: 0x800000
(bootloader) partition-type:vbmeta_b:raw
(bootloader) partition-size:vbmeta_b: 0x10000
(bootloader) partition-type:vendor_b:raw
(bootloader) partition-size:vendor_b: 0x40000000
(bootloader) partition-type:qupfw_b:raw
(bootloader) partition-size:qupfw_b: 0x10000
(bootloader) partition-type:devcfg_b:raw
(bootloader) partition-size:devcfg_b: 0x20000
(bootloader) partition-type:cmnlib64_b:raw
(bootloader) partition-size:cmnlib64_b: 0x80000
(bootloader) partition-type:cmnlib_b:raw
(bootloader) partition-size:cmnlib_b: 0x80000
(bootloader) partition-type:boot_b:raw
(bootloader) partition-size:boot_b: 0x4000000
(bootloader) partition-type:keymaster_b:raw
(bootloader) partition-size:keymaster_b: 0x80000
(bootloader) partition-type:dsp_b:raw
(bootloader) partition-size:dsp_b: 0x2000000
(bootloader) partition-type:abl_b:raw
(bootloader) partition-size:abl_b: 0x800000
(bootloader) partition-type:mdtp_b:raw
(bootloader) partition-size:mdtp_b: 0x2000000
(bootloader) partition-type:mdtpsecapp_b:raw
(bootloader) partition-size:mdtpsecapp_b: 0x400000
(bootloader) partition-type:bluetooth_b:raw
(bootloader) partition-size:bluetooth_b: 0x100000
(bootloader) partition-type:modem_b:raw
(bootloader) partition-size:modem_b: 0x7800000
(bootloader) partition-type:hyp_b:raw
(bootloader) partition-size:hyp_b: 0x80000
(bootloader) partition-type:tz_b:raw
(bootloader) partition-size:tz_b: 0x200000
(bootloader) partition-type:aop_b:raw
(bootloader) partition-size:aop_b: 0x80000
(bootloader) partition-type:fw_ufs8_a:raw
(bootloader) partition-size:fw_ufs8_a: 0x200000
(bootloader) partition-type:fw_ufs7_a:raw
(bootloader) partition-size:fw_ufs7_a: 0x200000
(bootloader) partition-type:fw_ufs6_a:raw
(bootloader) partition-size:fw_ufs6_a: 0x200000
(bootloader) partition-type:fw_ufs5_a:raw
(bootloader) partition-size:fw_ufs5_a: 0x200000
(bootloader) partition-type:fw_ufs4_a:raw
(bootloader) partition-size:fw_ufs4_a: 0x200000
(bootloader) partition-type:fw_ufs3_a:raw
(bootloader) partition-size:fw_ufs3_a: 0x200000
(bootloader) partition-type:fw_4u1ea_a:raw
(bootloader) partition-size:fw_4u1ea_a: 0x200000
(bootloader) partition-type:fw_4j1ed_a:raw
(bootloader) partition-size:fw_4j1ed_a: 0x200000
(bootloader) partition-type:LOGO_a:raw
(bootloader) partition-size:LOGO_a: 0x1000000
(bootloader) partition-type:storsec_a:raw
(bootloader) partition-size:storsec_a: 0x20000
(bootloader) partition-type:dtbo_a:raw
(bootloader) partition-size:dtbo_a: 0x800000
(bootloader) partition-type:vbmeta_a:raw
(bootloader) partition-size:vbmeta_a: 0x10000
(bootloader) partition-type:vendor_a:raw
(bootloader) partition-size:vendor_a: 0x40000000
(bootloader) partition-type:qupfw_a:raw
(bootloader) partition-size:qupfw_a: 0x10000
(bootloader) partition-type:devcfg_a:raw
(bootloader) partition-size:devcfg_a: 0x20000
(bootloader) partition-type:cmnlib64_a:raw
(bootloader) partition-size:cmnlib64_a: 0x80000
(bootloader) partition-type:cmnlib_a:raw
(bootloader) partition-size:cmnlib_a: 0x80000
(bootloader) partition-type:boot_a:raw
(bootloader) partition-size:boot_a: 0x4000000
(bootloader) partition-type:keymaster_a:raw
(bootloader) partition-size:keymaster_a: 0x80000
(bootloader) partition-type:dsp_a:raw
(bootloader) partition-size:dsp_a: 0x2000000
(bootloader) partition-type:abl_a:raw
(bootloader) partition-size:abl_a: 0x800000
(bootloader) partition-type:mdtp_a:raw
(bootloader) partition-size:mdtp_a: 0x2000000
(bootloader) partition-type:mdtpsecapp_a:raw
(bootloader) partition-size:mdtpsecapp_a: 0x400000
(bootloader) partition-type:bluetooth_a:raw
(bootloader) partition-size:bluetooth_a: 0x100000
(bootloader) partition-type:modem_a:raw
(bootloader) partition-size:modem_a: 0x7800000
(bootloader) partition-type:hyp_a:raw
(bootloader) partition-size:hyp_a: 0x80000
(bootloader) partition-type:tz_a:raw
(bootloader) partition-size:tz_a: 0x200000
(bootloader) partition-type:aop_a:raw
(bootloader) partition-size:aop_a: 0x80000
(bootloader) partition-type:ddr:raw
(bootloader) partition-size:ddr: 0x100000
(bootloader) partition-type:cdt:raw
(bootloader) partition-size:cdt: 0x20000
(bootloader) partition-type:ALIGN_TO_128K_1:raw
(bootloader) partition-size:ALIGN_TO_128K_1: 0x1A000
(bootloader) partition-type:xbl_config_b:raw
(bootloader) partition-size:xbl_config_b: 0x20000
(bootloader) partition-type:xbl_b:raw
(bootloader) partition-size:xbl_b: 0x380000
(bootloader) partition-type:xbl_config_a:raw
(bootloader) partition-size:xbl_config_a: 0x20000
(bootloader) partition-type:xbl_a:raw
(bootloader) partition-size:xbl_a: 0x380000
(bootloader) partition-type:userdata:ext4
(bootloader) partition-size:userdata: 0x1B800BB000
(bootloader) partition-type:odm_b:raw
(bootloader) partition-size:odm_b: 0x6400000
(bootloader) partition-type:odm_a:raw
(bootloader) partition-size:odm_a: 0x6400000
(bootloader) partition-type:system_b:ext4
(bootloader) partition-size:system_b: 0xB2C00000
(bootloader) partition-type:system_a:ext4
(bootloader) partition-size:system_a: 0xB2C00000
(bootloader) partition-type:config:raw
(bootloader) partition-size:config: 0x80000
(bootloader) partition-type:reserve2:raw
(bootloader) partition-size:reserve2: 0xFD0000
(bootloader) partition-type:reserve1:raw
(bootloader) partition-size:reserve1: 0x7E8000
(bootloader) partition-type:oem_stanvbk:raw
(bootloader) partition-size:oem_stanvbk: 0xA00000
(bootloader) partition-type:oem_dycnvbk:raw
(bootloader) partition-size:oem_dycnvbk: 0xA00000
(bootloader) partition-type:op2:raw
(bootloader) partition-size:op2: 0x10000000
(bootloader) partition-type:frp:raw
(bootloader) partition-size:frp: 0x80000
(bootloader) partition-type:keystore:raw
(bootloader) partition-size:keystore: 0x80000
(bootloader) partition-type:param:raw
(bootloader) partition-size:param: 0x100000
(bootloader) partition-type:misc:raw
(bootloader) partition-size:misc: 0x100000
(bootloader) partition-type:persist:raw
(bootloader) partition-size:persist: 0x2000000
(bootloader) partition-type:ssd:raw
(bootloader) partition-size:ssd: 0x2000
(bootloader) has-slot:modem:yes
(bootloader) has-slot:system:yes
(bootloader) current-slot:b
(bootloader) has-slot:boot:yes
(bootloader) slot-retry-count:b:6
(bootloader) slot-unbootable:b:no
(bootloader) slot-successful:b:yes
(bootloader) slot-retry-count:a:6
(bootloader) slot-unbootable:a:no
(bootloader) slot-successful:a:yes
(bootloader) slot-count:2
(bootloader) secure:yes
(bootloader) serialno:45751efa
(bootloader) product:sdm845
(bootloader) max-download-size:536870912
(bootloader) kernel:uefi
25d52959
am broadcast -n com.oneplus.factorymode/.EngineerModeActionReceiver -a android.provider.Telephony.SECRET_CODE -d android_secret_code://5646
am broadcast -n com.oneplus.factorymode/.EngineerModeActionReceiver -a com.android.engineeringmode.encrypt
am broadcast -n com.oneplus.factorymode/.EngineerModeActionReceiver -a
com.oem.engineermode.StartOEMLogMain
IMEI:866241047809937
'''
def main():
from docopt import docopt
args = docopt(__doc__, version='oneplus 1.1')
# filename="param_jacob_7pro.bin"
# filename="chris/param.bin"
if args["param"]:
filename = args["<filename>"]
mode = args["--mode"]
serial = args["--serial"]
param = paramtools(mode,serial)
with open(filename, 'rb') as rf:
data = rf.read()
param.parse_decrypted_fields(data)
print("\nEncrypted Values:\n-----------------\n")
param.parse_encrypted_fields(data)
# with open(filename + ".patched", 'wb') as wf:
# wf.write(param.setfactoryflags(data))
elif args["ops"]:
filename = args["<filename>"]
mode = args["--mode"]
serial = args["--serial"]
param = paramtools(mode,serial)
with open(filename, 'rb') as rf:
data = rf.read()
with open(filename + ".patched", 'wb') as wf:
try:
data = param.setparamvalue(data, 0x12C, 0x80, 0x3) # >= Oneplus 5
except:
pass
data = param.setparamvalue(data, 0xC, 0x1A4, 0x1) # < Oneplus 5
wf.write(data)
elif args["setparam"]:
filename = args["<filename>"]
sid = int(args["<sid>"], 16)
offset = int(args["<offset>"], 16)
value = int(args["<value>"], 16)
mode = args["--mode"]
serial = args["--serial"]
param = paramtools(mode,serial)
with open(filename, 'rb') as rf:
data = rf.read()
with open(filename + ".patched", 'wb') as wf:
wf.write(param.setparamvalue(data, sid, offset, value))
elif args["gencode"]:
imei = args["<imei>"]
mode = 0
serial = None
param = paramtools(mode,serial)
print("oneplus Factory qr code generator (c) B. Kerler 2019\nGPLv3 License\n----------------------")
print("Code : *#*#5646#*#* , *#808#, *#36446337# = com.android.engineeringmode.manualtest.DecryptActivity")
results = param.gencode([imei, "YOU_CAN_PASS_NOW"])
img = qrcode.make("op_eng://" + results[0])
print("Code : " + results[0])
img.save(imei + ".png")
print("Image written as " + imei + ".png")
if __name__ == "__main__":
main()

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import logging import logging
from edlclient.Library.utils import LogBase from edlclient.Library.utils import LogBase

View file

@ -1,7 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
from capstone import * from capstone import *
from keystone import * from keystone import *
from binascii import unhexlify from binascii import unhexlify

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2019 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import hashlib import hashlib
from Cryptodome.Cipher import AES from Cryptodome.Cipher import AES

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2019 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import binascii import binascii
import io import io

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2019 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import os import os
import sys import sys

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 MIT License # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import os import os
import sys import sys
import argparse import argparse

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2019 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import logging import logging
from binascii import hexlify from binascii import hexlify

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2022 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import binascii import binascii
import time import time
import os import os
@ -11,8 +15,12 @@ from struct import unpack, pack
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir) parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir) sys.path.insert(0, parent_dir)
from edlclient.Library.utils import read_object, print_progress, rmrf, LogBase try:
from edlclient.Config.qualcomm_config import sochw, msmids, root_cert_hash from edlclient.Library.utils import read_object, print_progress, rmrf, LogBase
from edlclient.Config.qualcomm_config import sochw, msmids, root_cert_hash
except:
from Library.utils import read_object, print_progress, rmrf, LogBase
from Config.qualcomm_config import sochw, msmids, root_cert_hash
class loader_utils(metaclass=LogBase): class loader_utils(metaclass=LogBase):
def __init__(self, loglevel=logging.INFO): def __init__(self, loglevel=logging.INFO):

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import os import os
import pt64 import pt64

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2019 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import ctypes import ctypes
from enum import Enum from enum import Enum
from edlclient.Config.qualcomm_config import secgen, secureboottbl from edlclient.Config.qualcomm_config import secgen, secureboottbl

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import binascii import binascii
import time import time
import os import os

View file

@ -1,3 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
from edlclient.Library.utils import structhelper_io from edlclient.Library.utils import structhelper_io
from io import BytesIO from io import BytesIO

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import logging import logging
import sys import sys
import os import os

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
from struct import pack from struct import pack
from binascii import unhexlify from binascii import unhexlify
from edlclient.Library.utils import * from edlclient.Library.utils import *

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import sys import sys
import os import os
import logging import logging

View file

@ -1,3 +1,10 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
class open_mode_type: class open_mode_type:
OPEN_MODE_NONE = 0x00 # Not opened yet OPEN_MODE_NONE = 0x00 # Not opened yet
OPEN_BOOTLOADER = 0x01 # Bootloader Image OPEN_BOOTLOADER = 0x01 # Bootloader Image

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import sys import sys
import logging import logging
import logging.config import logging.config

View file

@ -1,6 +1,10 @@
#!/usr/bin/python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET

1
edlclient/Tools/Config Symbolic link
View file

@ -0,0 +1 @@
../Config

1
edlclient/Tools/Library Symbolic link
View file

@ -0,0 +1 @@
../Library

View file

@ -1,5 +1,11 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# Beagle to EDL Loader (c) B.Kerler 2021 # -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
# Beagle to EDL Loader
import os,sys import os,sys
from struct import unpack from struct import unpack

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2020 under MIT license # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name # If you use my code, make sure you refer to my name
# If you want to use in a commercial product, ask me before integrating it #
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import time import time
import serial import serial
import serial.tools.list_ports import serial.tools.list_ports

View file

@ -1,8 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2020-2021 under MIT license # (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name # If you use my code, make sure you refer to my name
# If you want to use in a commercial product, ask me before integrating it #
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import time import time
from Exscript.protocols import Telnet from Exscript.protocols import Telnet
import serial import serial
@ -30,15 +32,76 @@ except ImportError:
sys.path.insert(0, parent_dir) sys.path.insert(0, parent_dir)
from sierrakeygen import SierraKeygen from sierrakeygen import SierraKeygen
try: import logging
from edlclient.Library.utils import LogBase import logging.config
except Exception as e: import logging.handlers
import os, sys, inspect import colorama
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) class ColorFormatter(logging.Formatter):
parent_dir = os.path.dirname(current_dir) LOG_COLORS = {
sys.path.insert(0, parent_dir) logging.ERROR: colorama.Fore.RED,
from edlclient.Library.utils import LogBase logging.DEBUG: colorama.Fore.LIGHTMAGENTA_EX,
logging.WARNING: colorama.Fore.YELLOW,
}
def format(self, record, *args, **kwargs):
# if the corresponding logger has children, they may receive modified
# record, so we want to keep it intact
new_record = copy.copy(record)
if new_record.levelno in self.LOG_COLORS:
pad = ""
if new_record.name != "root":
print(new_record.name)
pad = "[LIB]: "
# we want levelname to be in different color, so let's modify it
new_record.msg = "{pad}{color_begin}{msg}{color_end}".format(
pad=pad,
msg=new_record.msg,
color_begin=self.LOG_COLORS[new_record.levelno],
color_end=colorama.Style.RESET_ALL,
)
# now we can let standart formatting take care of the rest
return super(ColorFormatter, self).format(new_record, *args, **kwargs)
class LogBase(type):
debuglevel = logging.root.level
def __init__(cls, *args):
super().__init__(*args)
logger_attribute_name = '_' + cls.__name__ + '__logger'
logger_debuglevel_name = '_' + cls.__name__ + '__debuglevel'
logger_name = '.'.join([c.__name__ for c in cls.mro()[-2::-1]])
LOG_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"root": {
"()": ColorFormatter,
"format": "%(name)s - %(message)s",
}
},
"handlers": {
"root": {
# "level": cls.__logger.level,
"formatter": "root",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
}
},
"loggers": {
"": {
"handlers": ["root"],
# "level": cls.debuglevel,
"propagate": False
}
},
}
logging.config.dictConfig(LOG_CONFIG)
logger = logging.getLogger(logger_name)
setattr(cls, logger_attribute_name, logger)
setattr(cls, logger_debuglevel_name, cls.debuglevel)
class vendor(Enum): class vendor(Enum):
@ -491,7 +554,7 @@ class adbtools(metaclass=LogBase):
def main(): def main():
version = "1.2" version = "1.2"
info = '\nModem Gimme-ADB ' + version + ' (c) B. Kerler 2020-2021\n-------------------------------------------\n' info = '\nModem Gimme-ADB ' + version + ' (c) B. Kerler 2020-2023\n-------------------------------------------\n'
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=info) parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=info)
parser.add_argument( parser.add_argument(
'-mode', help='Mode: enable or disable', '-mode', help='Mode: enable or disable',

View file

@ -1,4 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2018-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import os import os
import sys import sys
from os import walk from os import walk
@ -7,12 +13,9 @@ from struct import unpack, pack
from shutil import copyfile from shutil import copyfile
import os, sys, inspect import os, sys, inspect
from io import BytesIO from io import BytesIO
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) from Library.utils import elf
parent_dir = os.path.dirname(os.path.dirname(current_dir)) from Library.loader_db import loader_utils
sys.path.insert(0, parent_dir) from Config.qualcomm_config import vendor
from edlclient.Library.utils import elf
from edlclient.Library.loader_db import loader_utils
from edlclient.Config.qualcomm_config import vendor
lu=loader_utils() lu=loader_utils()

View file

@ -1,7 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" # -*- coding: utf-8 -*-
Licensed under MIT License, (c) B. Kerler 2018-2021 # (c) B.Kerler 2018-2023 under GPLv3 license
""" # If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import inspect import inspect
import argparse import argparse
import json import json
@ -17,11 +20,11 @@ current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentfra
parent_dir = os.path.dirname(os.path.dirname(current_dir)) parent_dir = os.path.dirname(os.path.dirname(current_dir))
sys.path.insert(0, parent_dir) sys.path.insert(0, parent_dir)
from edlclient.Library.utils import print_progress, read_object, write_object, LogBase from Library.utils import print_progress, read_object, write_object, LogBase
from edlclient.Library.Connection.usblib import usb_class from Library.Connection.usblib import usb_class
from edlclient.Library.Connection.seriallib import serial_class from Library.Connection.seriallib import serial_class
from edlclient.Library.hdlc import hdlc from Library.hdlc import hdlc
from edlclient.Config.usb_ids import default_diag_vid_pid from Config.usb_ids import default_diag_vid_pid
qcerror = { qcerror = {
1: "None", 1: "None",
@ -332,9 +335,14 @@ class qcdiag(metaclass=LogBase):
self.__logger.addHandler(fh) self.__logger.addHandler(fh)
import os, inspect import os, inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(os.path.dirname(current_dir)) try:
nvxml = os.path.join(parent_dir, "edlclient", "Config", "nvitems.xml") parent_dir = os.path.dirname(os.path.dirname(current_dir))
e = ElementTree.parse(nvxml).getroot() nvxml = os.path.join(parent_dir, "edlclient", "Config", "nvitems.xml")
e = ElementTree.parse(nvxml).getroot()
except:
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
nvxml = os.path.join(current_dir, "edlclient", "Config", "nvitems.xml")
e = ElementTree.parse(nvxml).getroot()
for atype in e.findall("nv"): for atype in e.findall("nv"):
name = atype.get("name") name = atype.get("name")
identifier = int(atype.get("id")) identifier = int(atype.get("id"))

View file

@ -1,24 +1,88 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) B.Kerler 2019-2020 under MIT license # (c) B.Kerler 2019-2023 under GPLv3 license
# If you use my code, make sure you refer to my name # If you use my code, make sure you refer to my name
# If you want to use in a commercial product, ask me before integrating it #
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
import copy
import sys import sys
import argparse import argparse
import time import time
import serial.tools.list_ports import serial.tools.list_ports
from Exscript.protocols import Telnet from Exscript.protocols import Telnet
from binascii import hexlify, unhexlify from binascii import hexlify, unhexlify
import logging
import logging.config
import logging.handlers
import colorama
class ColorFormatter(logging.Formatter):
LOG_COLORS = {
logging.ERROR: colorama.Fore.RED,
logging.DEBUG: colorama.Fore.LIGHTMAGENTA_EX,
logging.WARNING: colorama.Fore.YELLOW,
}
def format(self, record, *args, **kwargs):
# if the corresponding logger has children, they may receive modified
# record, so we want to keep it intact
new_record = copy.copy(record)
if new_record.levelno in self.LOG_COLORS:
pad = ""
if new_record.name != "root":
print(new_record.name)
pad = "[LIB]: "
# we want levelname to be in different color, so let's modify it
new_record.msg = "{pad}{color_begin}{msg}{color_end}".format(
pad=pad,
msg=new_record.msg,
color_begin=self.LOG_COLORS[new_record.levelno],
color_end=colorama.Style.RESET_ALL,
)
# now we can let standart formatting take care of the rest
return super(ColorFormatter, self).format(new_record, *args, **kwargs)
class LogBase(type):
debuglevel = logging.root.level
def __init__(cls, *args):
super().__init__(*args)
logger_attribute_name = '_' + cls.__name__ + '__logger'
logger_debuglevel_name = '_' + cls.__name__ + '__debuglevel'
logger_name = '.'.join([c.__name__ for c in cls.mro()[-2::-1]])
LOG_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"root": {
"()": ColorFormatter,
"format": "%(name)s - %(message)s",
}
},
"handlers": {
"root": {
# "level": cls.__logger.level,
"formatter": "root",
"class": "logging.StreamHandler",
"stream": "ext://sys.stdout",
}
},
"loggers": {
"": {
"handlers": ["root"],
# "level": cls.debuglevel,
"propagate": False
}
},
}
logging.config.dictConfig(LOG_CONFIG)
logger = logging.getLogger(logger_name)
setattr(cls, logger_attribute_name, logger)
setattr(cls, logger_debuglevel_name, cls.debuglevel)
try:
from edlclient.Library.utils import LogBase
except Exception as e:
import os,inspect
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
parent_dir = os.path.dirname(current_dir)
sys.path.insert(0, parent_dir)
from Library.utils import LogBase
''' '''
C7 = 7 0 0 2 7 5 0 C7 = 7 0 0 2 7 5 0
@ -58,10 +122,12 @@ prodtable = {
run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # EM7565 run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # EM7565
"MDM9x06": dict(openlock=20, openmep=19, opencnd=20, clen=8, init=[7, 3, 0, 1, 5], "MDM9x06": dict(openlock=20, openmep=19, opencnd=20, clen=8, init=[7, 3, 0, 1, 5],
run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # WP77xx run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), # WP77xx
"SDX55": dict(openlock=22, openmep=21, opencnd=22, clen=8, init=[7, 3, 0, 1, 5], #MR5100 "SDX55": dict(openlock=22, openmep=21, opencnd=22, clen=8, init=[7, 3, 0, 1, 5], # MR5100, MR6400 old fw
run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"), run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"),
"MDM9x15A": dict(openlock=24, openmep=23, opencnd=24, clen=8, init=[7, 3, 0, 1, 5], #AC779S "MDM9x15A": dict(openlock=24, openmep=23, opencnd=24, clen=8, init=[7, 3, 0, 1, 5], # AC779S
run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)") run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)"),
"SDX65": dict(openlock=25, openmep=21, opencnd=26, clen=8, init=[7, 3, 0, 1, 5], # MR6400 new fw
run="resultbuffer[i]=self.SierraAlgo(challenge[i], 4, 2, 1, 0, 3, 2, 0, 0)")
} }
infotable = { infotable = {
@ -83,63 +149,67 @@ infotable = {
"MDM9x30_V1": ["Netgear AC790/MDM9230"], "MDM9x30_V1": ["Netgear AC790/MDM9230"],
"MDM9x40": ["AC815s", "AC785s", "AC797S", "MR1100"], "MDM9x40": ["AC815s", "AC785s", "AC797S", "MR1100"],
"MDM9x50": ["EM7565", "EM7565-9", "EM7511", "EM7411"], "MDM9x50": ["EM7565", "EM7565-9", "EM7511", "EM7411"],
"SDX55" : ["MR5100","MR5200","ac797-100eus","MR6400"] "SDX55": ["MR5100", "MR5200", "ac797-100eus", "MR6400"],
"SDX65": ["MR6400", "MR6500", "MR6110", "MR6150", "MR6450", "MR6550"]
} }
keytable = bytearray([0xF0, 0x14, 0x55, 0x0D, 0x5E, 0xDA, 0x92, 0xB3, 0xA7, 0x6C, 0xCE, 0x84, 0x90, 0xBC, 0x7F, 0xED,
# 0 MC8775_H2.0.8.19 !OPENLOCK, !OPENCND .. MC8765V,MC8765,MC8755V,MC8775,MC8775V,MC8775,AC850, # 0 MC8775_H2.0.8.19 !OPENLOCK, !OPENCND .. MC8765V,MC8765,MC8755V,MC8775,MC8775V,MC8775,AC850,
# AC860,AC875,AC881,AC881U,AC875, AC340U 1.13.12.14 # AC860,AC875,AC881,AC881U,AC875, AC340U 1.13.12.14
0x61, 0x94, 0xCE, 0xA7, 0xB0, 0xEA, 0x4F, 0x0A, 0x73, 0xC5, 0xC3, 0xA6, 0x5E, 0xEC, 0x1C, 0xE2, keytable = bytearray([0xF0, 0x14, 0x55, 0x0D, 0x5E, 0xDA, 0x92, 0xB3, 0xA7, 0x6C, 0xCE, 0x84, 0x90, 0xBC, 0x7F, 0xED,
# 1 MC8775_H2.0.8.19 AC340U, OPENMEP default # 1 MC8775_H2.0.8.19 AC340U, OPENMEP default
0x39, 0xC6, 0x7B, 0x04, 0xCA, 0x50, 0x82, 0x1F, 0x19, 0x63, 0x36, 0xDE, 0x81, 0x49, 0xF0, 0xD7,
# 2 AC750,AC710,AC7XX,SB750A,SB750,PC7000,AC313u OPENMEP
0xDE, 0xA5, 0xAD, 0x2E, 0xBE, 0xE1, 0xC9, 0xEF, 0xCA, 0xF9, 0xFE, 0x1F, 0x17, 0xFE, 0xED, 0x3B,
# 3 AC775,PC7200
0xFE, 0xD4, 0x40, 0x52, 0x2D, 0x4B, 0x12, 0x5C, 0xE7, 0x0D, 0xF8, 0x79, 0xF8, 0xC0, 0xDD, 0x37,
# 4 MC7455_02.30.01.01 OPENMEP
0x3B, 0x18, 0x99, 0x6B, 0x57, 0x24, 0x0A, 0xD8, 0x94, 0x6F, 0x8E, 0xD9, 0x90, 0xBC, 0x67, 0x56,
# 5 MC7455_02.30.01.01 OPENLOCK
0x47, 0x4F, 0x4F, 0x44, 0x4A, 0x4F, 0x42, 0x44, 0x45, 0x43, 0x4F, 0x44, 0x49, 0x4E, 0x47, 0x2E,
# 6 SWI9x50 Openmep Key SWI9X50C_01.08.04.00
0x4F, 0x4D, 0x41, 0x52, 0x20, 0x44, 0x49, 0x44, 0x20, 0x54, 0x48, 0x49, 0x53, 0x2E, 0x2E, 0x2E,
# 7 SWI9x50 Openlock Key SWI9X50C_01.08.04.00
0x8F, 0xA5, 0x85, 0x05, 0x5E, 0xCF, 0x44, 0xA0, 0x98, 0x8B, 0x09, 0xE8, 0xBB, 0xC6, 0xF7, 0x65,
# 8 MDM8200 Special
0x4D, 0x42, 0xD8, 0xC1, 0x25, 0x44, 0xD8, 0xA0, 0x1D, 0x80, 0xC4, 0x52, 0x8E, 0xEC, 0x8B, 0xE3,
# 9 SWI9x07 Openlock Key 02.25.02.01
0xED, 0xA9, 0xB7, 0x0A, 0xDB, 0x85, 0x3D, 0xC0, 0x92, 0x49, 0x7D, 0x41, 0x9A, 0x91, 0x09, 0xEE,
# 10 SWI9x07 Openmep Key 02.25.02.01
0x8A, 0x56, 0x03, 0xF0, 0xBB, 0x9C, 0x13, 0xD2, 0x4E, 0xB2, 0x45, 0xAD, 0xC4, 0x0A, 0xE7, 0x52,
# 11 NTG9X40C_11.14.08.11 / mdm9x40r11_core AC815s / SWI9x50 MR1100 Openlock Key
0x2A, 0xEF, 0x07, 0x2B, 0x19, 0x60, 0xC9, 0x01, 0x8B, 0x87, 0xF2, 0x6E, 0xC1, 0x42, 0xA8, 0x3A,
# 12 SWI9x50 MR1100 Openmep Key
0x28, 0x55, 0x48, 0x52, 0x24, 0x72, 0x63, 0x37, 0x14, 0x26, 0x37, 0x50, 0xBE, 0xFE, 0x00, 0x00,
# 13 SWI9x50 Unknown key
0x22, 0x63, 0x48, 0x02, 0x24, 0x72, 0x27, 0x37, 0x19, 0x26, 0x37, 0x50, 0xBE, 0xEF, 0xCA, 0xFE,
# 14 SWI9x50,SWI9X06Y IMEI nv key
0x98, 0xE1, 0xC1, 0x93, 0xC3, 0xBF, 0xC3, 0x50, 0x8D, 0xA1, 0x35, 0xFE, 0x50, 0x47, 0xB3, 0xC4,
# 15 NTG9X35C_02.08.29.00 Openmep Key AC791L/AC790S Old
0x61, 0x94, 0xCE, 0xA7, 0xB0, 0xEA, 0x4F, 0x0A, 0x73, 0xC5, 0xC3, 0xA6, 0x5E, 0xEC, 0x1C, 0xE2, 0x61, 0x94, 0xCE, 0xA7, 0xB0, 0xEA, 0x4F, 0x0A, 0x73, 0xC5, 0xC3, 0xA6, 0x5E, 0xEC, 0x1C, 0xE2,
# 2 AC750,AC710,AC7XX,SB750A,SB750,PC7000,AC313u OPENMEP
0x39, 0xC6, 0x7B, 0x04, 0xCA, 0x50, 0x82, 0x1F, 0x19, 0x63, 0x36, 0xDE, 0x81, 0x49, 0xF0, 0xD7,
# 3 AC775,PC7200
0xDE, 0xA5, 0xAD, 0x2E, 0xBE, 0xE1, 0xC9, 0xEF, 0xCA, 0xF9, 0xFE, 0x1F, 0x17, 0xFE, 0xED, 0x3B,
# 4 MC7455_02.30.01.01 OPENMEP
0xFE, 0xD4, 0x40, 0x52, 0x2D, 0x4B, 0x12, 0x5C, 0xE7, 0x0D, 0xF8, 0x79, 0xF8, 0xC0, 0xDD, 0x37,
# 5 MC7455_02.30.01.01 OPENLOCK
0x3B, 0x18, 0x99, 0x6B, 0x57, 0x24, 0x0A, 0xD8, 0x94, 0x6F, 0x8E, 0xD9, 0x90, 0xBC, 0x67, 0x56,
# 6 SWI9x50 Openmep Key SWI9X50C_01.08.04.00
0x47, 0x4F, 0x4F, 0x44, 0x4A, 0x4F, 0x42, 0x44, 0x45, 0x43, 0x4F, 0x44, 0x49, 0x4E, 0x47, 0x2E,
# 7 SWI9x50 Openlock Key SWI9X50C_01.08.04.00
0x4F, 0x4D, 0x41, 0x52, 0x20, 0x44, 0x49, 0x44, 0x20, 0x54, 0x48, 0x49, 0x53, 0x2E, 0x2E, 0x2E,
# 8 MDM8200 Special
0x8F, 0xA5, 0x85, 0x05, 0x5E, 0xCF, 0x44, 0xA0, 0x98, 0x8B, 0x09, 0xE8, 0xBB, 0xC6, 0xF7, 0x65,
# 9 SWI9x07 Openlock Key 02.25.02.01
0x4D, 0x42, 0xD8, 0xC1, 0x25, 0x44, 0xD8, 0xA0, 0x1D, 0x80, 0xC4, 0x52, 0x8E, 0xEC, 0x8B, 0xE3,
# 10 SWI9x07 Openmep Key 02.25.02.01
0xED, 0xA9, 0xB7, 0x0A, 0xDB, 0x85, 0x3D, 0xC0, 0x92, 0x49, 0x7D, 0x41, 0x9A, 0x91, 0x09, 0xEE,
# 11 NTG9X40C_11.14.08.11 / mdm9x40r11_core AC815s / SWI9x50 MR1100 Openlock Key
0x8A, 0x56, 0x03, 0xF0, 0xBB, 0x9C, 0x13, 0xD2, 0x4E, 0xB2, 0x45, 0xAD, 0xC4, 0x0A, 0xE7, 0x52,
# 12 SWI9x50 MR1100 Openmep Key
0x2A, 0xEF, 0x07, 0x2B, 0x19, 0x60, 0xC9, 0x01, 0x8B, 0x87, 0xF2, 0x6E, 0xC1, 0x42, 0xA8, 0x3A,
# 13 SWI9x50/SWI9x65 Unknown key
0x28, 0x55, 0x48, 0x52, 0x24, 0x72, 0x63, 0x37, 0x14, 0x26, 0x37, 0x50, 0xBE, 0xFE, 0x00, 0x00,
# 14 SWI9x50,SWI9X06Y,SWI9x65 IMEI nv key
0x22, 0x63, 0x48, 0x02, 0x24, 0x72, 0x27, 0x37, 0x19, 0x26, 0x37, 0x50, 0xBE, 0xEF, 0xCA, 0xFE,
# 15 NTG9X35C_02.08.29.00 Openmep Key AC791L/AC790S Old
0x98, 0xE1, 0xC1, 0x93, 0xC3, 0xBF, 0xC3, 0x50, 0x8D, 0xA1, 0x35, 0xFE, 0x50, 0x47, 0xB3, 0xC4,
# 16 NTG9X35C_02.08.29.00 Openmep Key AC791/AC790S, NTGX55_10.25.15.02 MR5100 Alternative, NTG9X40C_30.00.12.00 Alternative # 16 NTG9X35C_02.08.29.00 Openmep Key AC791/AC790S, NTGX55_10.25.15.02 MR5100 Alternative, NTG9X40C_30.00.12.00 Alternative
0xC5, 0x50, 0x40, 0xDA, 0x23, 0xE8, 0xF4, 0x4C, 0x29, 0xE9, 0x07, 0xDE, 0x24, 0xE5, 0x2C, 0x1D, 0x61, 0x94, 0xCE, 0xA7, 0xB0, 0xEA, 0x4F, 0x0A, 0x73, 0xC5, 0xC3, 0xA6, 0x5E, 0xEC, 0x1C, 0xE2,
# 17 NTG9X35C_02.08.29.00 Openlock Key AC791/AC790S Old # 17 NTG9X35C_02.08.29.00 Openlock Key AC791/AC790S Old
0xF0, 0x14, 0x55, 0x0D, 0x5E, 0xDA, 0x92, 0xB3, 0xA7, 0x6C, 0xCE, 0x84, 0x90, 0xBC, 0x7F, 0xED, 0xC5, 0x50, 0x40, 0xDA, 0x23, 0xE8, 0xF4, 0x4C, 0x29, 0xE9, 0x07, 0xDE, 0x24, 0xE5, 0x2C, 0x1D,
# 18 NTG9X35C_02.08.29.00 Openlock Key AC791/AC790S, NTGX55_10.25.15.02 MR5100 Alternative, NTG9X40C_30.00.12.00 Alternative # 18 NTG9X35C_02.08.29.00 Openlock Key AC791/AC790S, NTGX55_10.25.15.02 MR5100 Alternative, NTG9X40C_30.00.12.00 Alternative
0x78, 0x19, 0xC5, 0x6D, 0xC3, 0xD8, 0x25, 0x3E, 0x51, 0x60, 0x8C, 0xA7, 0x32, 0x83, 0x37, 0x9D, 0xF0, 0x14, 0x55, 0x0D, 0x5E, 0xDA, 0x92, 0xB3, 0xA7, 0x6C, 0xCE, 0x84, 0x90, 0xBC, 0x7F, 0xED,
# 19 SWI9X06Y_02.14.04.00 Openmep Key WP77xx # 19 SWI9X06Y_02.14.04.00 Openmep Key WP77xx
0x12, 0xF0, 0x79, 0x6B, 0x19, 0xC7, 0xF4, 0xEC, 0x50, 0xF3, 0x8C, 0x40, 0x02, 0xC9, 0x43, 0xC8, 0x78, 0x19, 0xC5, 0x6D, 0xC3, 0xD8, 0x25, 0x3E, 0x51, 0x60, 0x8C, 0xA7, 0x32, 0x83, 0x37, 0x9D,
# 20 SWI9X06Y_02.14.04.00 Openlock Key WP77xx # 20 SWI9X06Y_02.14.04.00 Openlock Key WP77xx
0x49, 0x42, 0xFF, 0x76, 0x8A, 0x95, 0xCF, 0x7B, 0xA3, 0x47, 0x5F, 0xF5, 0x8F, 0xD8, 0x45, 0xE4, 0x12, 0xF0, 0x79, 0x6B, 0x19, 0xC7, 0xF4, 0xEC, 0x50, 0xF3, 0x8C, 0x40, 0x02, 0xC9, 0x43, 0xC8,
# 21 NTGX55 Openmep Key, NTGX55_10.25.15.02 MR5100, NTG9X40C_30.00.12.00 # 21 NTGX55 Openmep Key, NTGX55_10.25.15.02 MR5100, NTG9X40C_30.00.12.00
0xF8, 0x1A, 0x3A, 0xCC, 0xAA, 0x2B, 0xA5, 0xE8, 0x8B, 0x53, 0x5A, 0x55, 0xB9, 0x65, 0x57, 0x98, 0x49, 0x42, 0xFF, 0x76, 0x8A, 0x95, 0xCF, 0x7B, 0xA3, 0x47, 0x5F, 0xF5, 0x8F, 0xD8, 0x45, 0xE4,
# 22 NTGX55 Openlock Key, NTGX55_10.25.15.02 MR5100, NTG9X40C_30.00.12.00 # 22 NTGX55 Openlock Key, NTGX55_10.25.15.02 MR5100, NTG9X40C_30.00.12.00
0x54, 0xC9, 0xC7, 0xA4, 0x02, 0x1C, 0xB0, 0x11, 0x05, 0x22, 0x39, 0xB7, 0x84, 0xEF, 0x16, 0xCA, 0xF8, 0x1A, 0x3A, 0xCC, 0xAA, 0x2B, 0xA5, 0xE8, 0x8B, 0x53, 0x5A, 0x55, 0xB9, 0x65, 0x57, 0x98,
# 23 NTG9X15A Openlock Key, NTG9X15A_01.08.02.00 # 23 NTG9X15A Openlock Key, NTG9X15A_01.08.02.00
0xC7, 0xE6, 0x39, 0xFE, 0x0A, 0xC7, 0xCA, 0x4D, 0x49, 0x8F, 0xD8, 0x55, 0xEB, 0x1A, 0xCD, 0x8A 0x54, 0xC9, 0xC7, 0xA4, 0x02, 0x1C, 0xB0, 0x11, 0x05, 0x22, 0x39, 0xB7, 0x84, 0xEF, 0x16, 0xCA,
# 24 NTG9X15A Openlock Key, NTG9X15A_01.08.02.00 # 24 NTG9X15A Openlock Key, NTG9X15A_01.08.02.00
0xC7, 0xE6, 0x39, 0xFE, 0x0A, 0xC7, 0xCA, 0x4D, 0x49, 0x8F, 0xD8, 0x55, 0xEB, 0x1A, 0xCD, 0x8A,
# 25 NTGX65 Openlock Key, NTGX65_10.04.13.03
0xF2, 0x4A, 0x9A, 0x2C, 0xDA, 0x3D, 0xA5, 0xE2, 0x6B, 0x56, 0x9A, 0x45, 0x29, 0x25, 0x77, 0x9A,
# 26 NTGX65 Openadm Key, NTGX65_10.04.13.03
0x46, 0x30, 0x33, 0x43, 0x44, 0x36, 0x42, 0x34, 0x41, 0x32, 0x31, 0x32, 0x30, 0x35, 0x39, 0x37
]) ])
class SierraGenerator(): class SierraGenerator():
tbl = bytearray() tbl = bytearray()
rtbl = bytearray() rtbl = bytearray()
@ -163,7 +233,7 @@ class SierraGenerator():
lockid = prodtable[devicegeneration]["openlock"] lockid = prodtable[devicegeneration]["openlock"]
clen = prodtable[devicegeneration]["clen"] clen = prodtable[devicegeneration]["clen"]
if len(challenge) < clen: if len(challenge) < clen:
challenge=[0 for _ in range(0, clen - len(challenge))] challenge = [0 for _ in range(0, clen - len(challenge))]
challengelen = len(challenge) challengelen = len(challenge)
if _type == 0: # lockkey if _type == 0: # lockkey
@ -179,7 +249,7 @@ class SierraGenerator():
return resp return resp
def selftest(self): def selftest(self):
test_table=[ test_table = [
{"challenge": "8101A18AB3C3E66A", "devicegeneration": "MDM9x15", "response": "D1E128FCA8A963ED"}, {"challenge": "8101A18AB3C3E66A", "devicegeneration": "MDM9x15", "response": "D1E128FCA8A963ED"},
{"challenge": "BE96CBBEE0829BCA", "devicegeneration": "MDM9x40", "response": "1033773720F6EE66"}, {"challenge": "BE96CBBEE0829BCA", "devicegeneration": "MDM9x40", "response": "1033773720F6EE66"},
{"challenge": "BE96CBBEE0829BCA", "devicegeneration": "MDM9x30", "response": "1E02CE6A98B7DD2A"}, {"challenge": "BE96CBBEE0829BCA", "devicegeneration": "MDM9x30", "response": "1E02CE6A98B7DD2A"},
@ -193,7 +263,8 @@ class SierraGenerator():
{"challenge": "BE96CBBEE0829BCA", "devicegeneration": "MDM9x30_V1", "response": "6A5E4C9CBCBDA7DC"}, {"challenge": "BE96CBBEE0829BCA", "devicegeneration": "MDM9x30_V1", "response": "6A5E4C9CBCBDA7DC"},
{"challenge": "BE96CBBEE0829BCA", "devicegeneration": "MDM9200", "response": "EEDBF8BFF8DAE346"}, {"challenge": "BE96CBBEE0829BCA", "devicegeneration": "MDM9200", "response": "EEDBF8BFF8DAE346"},
{"challenge": "20E253156762DACE", "devicegeneration": "SDX55", "response": "03940D7067145323"}, {"challenge": "20E253156762DACE", "devicegeneration": "SDX55", "response": "03940D7067145323"},
{"challenge": "2387885E7D290FEE", "devicegeneration": "MDM9x15A", "response": "DC3E51897BAA9C1E"} {"challenge": "2387885E7D290FEE", "devicegeneration": "MDM9x15A", "response": "DC3E51897BAA9C1E"},
{"challenge": "4B1FEF9FD43C6DAA", "devicegeneration": "SDX65", "response":"1253C1B1E447B697"}
] ]
for test in test_table: for test in test_table:
challenge = test["challenge"] challenge = test["challenge"]
@ -202,9 +273,9 @@ class SierraGenerator():
openlock = self.run(devicegeneration, challenge, 0) openlock = self.run(devicegeneration, challenge, 0)
padding = " " * (16 - len(devicegeneration)) padding = " " * (16 - len(devicegeneration))
if openlock != response: if openlock != response:
print(devicegeneration+padding+" FAILED!") print(devicegeneration + padding + " FAILED!")
else: else:
print(devicegeneration+padding+" PASSED :)") print(devicegeneration + padding + " PASSED :)")
def SierraPreInit(self, counter, key, keylen, challengelen, mcount): def SierraPreInit(self, counter, key, keylen, challengelen, mcount):
if counter != 0: if counter != 0:
@ -232,7 +303,7 @@ class SierraGenerator():
if keylen == 0 or keylen > 0x20: if keylen == 0 or keylen > 0x20:
retval = [0, keylen] retval = [0, keylen]
elif 1 <= keylen <= 0x20: elif 1 <= keylen <= 0x20:
self.tbl = [(i&0xFF) for i in range(0, 0x100)] self.tbl = [(i & 0xFF) for i in range(0, 0x100)]
mcount = 0 mcount = 0
cl = keylen & 0xffffff00 cl = keylen & 0xffffff00
i = 0xFF i = 0xFF
@ -306,13 +377,13 @@ class SierraGenerator():
self.rtbl[4] = 0 self.rtbl[4] = 0
return 1 return 1
def SierraKeygen(self, challenge:bytearray, key: bytearray, challengelen:int, keylen:int): def SierraKeygen(self, challenge: bytearray, key: bytearray, challengelen: int, keylen: int):
challenge = challenge challenge = challenge
resultbuffer=bytearray([0 for _ in range(0, 0x100 + 1)]) resultbuffer = bytearray([0 for _ in range(0, 0x100 + 1)])
ret, keylen = self.SierraInit(key, keylen) ret, keylen = self.SierraInit(key, keylen)
if ret: if ret:
for i in range(0, challengelen): for i in range(0, challengelen):
exec(prodtable[self.devicegeneration]["run"]) # uses challenge exec(prodtable[self.devicegeneration]["run"]) # uses challenge
self.SierraFinish() self.SierraFinish()
return resultbuffer return resultbuffer
@ -384,14 +455,15 @@ class connection:
self.serial.close() self.serial.close()
self.connected = False self.connected = False
class SierraKeygen(metaclass=LogBase): class SierraKeygen(metaclass=LogBase):
def __init__(self,cn,devicegeneration=None): def __init__(self, cn, devicegeneration=None):
self.cn=cn self.cn = cn
self.keygen = SierraGenerator() self.keygen = SierraGenerator()
if devicegeneration==None: if devicegeneration == None:
self.detectdevicegeneration() self.detectdevicegeneration()
else: else:
self.devicegeneration=devicegeneration self.devicegeneration = devicegeneration
def run_selftest(self): def run_selftest(self):
print("Running self-test ...") print("Running self-test ...")
@ -410,23 +482,23 @@ class SierraKeygen(metaclass=LogBase):
_model = line.split(":")[1].strip() _model = line.split(":")[1].strip()
if revision != "": if revision != "":
if "9200" in revision: if "9200" in revision:
devicegeneration = "MDM9200" #AC762S NTG9200H2_03.05.14.12ap devicegeneration = "MDM9200" # AC762S NTG9200H2_03.05.14.12ap
if "9X07" in revision: if "9X07" in revision:
devicegeneration = "MDM9x07" devicegeneration = "MDM9x07"
elif "9X25" in revision: elif "9X25" in revision:
if "NTG9X25C" in revision: if "NTG9X25C" in revision:
devicegeneration = "MDM9200" #AC781S NTG9X25C_01.00.57.00 devicegeneration = "MDM9200" # AC781S NTG9X25C_01.00.57.00
elif "9X15" in revision: elif "9X15" in revision:
if "NTG9X15A" in revision: if "NTG9X15A" in revision:
devicegeneration = "MDM9x15A" #Aircard 779S devicegeneration = "MDM9x15A" # Aircard 779S
elif "NTG9X15C" in revision: elif "NTG9X15C" in revision:
devicegeneration = "MDM9200" #AC770S NTG9X15C_01.18.02.00 devicegeneration = "MDM9200" # AC770S NTG9X15C_01.18.02.00
elif "9X15A" in revision: elif "9X15A" in revision:
devicegeneration = "MDM9x15A" devicegeneration = "MDM9x15A"
else: else:
devicegeneration = "MDM9x15" devicegeneration = "MDM9x15"
elif "9X30" in revision: elif "9X30" in revision:
if "NTG9X35C" in revision: #790S NTG9X35C_11.11.15.03 if "NTG9X35C" in revision: # 790S NTG9X35C_11.11.15.03
devicegeneration = "MDM9x30_V1" devicegeneration = "MDM9x30_V1"
else: else:
devicegeneration = "MDM9x30" devicegeneration = "MDM9x30"
@ -434,26 +506,35 @@ class SierraKeygen(metaclass=LogBase):
devicegeneration = "MDM9x40" devicegeneration = "MDM9x40"
elif "9X50" in revision: elif "9X50" in revision:
if "NTG9X50" in revision: if "NTG9X50" in revision:
devicegeneration = "MDM9x40" #MR1100,AC797S NTG9X50C_12.06.03.00 devicegeneration = "MDM9x40" # MR1100,AC797S NTG9X50C_12.06.03.00
else: else:
devicegeneration = "MDM9x50" devicegeneration = "MDM9x50"
elif "9X06" in revision: elif "9X06" in revision:
devicegeneration = "MDM9x06" devicegeneration = "MDM9x06"
elif "X55" in revision or "9X40C" in revision: elif "X55" in revision or "9X40C" in revision:
if "NTGX55" in revision: #MR5100 NTGX55_10.25.15.02, MR5200 NTGX55_12.04.12.00 if "NTGX55" in revision: # MR5100 NTGX55_10.25.15.02, MR5200 NTGX55_12.04.12.00
devicegeneration = "SDX55"
elif "NTGX65" in revision: #MR6400 NTGX65_10.01.41.02
devicegeneration = "SDX55" devicegeneration = "SDX55"
devicegeneration = "SDX55" devicegeneration = "SDX55"
elif "X65" in revision:
if "NTGX65" in revision:
version = revision[revision.find("_") + 1:revision.find(" ")].split(".")
maj = int(version[0]) * 1000000 + int(version[1]) * 10000 + int(version[2]) * 100 + int(
version[3])
if maj < 10041303:
devicegeneration = "SDX55"
else: # MR6400 NTGX65_10.04.13.03
devicegeneration = "SDX65"
# MR6550 NTGX65_12.01.31.00
devicegeneration = "SDX65"
else: else:
devicegeneration = "" devicegeneration = ""
#Missing: # Missing:
# SDX24 Sierra # SDX24 Sierra
# MR2100 NTGX24_10.17.03.00 # MR2100 NTGX24_10.17.03.00
# SDX55 Sierra # SDX55 Sierra
# AC810S NTG9X40C_11.14.08.16 # AC810S NTG9X40C_11.14.08.16
# AC800S NTG9X40C_11.14.07.00 # AC800S NTG9X40C_11.14.07.00
self.devicegeneration=devicegeneration self.devicegeneration = devicegeneration
else: else:
print("Error on getting ATI modem response. Wrong port? Aborting.") print("Error on getting ATI modem response. Wrong port? Aborting.")
self.cn.close() self.cn.close()
@ -461,9 +542,9 @@ class SierraKeygen(metaclass=LogBase):
def openlock(self): def openlock(self):
print("Device generation detected: " + self.devicegeneration) print("Device generation detected: " + self.devicegeneration)
#print("Sending AT!ENTERCND=\"A710\" request.") # print("Sending AT!ENTERCND=\"A710\" request.")
#info = self.cn.send("AT!ENTERCND=\"A710\"") # info = self.cn.send("AT!ENTERCND=\"A710\"")
#if info == -1: # if info == -1:
# print("Uhoh ... invalid entercnd password. Aborting ...") # print("Uhoh ... invalid entercnd password. Aborting ...")
# return # return
print("Sending AT!OPENLOCK? request") print("Sending AT!OPENLOCK? request")
@ -472,7 +553,7 @@ class SierraKeygen(metaclass=LogBase):
if info != -1: if info != -1:
if len(info) > 2: if len(info) > 2:
challenge = info[1] challenge = info[1]
print("Received challenge: "+info[1]) print("Received challenge: " + info[1])
else: else:
print("Error on AT!OPENLOCK? request. Aborting.") print("Error on AT!OPENLOCK? request. Aborting.")
return False return False
@ -489,10 +570,11 @@ class SierraKeygen(metaclass=LogBase):
return True return True
return False return False
def main(args): def main(args):
version = "1.5" version = "1.5"
info = 'Sierra Wireless Generator ' + version + ' (c) B. Kerler 2019-2021' info = 'Sierra Wireless Generator ' + version + ' (c) B. Kerler 2019-2021'
parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter,description=info) parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=info)
parser.add_argument( parser.add_argument(
'-openlock', '-l', '-openlock', '-l',
@ -546,10 +628,10 @@ def main(args):
print(info) print(info)
print("------------------------------------------------------------\n") print("------------------------------------------------------------\n")
print("Usage: ./sierrakeygen.py [-l,-m,-c] [challenge] -d [devicegeneration]") print("Usage: ./sierrakeygen.py [-l,-m,-c] [challenge] -d [devicegeneration]")
print("Example: ./sierrakeygen.py.py -l BE96CBBEE0829BCA -d MDM9200") print("Example: ./sierrakeygen.py -l BE96CBBEE0829BCA -d MDM9200")
print("or: ./sierrakeygen.py.py -u for auto unlock") print("or: ./sierrakeygen.py -u for auto unlock")
print("or: ./sierrakeygen.py.py -u -p [portname] for auto unlock with given portname") print("or: ./sierrakeygen.py -u -p [portname] for auto unlock with given portname")
print("or: ./sierrakeygen.py.py -s for self-test") print("or: ./sierrakeygen.py -s for self-test")
print("Supported devicegenerations :") print("Supported devicegenerations :")
for key in infotable: for key in infotable:
info = f"\t{key}:\t\t" info = f"\t{key}:\t\t"
@ -569,14 +651,14 @@ def main(args):
print("You need to specific a device generation as well. Option -d") print("You need to specific a device generation as well. Option -d")
exit(0) exit(0)
if devicegeneration == "": if devicegeneration == "":
devicegeneration=None devicegeneration = None
if args.selftest: if args.selftest:
kg=SierraKeygen(None,"selftest") kg = SierraKeygen(None, "selftest")
kg.run_selftest() kg.run_selftest()
elif args.unlock: elif args.unlock:
cn = connection(args.port, args.ip) cn = connection(args.port, args.ip)
if cn.connected: if cn.connected:
kg=SierraKeygen(cn,devicegeneration) kg = SierraKeygen(cn, devicegeneration)
if kg.devicegeneration == "": if kg.devicegeneration == "":
print("Unknown device generation. Please send me details :)") print("Unknown device generation. Please send me details :)")
else: else:

View file

@ -0,0 +1,57 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (c) B.Kerler 2019-2023 under GPLv3 license
# If you use my code, make sure you refer to my name
#
# !!!!! If you use this code in commercial products, your product is automatically
# GPLv3 and has to be open sourced under GPLv3 as well. !!!!!
# TXT to EDL Loader (c) B.Kerler 2023
import os,sys
from struct import unpack
def main():
if len(sys.argv)<2:
print("Usage: ./txt_to_loader.py [log.txt] [loader.elf]")
sys.exit(0)
with open(sys.argv[1],"rb") as rf:
data=bytearray()
for line in rf.readlines():
if line[0]==0x20:
tt=line.split(b" ")[:-1]
tt=tt[1:17]
xx=b"".join(tt)
data.extend(bytes.fromhex(xx.decode('utf-8')))
outdata=bytearray()
i=0
seq=b"\x03\x00\x00\x00\x14\x00\x00\x00\x0D\x00\x00\x00"
with open(sys.argv[2], "wb") as wf:
while True:
idx=data.find(seq)
if idx==-1:
if i==0:
seq=b"\x12\x00\x00\x00\x20\x00\x00\x00\x0D\x00\x00\x00\x00\x00\x00\x00"
i+=1
continue
else:
break
else:
cmd=unpack("<I", data[idx:idx+4])[0]
if cmd==0x03:
cmd,tlen,slen,offset,length=unpack("<IIIII",data[idx:idx+0x14])
elif cmd==0x12:
cmd, tlen, slen, offset, length = unpack("<IIQQQ", data[idx:idx + 0x20])
data = data[idx + 0x20:]
print("Offset : %08X Length: %08X" %(offset,length))
while len(outdata)<offset+length:
outdata.append(0xFF)
outdata[offset:offset+length]=data[:length]
i+=1
data = data[length:]
wf.write(outdata)
print("Done.")
if __name__=="__main__":
main()

1
enableadb Symbolic link
View file

@ -0,0 +1 @@
edlclient/Tools/enableadb

1
fhloaderparse Symbolic link
View file

@ -0,0 +1 @@
edlclient/Tools/fhloaderparse

View file

@ -8,6 +8,7 @@ requires = [
"docopt", "docopt",
"pycryptodome", "pycryptodome",
"colorama", "colorama",
"Exscript",
"usb" "usb"
] ]
build-backend = "setuptools.build_meta" build-backend = "setuptools.build_meta"

1
qc_diag Symbolic link
View file

@ -0,0 +1 @@
edlclient/Tools/qc_diag

View file

@ -9,4 +9,5 @@ colorama
usb usb
capstone capstone
keystone-engine keystone-engine
qrcode
Exscript Exscript

View file

@ -16,10 +16,10 @@ setup(
}, },
classifiers=[ classifiers=[
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License", "License :: OSI Approved :: GPlv3 License",
"Operating System :: OS Independent", "Operating System :: OS Independent",
], ],
license='MIT License', license='GPLv3 License',
install_requires=[ install_requires=[
'colorama', 'colorama',
'docopt', 'docopt',
@ -29,7 +29,8 @@ setup(
'lxml', 'lxml',
'pylzma', 'pylzma',
'pycryptodome', 'pycryptodome',
'wheel' 'wheel',
"Exscript"
], ],
author='B. Kerler', author='B. Kerler',
author_email='info@revskills.de', author_email='info@revskills.de',

1
sierrakeygen Symbolic link
View file

@ -0,0 +1 @@
edlclient/Tools/sierrakeygen.py

View file

@ -1,6 +1,6 @@
# Challenge/Response Generator for Sierra Wireless Cards V1.2 # Challenge/Response Generator for Sierra Wireless Cards V1.2
(c) B. Kerler 2019-2023 (c) B. Kerler 2019-2023
MIT License GPLv3 License
## Why ## Why
@ -23,11 +23,8 @@ MIT License
"MDM9x40": ["AC815s", "AC785s","Netgear MR1100"], "MDM9x40": ["AC815s", "AC785s","Netgear MR1100"],
"MDM9x50": ["EM7565", "EM7565-9", "EM7511"], "MDM9x50": ["EM7565", "EM7565-9", "EM7511"],
"MDM9x06": ["WP77xx"], "MDM9x06": ["WP77xx"],
"MDM9x07": ["SWI9X07Y", "WP76xx"] "MDM9x07": ["SWI9X07Y", "WP76xx"],
"SDX65": ["MR6400", "MR6500", "MR6110", "MR6150", "MR6450", "MR6550"]
## Note for MR6xxx/MR6400 owners:
I do have a working solution for NTGX65_10.04.13.03 and upper. However due to various reasons I won't publish the solution. If you need a code to be generated, just contact me. If you're from a unlocker crew making money of my source code: Don't even dare to ask, you are killing open source contributions and make our lives a lot harder.
## Installation ## Installation
@ -350,7 +347,7 @@ I do have a working solution for NTGX65_10.04.13.03 and upper. However due to va
## License ## License
Published under MIT license Published under GPLv3 license
Additional license limitations: No use in commercial products without prior permit by me. Additional license limitations: No use in commercial products without prior permit by me.
Enjoy ! Enjoy !