1
0
mirror of https://github.com/ThunderEX/py-kms.git synced 2025-04-18 07:44:00 +03:00

cleanup kmsBase to dynamic load from KmsDataBase.xml

This commit is contained in:
ThunderEX 2017-05-26 00:23:42 +08:00
parent 97d81385fa
commit 4f760cfb8b
No known key found for this signature in database
GPG Key ID: B958D483564EFDA4
5 changed files with 768 additions and 128 deletions

297
KmsDataBase.xml Normal file
View File

@ -0,0 +1,297 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
<KmsData
Version="v1.0" // Version of the KmsData file, currently only v1.0 (required),
Author="Hotbird64" // Enter your name here (required)
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" // Loads the xsi namespace (recommended for syntax checking in an XSD capable XML editor)
xsi:noNamespaceSchemaLocation="KmsDataBase.xsd" // relative or absolute path of the validation file
>
<AppItem // Application (Windows, Office 2010 or Office 2013+)
Id="{55c92734-d682-4d71-983e-d6ec3f16059f}" // Guid (required, braces are optional).
DisplayName="Windows" // Friendly name that should be displayed instead of the Guid (required)
MinimumActiveClients="50" // Minimum number of active clients the KMS Emulator shall send in a response (optional, default 50, should be 50 for Windows and 10 for Office)
VlmcsdEpidName="EPID_WINDOWS" // Used internally for the export to vlmcsd (optional, default EPID_UNKNOWN)
EPid="06401-00206-271-044011-03-1033-9600.0000-3192013" // extended PID that should be returned for this Application. Use at the AppItem Level for Office 2010 and Windows (but not Office 2013 and 2016)
>
<KmsItem // KmsItem aka KMS Counted Id
Id="{e1c51358-fe3e-4203-a4a2-3b6b20c9734e}" // Guid (required, braces are optional).
DisplayName="Windows 10 (Retail)" // Friendly name that should be displayed instead of the Guid (required)
IsRetail="true" // Indicates that this is a retail product group that can't be activated with a genuine KMS server (optional, default false)
IsPreview="false" // Indicates that this a beta/preview product group that can't be activated with a genuine KMS server (optional, default false)
DefaultKmsProtocol="v6.0" // Default KMS protocol version that the KMS client uses must be "v4.0", "v5.0" or "v6.0" (optional, default v6.0)
NCountPolicy="25" // Minimum number of active clients required for the activation to succeed (optional, default 25, should be 25 for Windows clients and 5 otherwise)
EPid="06401-00206-473-489323-03-1033-9600.0000-3192013" // extended PID that should be returned for this Application. Use at the KmsItem Level for Office 2013 and and Office 2016 (but not Windows and Office 2010)
>
<SkuItem // VOLUME_KMSCLIENT channel SKU ID (makes no sense to add other SKU IDs than VOLUME_KMSCLIENT channel
Id="{58e97c99-f377-4ef1-81d5-4ad5522b5fd8}" // Guid (required, braces are optional).
DisplayName="Windows 10 Home" // Friendly name that should be displayed instead of the Guid (required)
Gvlk="XXXXX-XXXXX-XXXXX-XXXXX-H8Q99" // The GVLK key to enable this VOLUME_KMSCLIENT channel (optional, recommended, no default)
IsGeneratedGvlk="false" // If true, indicates that this is a generated GVLK (optional, strongly recommended if a generated GVLK is used, default false
/>
</KmsItem>
</AppItem>
</KmsData>
-->
<KmsData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Version="1.2" Author="Hotbird64" xsi:noNamespaceSchemaLocation="KmsDataBase.xsd">
<AppItem DisplayName="Windows" Id="55c92734-d682-4d71-983e-d6ec3f16059f" VlmcsdEpidName="EPID_WINDOWS">
<KmsItem DisplayName="Windows 10 Unknown (Volume)" Id="d27cd636-1962-44e9-8b4f-27b6c23efb85" NCountPolicy="25" DefaultKmsProtocol="6.0">
</KmsItem>
<KmsItem DisplayName="Windows 10 2016 (Volume)" Id="969fe3c0-a3ec-491a-9f25-423605deb365" DefaultKmsProtocol="6.0">
<SkuItem DisplayName="Windows 10 Enterprise 2016 LTSB" Id="2d5a5a60-3040-48bf-beb0-fcd770c20ce0" Gvlk="DCPHK-NFMTC-H88MJ-PFHPY-QJ4BJ" />
<SkuItem DisplayName="Windows 10 Enterprise 2016 LTSB N" Id="9f776d83-7156-45b2-8a5c-359b9c9f22a3" Gvlk="QFFDN-GRT3P-VKWWX-X7T3R-8B639" />
</KmsItem>
<KmsItem DisplayName="Windows 10 (Retail)" Id="e1c51358-fe3e-4203-a4a2-3b6b20c9734e" IsRetail="true" DefaultKmsProtocol="6.0">
<SkuItem DisplayName="Windows 10 Home" Id="58e97c99-f377-4ef1-81d5-4ad5522b5fd8" Gvlk="TX9XD-98N7V-6WMQ6-BX7FG-H8Q99" />
<SkuItem DisplayName="Windows 10 Home Country Specific" Id="a9107544-f4a0-4053-a96a-1479abdef912" Gvlk="PVMJN-6DFY6-9CCP6-7BKTT-D3WVR" />
<SkuItem DisplayName="Windows 10 Home N" Id="7b9e1751-a8da-4f75-9560-5fadfe3d8e38" Gvlk="3KHY7-WNT83-DGQKR-F7HPR-844BM" />
<SkuItem DisplayName="Windows 10 Home Single Language" Id="cd918a57-a41b-4c82-8dce-1a538e221a83" Gvlk="7HNRX-D7KGG-3K4RQ-4WPJ4-YTDFH" />
</KmsItem>
<KmsItem DisplayName="Windows 10 2015 (Volume)" Id="58e2134f-8e11-4d17-9cb2-91069c151148" DefaultKmsProtocol="6.0">
<SkuItem DisplayName="Windows 10 Education" Id="e0c42288-980c-4788-a014-c080d2e1926e" Gvlk="NW6C2-QMPVW-D7KKK-3GKT6-VCFB2" />
<SkuItem DisplayName="Windows 10 Education N" Id="3c102355-d027-42c6-ad23-2e7ef8a02585" Gvlk="2WH4N-8QGBV-H22JP-CT43Q-MDWWJ" />
<SkuItem DisplayName="Windows 10 Enterprise" Id="73111121-5638-40f6-bc11-f1d7b0d64300" Gvlk="NPPR9-FWDCX-D2C8J-H872K-2YT43" />
<SkuItem DisplayName="Windows 10 Enterprise 2015 LTSB" Id="7b51a46c-0c04-4e8f-9af4-8496cca90d5e" Gvlk="WNMTR-4C88C-JK8YV-HQ7T2-76DF9" />
<SkuItem DisplayName="Windows 10 Enterprise 2015 LTSB N" Id="87b838b7-41b6-4590-8318-5797951d8529" Gvlk="2F77B-TNFGY-69QQF-B8YKP-D69TJ" />
<SkuItem DisplayName="Windows 10 Enterprise N" Id="e272e3e2-732f-4c65-a8f0-484747d0d947" Gvlk="DPH2V-TTNVB-4X9Q3-TJR4H-KHJW4" />
<SkuItem DisplayName="Windows 10 Professional" Id="2de67392-b7a7-462a-b1ca-108dd189f588" Gvlk="W269N-WFGWX-YVC9B-4J6C9-T83GX" />
<SkuItem DisplayName="Windows 10 Professional Education" Id="3f1afc82-f8ac-4f6c-8005-1d233e606eee" Gvlk="6TP4R-GNPTD-KYYHQ-7B7DP-J447Y" />
<SkuItem DisplayName="Windows 10 Professional Education N" Id="5300b18c-2e33-4dc2-8291-47ffcec746dd" Gvlk="YVWGF-BXNMC-HTQYQ-CPQ99-66QFC" />
<SkuItem DisplayName="Windows 10 Professional N" Id="a80b5abf-76ad-428b-b05d-a47d2dffeebf" Gvlk="MH37W-N47XK-V7XM9-C7227-GCQG9" />
<SkuItem DisplayName="Windows 10 Professional Preview" Id="ff808201-fec6-4fd4-ae16-abbddade5706" Gvlk="XQHPH-N4D9W-M8P96-DPDFP-TMVPY" IsGeneratedGvlk="true"/>
<SkuItem DisplayName="Windows 10 Enterprise Preview" Id="43f2ab05-7c87-4d56-b27c-44d0f9a3dabd" Gvlk="QNMXX-GCD3W-TCCT4-872RV-G6P4J" IsGeneratedGvlk="true"/>
</KmsItem>
<KmsItem DisplayName="Windows 7" Id="7fde5219-fbfa-484a-82c9-34d1ad53e856" DefaultKmsProtocol="4.0">
<SkuItem DisplayName="Windows 7 Enterprise" Id="ae2ee509-1b34-41c0-acb7-6d4650168915" Gvlk="33PXH-7Y6KF-2VJC9-XBBR8-HVTHH" />
<SkuItem DisplayName="Windows 7 Enterprise E" Id="46bbed08-9c7b-48fc-8614-95250573f4ea" Gvlk="C29WB-22CC8-VJ326-GHFJW-H9DH4" />
<SkuItem DisplayName="Windows 7 Enterprise N" Id="1cb6d605-11b3-4e14-bb30-da91c8e3983a" Gvlk="YDRBP-3D83W-TY26F-D46B2-XCKRJ" />
<SkuItem DisplayName="Windows 7 Professional" Id="b92e9980-b9d5-4821-9c94-140f632f6312" Gvlk="FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4" />
<SkuItem DisplayName="Windows 7 Professional E" Id="5a041529-fef8-4d07-b06f-b59b573b32d2" Gvlk="W82YF-2Q76Y-63HXB-FGJG9-GF7QX" />
<SkuItem DisplayName="Windows 7 Professional N" Id="54a09a0d-d57b-4c10-8b69-a842d6590ad5" Gvlk="MRPKT-YTG23-K7D7T-X2JMM-QY7MG" />
<SkuItem DisplayName="Windows 7 Embedded POSReady" Id="db537896-376f-48ae-a492-53d0547773d0" Gvlk="YBYF6-BHCR3-JPKRB-CDW7B-F9BK4" />
<SkuItem DisplayName="Windows 7 Embedded Standard" Id="e1a8296a-db37-44d1-8cce-7bc961d59c54" Gvlk="XGY72-BRBBT-FF8MH-2GG8H-W7KCW"/>
<SkuItem DisplayName="Windows 7 ThinPC" Id="aa6dd3aa-c2b4-40e2-a544-a6bbb3f5c395" Gvlk="73KQT-CD9G6-K7TQG-66MRP-CQ22C" />
</KmsItem>
<KmsItem DisplayName="Windows 8 (Retail)" Id="bbb97b3b-8ca4-4a28-9717-89fabd42c4ac" IsRetail="true" DefaultKmsProtocol="5.0">
<SkuItem DisplayName="Windows 8 Core" Id="c04ed6bf-55c8-4b47-9f8e-5a1f31ceee60" Gvlk="BN3D2-R7TKB-3YPBD-8DRP2-27GG4" />
<SkuItem DisplayName="Windows 8 Core Country Specific" Id="9d5584a2-2d85-419a-982c-a00888bb9ddf" Gvlk="4K36P-JN4VD-GDC6V-KDT89-DYFKP" />
<SkuItem DisplayName="Windows 8 Core N" Id="197390a0-65f6-4a95-bdc4-55d58a3b0253" Gvlk="8N2M2-HWPGY-7PGT9-HGDD8-GVGGY" />
<SkuItem DisplayName="Windows 8 Core Single Language" Id="8860fcd4-a77b-4a20-9045-a150ff11d609" Gvlk="2WN2H-YGCQR-KFX6K-CD6TF-84YXQ" />
<SkuItem DisplayName="Windows 8 Professional WMC" Id="a00018a3-f20f-4632-bf7c-8daa5351c914" Gvlk="GNBB8-YVD74-QJHX6-27H4K-8QHDG" />
</KmsItem>
<KmsItem DisplayName="Windows 8 (Volume)" Id="3c40b358-5948-45af-923b-53d21fcc7e79" DefaultKmsProtocol="5.0">
<SkuItem DisplayName="Windows 8 Embedded Industry Professional" Id="10018baf-ce21-4060-80bd-47fe74ed4dab" Gvlk="RYXVT-BNQG7-VD29F-DBMRY-HT73M" />
<SkuItem DisplayName="Windows 8 Embedded Industry Enterprise" Id="18db1848-12e0-4167-b9d7-da7fcda507db" Gvlk="NKB3R-R2F8T-3XCDP-7Q2KW-XWYQ2" />
<SkuItem DisplayName="Windows 8 Enterprise" Id="458e1bec-837a-45f6-b9d5-925ed5d299de" Gvlk="32JNW-9KQ84-P47T8-D8GGY-CWCK7" />
<SkuItem DisplayName="Windows 8 Enterprise N" Id="e14997e7-800a-4cf7-ad10-de4b45b578db" Gvlk="JMNMF-RHW7P-DMY6X-RF3DR-X2BQT" />
<SkuItem DisplayName="Windows 8 Professional" Id="a98bcd6d-5343-4603-8afe-5908e4611112" Gvlk="NG4HW-VH26C-733KW-K6F98-J8CK4" />
<SkuItem DisplayName="Windows 8 Professional N" Id="ebf245c1-29a8-4daf-9cb1-38dfc608a8c8" Gvlk="XCVCF-2NXM9-723PB-MHCB7-2RYQQ" />
</KmsItem>
<KmsItem DisplayName="Windows 8.1 (Retail)" Id="6d646890-3606-461a-86ab-598bb84ace82" IsRetail="true" DefaultKmsProtocol="6.0">
<SkuItem DisplayName="Windows 8.1 Core" Id="fe1c3238-432a-43a1-8e25-97e7d1ef10f3" Gvlk="M9Q9P-WNJJT-6PXPY-DWX8H-6XWKK" />
<SkuItem DisplayName="Windows 8.1 Core ARM" Id="ffee456a-cd87-4390-8e07-16146c672fd0" Gvlk="XYTND-K6QKT-K2MRH-66RTM-43JKP" />
<SkuItem DisplayName="Windows 8.1 Core Country Specific" Id="db78b74f-ef1c-4892-abfe-1e66b8231df6" Gvlk="NCTT7-2RGK8-WMHRF-RY7YQ-JTXG3" />
<SkuItem DisplayName="Windows 8.1 Core N" Id="78558a64-dc19-43fe-a0d0-8075b2a370a3" Gvlk="7B9N3-D94CG-YTVHR-QBPX3-RJP64" />
<SkuItem DisplayName="Windows 8.1 Core Single Language" Id="c72c6a1d-f252-4e7e-bdd1-3fca342acb35" Gvlk="BB6NG-PQ82V-VRDPW-8XVD2-V8P66" />
<SkuItem DisplayName="Windows 8.1 Professional Student" Id="e58d87b5-8126-4580-80fb-861b22f79296" Gvlk="MX3RK-9HNGX-K3QKC-6PJ3F-W8D7B" IsGeneratedGvlk="true" />
<SkuItem DisplayName="Windows 8.1 Professional Student N" Id="cab491c7-a918-4f60-b502-dab75e334f40" Gvlk="TNFGH-2R6PB-8XM3K-QYHX2-J4296" IsGeneratedGvlk="true" />
<SkuItem DisplayName="Windows 8.1 Professional WMC" Id="096ce63d-4fac-48a9-82a9-61ae9e800e5f" Gvlk="789NJ-TQK6T-6XTH8-J39CJ-J8D3P" />
</KmsItem>
<KmsItem DisplayName="Windows 8.1 (Volume)" Id="cb8fc780-2c05-495a-9710-85afffc904d7" DefaultKmsProtocol="6.0">
<SkuItem DisplayName="Windows 8.1 Core Connected" Id="e9942b32-2e55-4197-b0bd-5ff58cba8860" Gvlk="3PY8R-QHNP9-W7XQD-G6DPH-3J2C9" IsGeneratedGvlk="true" />
<SkuItem DisplayName="Windows 8.1 Core Connected Country Specific" Id="ba998212-460a-44db-bfb5-71bf09d1c68b" Gvlk="R962J-37N87-9VVK2-WJ74P-XTMHR" IsGeneratedGvlk="true" />
<SkuItem DisplayName="Windows 8.1 Core Connected N" Id="c6ddecd6-2354-4c19-909b-306a3058484e" Gvlk="Q6HTR-N24GM-PMJFP-69CD8-2GXKR" IsGeneratedGvlk="true" />
<SkuItem DisplayName="Windows 8.1 Core Connected Single Language" Id="b8f5e3a3-ed33-4608-81e1-37d6c9dcfd9c" Gvlk="KF37N-VDV38-GRRTV-XH8X6-6F3BB" IsGeneratedGvlk="true" />
<SkuItem DisplayName="Windows 8.1 Enterprise" Id="81671aaf-79d1-4eb1-b004-8cbbe173afea" Gvlk="MHF9N-XY6XB-WVXMC-BTDCT-MKKG7" />
<SkuItem DisplayName="Windows 8.1 Enterprise N" Id="113e705c-fa49-48a4-beea-7dd879b46b14" Gvlk="TT4HM-HN7YT-62K67-RGRQJ-JFFXW" />
<SkuItem DisplayName="Windows 8.1 Professional" Id="c06b6981-d7fd-4a35-b7b4-054742b7af67" Gvlk="GCRJD-8NW9H-F2CDX-CCM8D-9D6T9" />
<SkuItem DisplayName="Windows 8.1 Professional N" Id="7476d79f-8e48-49b4-ab63-4d0b813a16e4" Gvlk="HMCNV-VVBFX-7HMBH-CTY9B-B4FXY" />
<SkuItem DisplayName="Windows 8.1 Embedded Industry Professional" Id="0ab82d54-47f4-4acb-818c-cc5bf0ecb649" Gvlk="NMMPB-38DD4-R2823-62W8D-VXKJB" />
<SkuItem DisplayName="Windows 8.1 Embedded Industry Automotive" Id="f7e88590-dfc7-4c78-bccb-6f3865b99d1a" Gvlk="VHXM3-NR6FT-RY6RT-CK882-KW2CJ" />
<SkuItem DisplayName="Windows 8.1 Embedded Industry Enterprise" Id="cd4e2d9f-5059-4a50-a92d-05d5bb1267c7" Gvlk="FNFKF-PWTVT-9RC8H-32HB2-JB34X" />
</KmsItem>
<KmsItem DisplayName="Windows Preview" Id="5f94a0bb-d5a0-4081-a685-5819418b2fe0" IsPreview="true" DefaultKmsProtocol="5.0">
<SkuItem DisplayName="Windows 10 Enterprise Preview" Id="cde952c7-2f96-4d9d-8f2b-2d349f64fc51" Gvlk="2MP7K-98NK8-WPVF3-Q2WDG-VMD98" />
<SkuItem DisplayName="Windows 10 Professional Preview" Id="a4383e6b-dada-423d-a43d-f25678429676" Gvlk="MTWNQ-CKDHJ-3HXW9-Q2PFX-WB2HQ" />
<SkuItem DisplayName="Windows 10 Professional WMC Preview" Id="cf59a07b-1a2a-4be0-bfe0-423b5823e663" Gvlk="MY4N9-TGH34-4X4VY-8FG2T-RRDPV" />
<SkuItem DisplayName="Windows 8.x Preview" Id="2b9c337f-7a1d-4271-90a3-c6855a2b8a1c" Gvlk="MPWP3-DXNP9-BRD79-W8WFP-3YFJ6" />
<SkuItem DisplayName="Windows 8.x Preview ARM" Id="631ead72-a8ab-4df8-bbdf-372029989bdd" />
</KmsItem>
<KmsItem DisplayName="Windows Server 2008 A (Web and HPC)" Id="33e156e4-b76f-4a52-9f91-f641dd95ac48" DefaultKmsProtocol="4.0" NCountPolicy="5">
<SkuItem DisplayName="Windows Server 2008 Web" Id="ddfa9f7c-f09e-40b9-8c1a-be877a9a7f4b" Gvlk="WYR28-R7TFJ-3X2YQ-YCY4H-M249D" />
<SkuItem DisplayName="Windows Server 2008 Compute Cluster" Id="7afb1156-2c1d-40fc-b260-aab7442b62fe" Gvlk="RCTX3-KWVHP-BR6TB-RB6DM-6X7HP" />
</KmsItem>
<KmsItem DisplayName="Windows Server 2008 B (Standard and Enterprise)" Id="8fe53387-3087-4447-8985-f75132215ac9" DefaultKmsProtocol="4.0" NCountPolicy="5">
<SkuItem DisplayName="Windows Server 2008 Standard" Id="ad2542d4-9154-4c6d-8a44-30f11ee96989" Gvlk="TM24T-X9RMF-VWXK6-X8JC9-BFGM2" />
<SkuItem DisplayName="Windows Server 2008 Standard without Hyper-V" Id="2401e3d0-c50a-4b58-87b2-7e794b7d2607" Gvlk="W7VD6-7JFBR-RX26B-YKQ3Y-6FFFJ" />
<SkuItem DisplayName="Windows Server 2008 Enterprise" Id="c1af4d90-d1bc-44ca-85d4-003ba33db3b9" Gvlk="YQGMW-MPWTJ-34KDK-48M3W-X4Q6V" />
<SkuItem DisplayName="Windows Server 2008 Enterprise without Hyper-V" Id="8198490a-add0-47b2-b3ba-316b12d647b4" Gvlk="39BXF-X8Q23-P2WWT-38T2F-G3FPG" />
</KmsItem>
<KmsItem DisplayName="Windows Server 2008 C (Datacenter)" Id="8a21fdf3-cbc5-44eb-83f3-fe284e6680a7" DefaultKmsProtocol="4.0" NCountPolicy="5">
<SkuItem DisplayName="Windows Server 2008 Datacenter" Id="68b6e220-cf09-466b-92d3-45cd964b9509" Gvlk="7M67G-PC374-GR742-YH8V4-TCBY3" />
<SkuItem DisplayName="Windows Server 2008 Datacenter without Hyper-V" Id="fd09ef77-5647-4eff-809c-af2b64659a45" Gvlk="22XQ2-VRXRG-P8D42-K34TD-G3QQC" />
<SkuItem DisplayName="Windows Server 2008 for Itanium" Id="01ef176b-3e0d-422a-b4f8-4ea880035e8f" Gvlk="4DWFP-JF3DJ-B7DTH-78FJB-PDRHK" />
</KmsItem>
<KmsItem DisplayName="Windows Server 2008 R2 A (Web and HPC)" Id="0fc6ccaf-ff0e-4fae-9d08-4370785bf7ed" DefaultKmsProtocol="4.0" NCountPolicy="5">
<SkuItem DisplayName="Windows MultiPoint Server 2010" Id="f772515c-0e87-48d5-a676-e6962c3e1195" Gvlk="736RG-XDKJK-V34PF-BHK87-J6X3K" />
<SkuItem DisplayName="Windows Server 2008 R2 Web" Id="a78b8bd9-8017-4df5-b86a-09f756affa7c" Gvlk="6TPJF-RBVHG-WBW2R-86QPH-6RTM4" />
<SkuItem DisplayName="Windows Server 2008 R2 HPC Edition" Id="cda18cf3-c196-46ad-b289-60c072869994" Gvlk="TT8MH-CG224-D3D7Q-498W2-9QCTX" />
</KmsItem>
<KmsItem DisplayName="Windows Server 2008 R2 B (Standard and Enterprise)" Id="ca87f5b6-cd46-40c0-b06d-8ecd57a4373f" DefaultKmsProtocol="4.0" NCountPolicy="5">
<SkuItem DisplayName="Windows Server 2008 R2 Standard" Id="68531fb9-5511-4989-97be-d11a0f55633f" Gvlk="YC6KT-GKW9T-YTKYR-T4X34-R7VHC" />
<SkuItem DisplayName="Windows Server 2008 R2 Enterprise" Id="620e2b3d-09e7-42fd-802a-17a13652fe7a" Gvlk="489J6-VHDMP-X63PK-3K798-CPX3Y" />
</KmsItem>
<KmsItem DisplayName="Windows Server 2008 R2 C (Datacenter)" Id="b2ca2689-a9a8-42d7-938d-cf8e9f201958" DefaultKmsProtocol="4.0" NCountPolicy="5">
<SkuItem DisplayName="Windows Server 2008 R2 Datacenter" Id="7482e61b-c589-4b7f-8ecc-46d455ac3b87" Gvlk="74YFP-3QFB3-KQT8W-PMXWJ-7M648" />
<SkuItem DisplayName="Windows Server 2008 R2 for Itanium Enterprise" Id="8a26851c-1c7e-48d3-a687-fbca9b9ac16b" Gvlk="GT63C-RJFQ3-4GMB6-BRFB9-CB83V" />
</KmsItem>
<KmsItem DisplayName="Windows Server 2012" Id="8665cb71-468c-4aa3-a337-cb9bc9d5eaac" DefaultKmsProtocol="5.0" NCountPolicy="5">
<SkuItem DisplayName="Windows Server 2012 Datacenter" Id="d3643d60-0c42-412d-a7d6-52e6635327f6" Gvlk="48HP8-DN98B-MYWDG-T2DCC-8W83P" />
<SkuItem DisplayName="Windows Server 2012 MultiPoint Premium" Id="95fd1c83-7df5-494a-be8b-1300e1c9d1cd" Gvlk="XNH6W-2V9GX-RGJ4K-Y8X6F-QGJ2G" />
<SkuItem DisplayName="Windows Server 2012 MultiPoint Standard" Id="7d5486c7-e120-4771-b7f1-7b56c6d3170c" Gvlk="HM7DN-YVMH3-46JC3-XYTG7-CYQJJ" />
<SkuItem DisplayName="Windows Server 2012 Standard" Id="f0f5ec41-0d55-4732-af02-440a44a3cf0f" Gvlk="XC9B7-NBPP2-83J2H-RHMBY-92BT4" />
</KmsItem>
<KmsItem DisplayName="Windows Server 2012 R2" Id="8456efd3-0c04-4089-8740-5b7238535a65" DefaultKmsProtocol="6.0" NCountPolicy="5">
<SkuItem DisplayName="Windows Server 2012 R2 Cloud Storage" Id="b743a2be-68d4-4dd3-af32-92425b7bb623" Gvlk="3NPTF-33KPT-GGBPR-YX76B-39KDD" />
<SkuItem DisplayName="Windows Server 2012 R2 Datacenter" Id="00091344-1ea4-4f37-b789-01750ba6988c" Gvlk="W3GGN-FT8W3-Y4M27-J84CP-Q3VJ9" />
<SkuItem DisplayName="Windows Server 2012 R2 Essentials" Id="21db6ba4-9a7b-4a14-9e29-64a60c59301d" Gvlk="KNC87-3J2TX-XB4WP-VCPJV-M4FWM" />
<SkuItem DisplayName="Windows Server 2012 R2 Standard" Id="b3ca044e-a358-4d68-9883-aaa2941aca99" Gvlk="D2N9P-3P6X9-2R39C-7RTCD-MDVJX" />
</KmsItem>
<KmsItem DisplayName="Windows Server 2016" Id="6e9fc069-257d-4bc4-b4a7-750514d32743" DefaultKmsProtocol="6.0" NCountPolicy="5">
<SkuItem DisplayName="Windows Server 2016 Azure Core" Id="3dbf341b-5f6c-4fa7-b936-699dce9e263f" Gvlk="VP34G-4NPPG-79JTQ-864T4-R3MQX" />
<SkuItem DisplayName="Windows Server 2016 Cloud Storage" Id="7b4433f4-b1e7-4788-895a-c45378d38253" Gvlk="QN4C6-GBJD2-FB422-GHWJK-GJG2R" />
<SkuItem DisplayName="Windows Server 2016 Datacenter" Id="21c56779-b449-4d20-adfc-eece0e1ad74b" Gvlk="CB7KF-BWN84-R7R2Y-793K2-8XDDG" />
<SkuItem DisplayName="Windows Server 2016 Essentials" Id="2b5a1b0f-a5ab-4c54-ac2f-a6d94824a283" Gvlk="JCKRF-N37P4-C2D82-9YXRT-4M63B" />
<SkuItem DisplayName="Windows Server 2016 Standard" Id="8c1c5410-9f39-4805-8c9d-63a07706358f" Gvlk="WC2BQ-8NRM3-FDDYY-2BFGV-KHKQY" />
</KmsItem>
<KmsItem DisplayName="Windows Server Preview" Id="6d5f5270-31ac-433e-b90a-39892923c657" IsPreview="true" DefaultKmsProtocol="6.0" NCountPolicy="5">
<SkuItem DisplayName="Windows Server 2016 Datacenter Preview" Id="ba947c44-d19d-4786-b6ae-22770bc94c54" Gvlk="VRDD2-NVGDP-K7QG8-69BR4-TVFHB" />
</KmsItem>
<KmsItem DisplayName="Windows Vista" Id="212a64dc-43b1-4d3d-a30c-2fc69d2095c6" DefaultKmsProtocol="4.0">
<SkuItem DisplayName="Windows Vista Business" Id="4f3d1606-3fea-4c01-be3c-8d671c401e3b" Gvlk="YFKBB-PQJJV-G996G-VWGXY-2V3X8" />
<SkuItem DisplayName="Windows Vista Business N" Id="2c682dc2-8b68-4f63-a165-ae291d4cf138" Gvlk="HMBQG-8H2RH-C77VX-27R82-VMQBT" />
<SkuItem DisplayName="Windows Vista Enterprise" Id="cfd8ff08-c0d7-452b-9f60-ef5c70c32094" Gvlk="VKK3X-68KWM-X2YGT-QR4M6-4BWMV" />
<SkuItem DisplayName="Windows Vista Enterprise N" Id="d4f54950-26f2-4fb4-ba21-ffab16afcade" Gvlk="VTC42-BM838-43QHV-84HX6-XJXKV" />
</KmsItem>
</AppItem>
<AppItem DisplayName="Office2010" Id="59a52881-a989-479d-af46-f275c6370663" VlmcsdEpidName="EPID_OFFICE2010" MinimumActiveClients="10">
<KmsItem DisplayName="Office 2010" Id="e85af946-2e25-47b7-83e1-bebcebeac611" VlmcsdEpidName="EPID_OFFICE2010" DefaultKmsProtocol="4.0" NCountPolicy="5">
<SkuItem DisplayName="Office Access 2010" Id="8ce7e872-188c-4b98-9d90-f8f90b7aad02" Gvlk="V7Y44-9T38C-R2VJK-666HK-T7DDX" />
<SkuItem DisplayName="Office Excel 2010" Id="cee5d470-6e3b-4fcc-8c2b-d17428568a9f" Gvlk="H62QG-HXVKF-PP4HP-66KMR-CW9BM" />
<SkuItem DisplayName="Office Groove 2010" Id="8947d0b8-c33b-43e1-8c56-9b674c052832" Gvlk="QYYW6-QP4CB-MBV6G-HYMCJ-4T3J4" />
<SkuItem DisplayName="Office InfoPath 2010" Id="ca6b6639-4ad6-40ae-a575-14dee07f6430" Gvlk="K96W8-67RPQ-62T9Y-J8FQJ-BT37T" />
<SkuItem DisplayName="Office Mondo 1 2010" Id="09ed9640-f020-400a-acd8-d7d867dfd9c2" Gvlk="YBJTT-JG6MD-V9Q7P-DBKXJ-38W9R" />
<SkuItem DisplayName="Office Mondo 2 2010" Id="ef3d4e49-a53d-4d81-a2b1-2ca6c2556b2c" Gvlk="7TC2V-WXF6P-TD7RT-BQRXR-B8K32" />
<SkuItem DisplayName="Office OneNote 2010" Id="ab586f5c-5256-4632-962f-fefd8b49e6f4" Gvlk="Q4Y4M-RHWJM-PY37F-MTKWH-D3XHX" />
<SkuItem DisplayName="Office OutLook 2010" Id="ecb7c192-73ab-4ded-acf4-2399b095d0cc" Gvlk="7YDC2-CWM8M-RRTJC-8MDVC-X3DWQ" />
<SkuItem DisplayName="Office PowerPoint 2010" Id="45593b1d-dfb1-4e91-bbfb-2d5d0ce2227a" Gvlk="RC8FX-88JRY-3PF7C-X8P67-P4VTT" />
<SkuItem DisplayName="Office Professional Plus 2010" Id="6f327760-8c5c-417c-9b61-836a98287e0c" Gvlk="VYBBJ-TRJPB-QFQRF-QFT4D-H3GVB" />
<SkuItem DisplayName="Office Project Pro 2010" Id="df133ff7-bf14-4f95-afe3-7b48e7e331ef" Gvlk="YGX6F-PGV49-PGW3J-9BTGG-VHKC6" />
<SkuItem DisplayName="Office Project Standard 2010" Id="5dc7bf61-5ec9-4996-9ccb-df806a2d0efe" Gvlk="4HP3K-88W3F-W2K3D-6677X-F9PGB" />
<SkuItem DisplayName="Office Publisher 2010" Id="b50c4f75-599b-43e8-8dcd-1081a7967241" Gvlk="BFK7F-9MYHM-V68C7-DRQ66-83YTP" />
<SkuItem DisplayName="Office Small Business Basics 2010" Id="ea509e87-07a1-4a45-9edc-eba5a39f36af" Gvlk="D6QFG-VBYP2-XQHM7-J97RH-VVRCK" />
<SkuItem DisplayName="Office Standard 2010" Id="9da2a678-fb6b-4e67-ab84-60dd6a9c819a" Gvlk="V7QKV-4XVVR-XYV4D-F7DFM-8R6BM" />
<SkuItem DisplayName="Office Visio Premium 2010" Id="92236105-bb67-494f-94c7-7f7a607929bd" Gvlk="D9DWC-HPYVV-JGF4P-BTWQB-WX8BJ" />
<SkuItem DisplayName="Office Visio Pro 2010" Id="e558389c-83c3-4b29-adfe-5e4d7f46c358" Gvlk="7MCW8-VRQVK-G677T-PDJCM-Q8TCP" />
<SkuItem DisplayName="Office Visio Standard 2010" Id="9ed833ff-4f92-4f36-b370-8683a4f13275" Gvlk="767HD-QGMWX-8QTDB-9G3R2-KHFGJ" />
<SkuItem DisplayName="Office Word 2010" Id="2d0882e7-a4e7-423b-8ccc-70d91e0158b1" Gvlk="HVHB3-C6FV7-KQX9W-YQG79-CRY7T" />
</KmsItem>
</AppItem>
<AppItem DisplayName="Office2013+" Id="0ff1ce15-a989-479d-af46-f275c6370663" VlmcsdEpidName="EPID_OFFICE2013" MinimumActiveClients="10">
<KmsItem DisplayName="Office 2013" Id="e6a6f1bf-9d40-40c3-aa9f-c77ba21578c0" VlmcsdEpidName="EPID_OFFICE2013" DefaultKmsProtocol="5.0" NCountPolicy="5">
<SkuItem DisplayName="Office Access 2013" Id="6ee7622c-18d8-4005-9fb7-92db644a279b" Gvlk="NG2JY-H4JBT-HQXYP-78QH9-4JM2D" />
<SkuItem DisplayName="Office Excel 2013" Id="f7461d52-7c2b-43b2-8744-ea958e0bd09a" Gvlk="VGPNG-Y7HQW-9RHP7-TKPV3-BG7GB" />
<SkuItem DisplayName="Office InfoPath 2013" Id="a30b8040-d68a-423f-b0b5-9ce292ea5a8f" Gvlk="DKT8B-N7VXH-D963P-Q4PHY-F8894" />
<SkuItem DisplayName="Office Lync 2013" Id="1b9f11e3-c85c-4e1b-bb29-879ad2c909e3" Gvlk="2MG3G-3BNTT-3MFW9-KDQW3-TCK7R" />
<SkuItem DisplayName="Office Mondo 2013" Id="dc981c6b-fc8e-420f-aa43-f8f33e5c0923" Gvlk="42QTK-RN8M7-J3C4G-BBGYM-88CYV" />
<SkuItem DisplayName="Office OneNote 2013" Id="efe1f3e6-aea2-4144-a208-32aa872b6545" Gvlk="TGN6P-8MMBC-37P2F-XHXXK-P34VW" />
<SkuItem DisplayName="Office OutLook 2013" Id="771c3afa-50c5-443f-b151-ff2546d863a0" Gvlk="QPN8Q-BJBTJ-334K3-93TGY-2PMBT" />
<SkuItem DisplayName="Office PowerPoint 2013" Id="8c762649-97d1-4953-ad27-b7e2c25b972e" Gvlk="4NT99-8RJFH-Q2VDH-KYG2C-4RD4F" />
<SkuItem DisplayName="Office Professional Plus 2013" Id="b322da9c-a2e2-4058-9e4e-f59a6970bd69" Gvlk="YC7DK-G2NP3-2QQC3-J6H88-GVGXT" />
<SkuItem DisplayName="Office Project Pro 2013" Id="4a5d124a-e620-44ba-b6ff-658961b33b9a" Gvlk="FN8TT-7WMH6-2D4X9-M337T-2342K" />
<SkuItem DisplayName="Office Project Standard 2013" Id="427a28d1-d17c-4abf-b717-32c780ba6f07" Gvlk="6NTH3-CW976-3G3Y2-JK3TX-8QHTT" />
<SkuItem DisplayName="Office Publisher 2013" Id="00c79ff1-6850-443d-bf61-71cde0de305f" Gvlk="PN2WF-29XG2-T9HJ7-JQPJR-FCXK4" />
<SkuItem DisplayName="Office Standard 2013" Id="b13afb38-cd79-4ae5-9f7f-eed058d750ca" Gvlk="KBKQT-2NMXY-JJWGP-M62JB-92CD4" />
<SkuItem DisplayName="Office Visio Pro 2013" Id="e13ac10e-75d0-4aff-a0cd-764982cf541c" Gvlk="C2FG9-N6J68-H8BTJ-BW3QX-RM3B3" />
<SkuItem DisplayName="Office Visio Standard 2013" Id="ac4efaf0-f81f-4f61-bdf7-ea32b02ab117" Gvlk="J484Y-4NKBF-W2HMG-DBMJC-PGWR7" />
<SkuItem DisplayName="Office Word 2013" Id="d9f5b1c6-5386-495a-88f9-9ad6b41ac9b3" Gvlk="6Q7VD-NX8JD-WJ2VH-88V73-4GBJ7" />
</KmsItem>
<KmsItem DisplayName="Office 2013 (Pre-Release)" Id="aa4c7968-b9da-4680-92b6-acb25e2f866c" VlmcsdEpidName="EPID_OFFICE2013" IsPreview="true" DefaultKmsProtocol="5.0" NCountPolicy="5">
<SkuItem DisplayName="Office Access 2013 (Pre-Release)" Id="44b538e2-fb34-4732-81e4-644c17d2e746" Gvlk="DJBH8-RGN7Q-836KD-DMP3M-DM9MF" />
<SkuItem DisplayName="Office Excel 2013 (Pre-Release)" Id="9373bfa0-97b3-4587-ab73-30934461d55c" Gvlk="Q3BNP-3WXDT-GG8HF-24KMW-HMDBK" />
<SkuItem DisplayName="Office Groove 2013 (Pre-Release)" Id="aa286eb4-556f-4eeb-967c-c1b771b7673e" Gvlk="WVCGG-NK4FG-7XKXM-BD4WF-3C624" />
<SkuItem DisplayName="Office InfoPath 2013 (Pre-Release)" Id="7ccc8256-fbaa-49c6-b2a9-f5afb4257cd2" Gvlk="7KPJJ-N8TT7-CK3KR-QTV98-YPVXQ" />
<SkuItem DisplayName="Office Lync 2013 (Pre-Release)" Id="c53dfe17-cc00-4967-b188-a088a965494d" Gvlk="XNVD3-RYC7T-7R6BT-WX6CF-8BYH7" />
<SkuItem DisplayName="Office Mondo 2013 (Pre-Release)" Id="2816a87d-e1ed-4097-b311-e2341c57b179" Gvlk="GCGCN-6FJRM-TR9Q3-BGMWJ-78KQV" />
<SkuItem DisplayName="Office OneNote 2013 (Pre-Release)" Id="67c0f908-184f-4f64-8250-12db797ab3c3" Gvlk="VYNYX-8GPBC-7FQMD-D6B7B-7MDFD" />
<SkuItem DisplayName="Office Outlook 2013 (Pre-Release)" Id="7bce4e7a-dd80-4682-98fa-f993725803d2" Gvlk="X2KNB-FRRG2-WXDPH-739DM-DM9RH" />
<SkuItem DisplayName="Office PowerPoint 2013 (Pre-Release)" Id="1ec10c0a-54f6-453e-b85a-6fa1bbfea9b7" Gvlk="B8CT8-BTNFQ-XQXBK-BFWV8-HMDFQ" />
<SkuItem DisplayName="Office Professional Plus 2013 (Pre-Release)" Id="87d2b5bf-d47b-41fb-af62-71c382f5cc85" Gvlk="PGD67-JN23K-JGVWV-KTHP4-GXR9G" />
<SkuItem DisplayName="Office Project Pro 2013 (Pre-Release)" Id="3cfe50a9-0e03-4b29-9754-9f193f07b71f" Gvlk="NFKVM-DVG7F-TYWYR-3RPHY-F872K" />
<SkuItem DisplayName="Office Project Standard 2013 (Pre-Release)" Id="39e49e57-ae68-4ee3-b098-26480df3da96" Gvlk="N89QF-GGB8J-BKD28-C4V28-W4XTK" />
<SkuItem DisplayName="Office Publisher 2013 (Pre-Release)" Id="15aa2117-8f79-49a8-8317-753026d6a054" Gvlk="NB67P-J8XP4-XDK9B-V73VH-M4CKR" />
<SkuItem DisplayName="Office Visio Pro 2013 (Pre-Release)" Id="cfbfd60e-0b5f-427d-917c-a4df42a80e44" Gvlk="B3C7Q-D6NH2-2VRFW-HHWDG-FVQB6" />
<SkuItem DisplayName="Office Visio Standard 2013 (Pre-Release)" Id="7012cc81-8887-42e9-b17d-4e5e42760f0d" Gvlk="9MKNF-J9XQ6-JV4XB-FJQPY-43F43" />
<SkuItem DisplayName="Office Word 2013 (Pre-Release)" Id="de9c7eb6-5a85-420d-9703-fff11bdd4d43" Gvlk="JBGD4-3JNG7-JWWGV-CR6TP-DC62Q" />
</KmsItem>
<KmsItem DisplayName="Office 2016" Id="85b5f61b-320b-4be3-814a-b76b2bfafc82" DefaultKmsProtocol="6.0" NCountPolicy="5" VlmcsdEpidName="EPID_OFFICE2016">
<SkuItem DisplayName="Office Access 2016" Id="67c0fc0c-deba-401b-bf8b-9c8ad8395804" Gvlk="GNH9Y-D2J4T-FJHGG-QRVH7-QPFDW" />
<SkuItem DisplayName="Office Excel 2016" Id="c3e65d36-141f-4d2f-a303-a842ee756a29" Gvlk="9C2PK-NWTVB-JMPW8-BFT28-7FTBF" />
<SkuItem DisplayName="Office Mondo 2016" Id="9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce" Gvlk="HFTND-W9MK4-8B7MJ-B6C4G-XQBR2" />
<SkuItem DisplayName="Office Mondo R 2016" Id="e914ea6e-a5fa-4439-a394-a9bb3293ca09" />
<SkuItem DisplayName="Office OneNote 2016" Id="d8cace59-33d2-4ac7-9b1b-9b72339c51c8" Gvlk="DR92N-9HTF2-97XKM-XW2WJ-XW3J6" />
<SkuItem DisplayName="Office Outlook 2016" Id="ec9d9265-9d1e-4ed0-838a-cdc20f2551a1" Gvlk="R69KK-NTPKF-7M3Q4-QYBHW-6MT9B" />
<SkuItem DisplayName="Office Powerpoint 2016" Id="d70b1bba-b893-4544-96e2-b7a318091c33" Gvlk="J7MQP-HNJ4Y-WJ7YM-PFYGF-BY6C6" />
<SkuItem DisplayName="Office Professional Plus 2016" Id="d450596f-894d-49e0-966a-fd39ed4c4c64" Gvlk="XQNVK-8JYDB-WJ9W3-YJ8YR-WFG99" />
<SkuItem DisplayName="Office Project Pro 2016" Id="4f414197-0fc2-4c01-b68a-86cbb9ac254c" Gvlk="YG9NW-3K39V-2T3HJ-93F3Q-G83KT" />
<SkuItem DisplayName="Office Project Pro 2016 XC2R" Id="829b8110-0e6f-4349-bca4-42803577788d" Gvlk="WGT24-HCNMF-FQ7XH-6M8K7-DRTW9" />
<SkuItem DisplayName="Office Project Standard 2016" Id="da7ddabc-3fbe-4447-9e01-6ab7440b4cd4" Gvlk="GNFHQ-F6YQM-KQDGJ-327XX-KQBVC" />
<SkuItem DisplayName="Office Project Standard 2016 XC2R" Id="cbbaca45-556a-4416-ad03-bda598eaa7c8" Gvlk="D8NRQ-JTYM3-7J2DX-646CT-6836M" />
<SkuItem DisplayName="Office Publisher 2016" Id="041a06cb-c5b8-4772-809f-416d03d16654" Gvlk="F47MM-N3XJP-TQXJ9-BP99D-8K837" />
<SkuItem DisplayName="Office Skype for Business 2016" Id="83e04ee1-fa8d-436d-8994-d31a862cab77" Gvlk="869NQ-FJ69K-466HW-QYCP2-DDBV6" />
<SkuItem DisplayName="Office Standard 2016" Id="dedfa23d-6ed1-45a6-85dc-63cae0546de6" Gvlk="JNRGM-WHDWX-FJJG3-K47QV-DRTFM" />
<SkuItem DisplayName="Office Visio Pro 2016" Id="6bf301c1-b94a-43e9-ba31-d494598c47fb" Gvlk="PD3PC-RHNGV-FXJ29-8JK7D-RJRJK" />
<SkuItem DisplayName="Office Visio Pro 2016 XC2R" Id="b234abe3-0857-4f9c-b05a-4dc314f85557" Gvlk="69WXN-MBYV6-22PQG-3WGHK-RM6XC" />
<SkuItem DisplayName="Office Visio Standard 2016" Id="aa2a7821-1827-4c2c-8f1d-4513a34dda97" Gvlk="7WHWN-4T7MP-G96JF-G33KR-W8GF4" />
<SkuItem DisplayName="Office Visio Standard 2016 XC2R" Id="361fe620-64f4-41b5-ba77-84f8e079b1f7" Gvlk="NY48V-PPYYH-3F4PX-XJRKJ-W4423" />
<SkuItem DisplayName="Office Word 2016" Id="bb11badf-d8aa-470e-9311-20eaf80fe5cc" Gvlk="WXY84-JN2Q9-RBCCQ-3Q3J3-3PFJ6" />
</KmsItem>
</AppItem>
</KmsData>

237
LICENSE Normal file
View File

@ -0,0 +1,237 @@
py-kms itself is unlicensed so far, however, these modules have their own
license:
xmltok.py from micropython-lib is licensed under MIT license.
https://github.com/micropython/micropython-lib
uxml2dict.py from uxml2dict is licensed under Apache license version 2.0.
https://github.com/ThunderEX/uxml2dict
=============== MIT License ===============
The MIT License (MIT)
Copyright (c) 2013, 2014 micropython-lib contributors
Permission is hereby granted, free of charge, to any person obtaining a copy
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 copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
=============== Apache License ===============
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@ -15,129 +15,10 @@ try:
except ImportError:
pass
appIds = {
uuid.UUID("55C92734-D682-4D71-983E-D6EC3F16059F") : "Windows",
uuid.UUID("59A52881-A989-479D-AF46-F275C6370663") : "Office 14 (2010)",
uuid.UUID("0FF1CE15-A989-479D-AF46-F275C6370663") : "Office 15 (2013)",
}
from xmltok import tokenize
from uxml2dict import parse
skuIds = {
uuid.UUID("ad2542d4-9154-4c6d-8a44-30f11ee96989") : "Windows Server 2008 Standard",
uuid.UUID("2401e3d0-c50a-4b58-87b2-7e794b7d2607") : "Windows Server 2008 StandardV",
uuid.UUID("68b6e220-cf09-466b-92d3-45cd964b9509") : "Windows Server 2008 Datacenter",
uuid.UUID("fd09ef77-5647-4eff-809c-af2b64659a45") : "Windows Server 2008 DatacenterV",
uuid.UUID("c1af4d90-d1bc-44ca-85d4-003ba33db3b9") : "Windows Server 2008 Enterprise",
uuid.UUID("8198490a-add0-47b2-b3ba-316b12d647b4") : "Windows Server 2008 EnterpriseV",
uuid.UUID("ddfa9f7c-f09e-40b9-8c1a-be877a9a7f4b") : "Windows Server 2008 Web",
uuid.UUID("7afb1156-2c1d-40fc-b260-aab7442b62fe") : "Windows Server 2008 ComputerCluster",
uuid.UUID("68531fb9-5511-4989-97be-d11a0f55633f") : "Windows Server 2008 R2 Standard",
uuid.UUID("7482e61b-c589-4b7f-8ecc-46d455ac3b87") : "Windows Server 2008 R2 Datacenter",
uuid.UUID("620e2b3d-09e7-42fd-802a-17a13652fe7a") : "Windows Server 2008 R2 Enterprise",
uuid.UUID("a78b8bd9-8017-4df5-b86a-09f756affa7c") : "Windows Server 2008 R2 Web",
uuid.UUID("cda18cf3-c196-46ad-b289-60c072869994") : "Windows Server 2008 R2 ComputerCluster",
uuid.UUID("d3643d60-0c42-412d-a7d6-52e6635327f6") : "Windows Server 2012 Datacenter",
uuid.UUID("f0f5ec41-0d55-4732-af02-440a44a3cf0f") : "Windows Server 2012 Standard",
uuid.UUID("95fd1c83-7df5-494a-be8b-1300e1c9d1cd") : "Windows Server 2012 MultiPoint Premium",
uuid.UUID("7d5486c7-e120-4771-b7f1-7b56c6d3170c") : "Windows Server 2012 MultiPoint Standard",
uuid.UUID("00091344-1ea4-4f37-b789-01750ba6988c") : "Windows Server 2012 R2 Datacenter",
uuid.UUID("b3ca044e-a358-4d68-9883-aaa2941aca99") : "Windows Server 2012 R2 Standard",
uuid.UUID("b743a2be-68d4-4dd3-af32-92425b7bb623") : "Windows Server 2012 R2 Cloud Storage",
uuid.UUID("21db6ba4-9a7b-4a14-9e29-64a60c59301d") : "Windows Server Essentials 2012 R2",
uuid.UUID("81671aaf-79d1-4eb1-b004-8cbbe173afea") : "Windows 8.1 Enterprise",
uuid.UUID("113e705c-fa49-48a4-beea-7dd879b46b14") : "Windows 8.1 EnterpriseN",
uuid.UUID("096ce63d-4fac-48a9-82a9-61ae9e800e5f") : "Windows 8.1 Professional WMC",
uuid.UUID("c06b6981-d7fd-4a35-b7b4-054742b7af67") : "Windows 8.1 Professional",
uuid.UUID("7476d79f-8e48-49b4-ab63-4d0b813a16e4") : "Windows 8.1 ProfessionalN",
uuid.UUID("fe1c3238-432a-43a1-8e25-97e7d1ef10f3") : "Windows 8.1 Core",
uuid.UUID("78558a64-dc19-43fe-a0d0-8075b2a370a3") : "Windows 8.1 CoreN",
uuid.UUID("a00018a3-f20f-4632-bf7c-8daa5351c914") : "Windows 8 Professional WMC",
uuid.UUID("a98bcd6d-5343-4603-8afe-5908e4611112") : "Windows 8 Professional",
uuid.UUID("ebf245c1-29a8-4daf-9cb1-38dfc608a8c8") : "Windows 8 ProfessionalN",
uuid.UUID("458e1bec-837a-45f6-b9d5-925ed5d299de") : "Windows 8 Enterprise",
uuid.UUID("e14997e7-800a-4cf7-ad10-de4b45b578db") : "Windows 8 EnterpriseN",
uuid.UUID("c04ed6bf-55c8-4b47-9f8e-5a1f31ceee60") : "Windows 8 Core",
uuid.UUID("197390a0-65f6-4a95-bdc4-55d58a3b0253") : "Windows 8 CoreN",
uuid.UUID("ae2ee509-1b34-41c0-acb7-6d4650168915") : "Windows 7 Enterprise",
uuid.UUID("1cb6d605-11b3-4e14-bb30-da91c8e3983a") : "Windows 7 EnterpriseN",
uuid.UUID("b92e9980-b9d5-4821-9c94-140f632f6312") : "Windows 7 Professional",
uuid.UUID("54a09a0d-d57b-4c10-8b69-a842d6590ad5") : "Windows 7 ProfessionalN",
uuid.UUID("cfd8ff08-c0d7-452b-9f60-ef5c70c32094") : "Windows Vista Enterprise",
uuid.UUID("d4f54950-26f2-4fb4-ba21-ffab16afcade") : "Windows Vista EnterpriseN",
uuid.UUID("4f3d1606-3fea-4c01-be3c-8d671c401e3b") : "Windows Vista Business",
uuid.UUID("2c682dc2-8b68-4f63-a165-ae291d4cf138") : "Windows Vista BusinessN",
uuid.UUID("aa6dd3aa-c2b4-40e2-a544-a6bbb3f5c395") : "Windows ThinPC",
uuid.UUID("db537896-376f-48ae-a492-53d0547773d0") : "Windows Embedded POSReady 7",
uuid.UUID("0ab82d54-47f4-4acb-818c-cc5bf0ecb649") : "Windows Embedded Industry 8.1",
uuid.UUID("cd4e2d9f-5059-4a50-a92d-05d5bb1267c7") : "Windows Embedded IndustryE 8.1",
uuid.UUID("f7e88590-dfc7-4c78-bccb-6f3865b99d1a") : "Windows Embedded IndustryA 8.1",
uuid.UUID("8ce7e872-188c-4b98-9d90-f8f90b7aad02") : "Office Access 2010",
uuid.UUID("cee5d470-6e3b-4fcc-8c2b-d17428568a9f") : "Office Excel 2010",
uuid.UUID("8947d0b8-c33b-43e1-8c56-9b674c052832") : "Office Groove 2010",
uuid.UUID("ca6b6639-4ad6-40ae-a575-14dee07f6430") : "Office InfoPath 2010",
uuid.UUID("09ed9640-f020-400a-acd8-d7d867dfd9c2") : "Office Mondo 2010",
uuid.UUID("ef3d4e49-a53d-4d81-a2b1-2ca6c2556b2c") : "Office Mondo 2010",
uuid.UUID("ab586f5c-5256-4632-962f-fefd8b49e6f4") : "Office OneNote 2010",
uuid.UUID("ecb7c192-73ab-4ded-acf4-2399b095d0cc") : "Office OutLook 2010",
uuid.UUID("45593b1d-dfb1-4e91-bbfb-2d5d0ce2227a") : "Office PowerPoint 2010",
uuid.UUID("df133ff7-bf14-4f95-afe3-7b48e7e331ef") : "Office Project Pro 2010",
uuid.UUID("5dc7bf61-5ec9-4996-9ccb-df806a2d0efe") : "Office Project Standard 2010",
uuid.UUID("b50c4f75-599b-43e8-8dcd-1081a7967241") : "Office Publisher 2010",
uuid.UUID("92236105-bb67-494f-94c7-7f7a607929bd") : "Office Visio Premium 2010",
uuid.UUID("e558389c-83c3-4b29-adfe-5e4d7f46c358") : "Office Visio Pro 2010",
uuid.UUID("9ed833ff-4f92-4f36-b370-8683a4f13275") : "Office Visio Standard 2010",
uuid.UUID("2d0882e7-a4e7-423b-8ccc-70d91e0158b1") : "Office Word 2010",
uuid.UUID("6f327760-8c5c-417c-9b61-836a98287e0c") : "Office Professional Plus 2010",
uuid.UUID("9da2a678-fb6b-4e67-ab84-60dd6a9c819a") : "Office Standard 2010",
uuid.UUID("ea509e87-07a1-4a45-9edc-eba5a39f36af") : "Office Small Business Basics 2010",
uuid.UUID("6ee7622c-18d8-4005-9fb7-92db644a279b") : "Office Access 2013",
uuid.UUID("f7461d52-7c2b-43b2-8744-ea958e0bd09a") : "Office Excel 2013",
uuid.UUID("a30b8040-d68a-423f-b0b5-9ce292ea5a8f") : "Office InfoPath 2013",
uuid.UUID("1b9f11e3-c85c-4e1b-bb29-879ad2c909e3") : "Office Lync 2013",
uuid.UUID("dc981c6b-fc8e-420f-aa43-f8f33e5c0923") : "Office Mondo 2013",
uuid.UUID("efe1f3e6-aea2-4144-a208-32aa872b6545") : "Office OneNote 2013",
uuid.UUID("771c3afa-50c5-443f-b151-ff2546d863a0") : "Office OutLook 2013",
uuid.UUID("8c762649-97d1-4953-ad27-b7e2c25b972e") : "Office PowerPoint 2013",
uuid.UUID("4a5d124a-e620-44ba-b6ff-658961b33b9a") : "Office Project Pro 2013",
uuid.UUID("427a28d1-d17c-4abf-b717-32c780ba6f07") : "Office Project Standard 2013",
uuid.UUID("00c79ff1-6850-443d-bf61-71cde0de305f") : "Office Publisher 2013",
uuid.UUID("b13afb38-cd79-4ae5-9f7f-eed058d750ca") : "Office Visio Standard 2013",
uuid.UUID("e13ac10e-75d0-4aff-a0cd-764982cf541c") : "Office Visio Pro 2013",
uuid.UUID("d9f5b1c6-5386-495a-88f9-9ad6b41ac9b3") : "Office Word 2013",
uuid.UUID("b322da9c-a2e2-4058-9e4e-f59a6970bd69") : "Office Professional Plus 2013",
uuid.UUID("b13afb38-cd79-4ae5-9f7f-eed058d750ca") : "Office Standard 2013",
uuid.UUID("d450596f-894d-49e0-966a-fd39ed4c4c64") : "Office Professional Plus 2016",
uuid.UUID("dedfa23d-6ed1-45a6-85dc-63cae0546de6") : "Office Standard 2016",
uuid.UUID("4f414197-0fc2-4c01-b68a-86cbb9ac254c") : "Office Project Pro 2016",
uuid.UUID("da7ddabc-3fbe-4447-9e01-6ab7440b4cd4") : "Office Project Standard 2016",
uuid.UUID("6bf301c1-b94a-43e9-ba31-d494598c47fb") : "Office Visio Pro 2016",
uuid.UUID("aa2a7821-1827-4c2c-8f1d-4513a34dda97") : "Office Visio Standard 2016",
uuid.UUID("041a06cb-c5b8-4772-809f-416d03d16654") : "Office Publisher 2016",
uuid.UUID("67c0fc0c-deba-401b-bf8b-9c8ad8395804") : "Office Access 2016",
uuid.UUID("83e04ee1-fa8d-436d-8994-d31a862cab77") : "Office Skype for Business 2016",
uuid.UUID("9caabccb-61b1-4b4b-8bec-d10a3c3ac2ce") : "Office Mondo 2016",
uuid.UUID("e914ea6e-a5fa-4439-a394-a9bb3293ca09") : "Office Mondo R 2016",
uuid.UUID("bb11badf-d8aa-470e-9311-20eaf80fe5cc") : "Office Word 2016",
uuid.UUID("c3e65d36-141f-4d2f-a303-a842ee756a29") : "Office Excel 2016",
uuid.UUID("d70b1bba-b893-4544-96e2-b7a318091c33") : "Office Powerpoint 2016",
uuid.UUID("d8cace59-33d2-4ac7-9b1b-9b72339c51c8") : "Office OneNote 2016",
uuid.UUID("ec9d9265-9d1e-4ed0-838a-cdc20f2551a1") : "Office Outlook 2016",
uuid.UUID("a4383e6b-dada-423d-a43d-f25678429676") : "Windows 10 Professional TechPreview",
uuid.UUID("cf59a07b-1a2a-4be0-bfe0-423b5823e663") : "Windows 10 Professional WMC TechPreview",
uuid.UUID("cde952c7-2f96-4d9d-8f2b-2d349f64fc51") : "Windows 10 Enterprise TechPreview",
uuid.UUID("6496e59d-89dc-49eb-a353-09ceb9404845") : "Windows 10 Core TechPreview",
uuid.UUID("73111121-5638-40f6-bc11-f1d7b0d64300") : "Windows 10 Enterprise",
uuid.UUID("e272e3e2-732f-4c65-a8f0-484747d0d947") : "Windows 10 Enterprise N",
uuid.UUID("7b51a46c-0c04-4e8f-9af4-8496cca90d5e") : "Windows 10 Enterprise LTSB",
uuid.UUID("87b838b7-41b6-4590-8318-5797951d8529") : "Windows 10 Enterprise LTSB N",
uuid.UUID("e0c42288-980c-4788-a014-c080d2e1926e") : "Windows 10 Education",
uuid.UUID("3c102355-d027-42c6-ad23-2e7ef8a02585") : "Windows 10 Education N",
uuid.UUID("2de67392-b7a7-462a-b1ca-108dd189f588") : "Windows 10 Professional",
uuid.UUID("a80b5abf-76ad-428b-b05d-a47d2dffeebf") : "Windows 10 Professional N",
uuid.UUID("58e97c99-f377-4ef1-81d5-4ad5522b5fd8") : "Windows 10 Home",
uuid.UUID("7b9e1751-a8da-4f75-9560-5fadfe3d8e38") : "Windows 10 Home N",
uuid.UUID("cd918a57-a41b-4c82-8dce-1a538e221a83") : "Windows 10 Home Single Language",
uuid.UUID("a9107544-f4a0-4053-a96a-1479abdef912") : "Windows 10 Home Country Specific",
}
kmsdb = 'KmsDataBase.xml'
licenseStates = {
0 : "Unlicensed",
@ -257,9 +138,9 @@ class kmsBase:
print("KMS Request Bytes:", binascii.b2a_hex(bytes(kmsRequest)))
print("KMS Request:", kmsRequest.dump())
clientMachineId = kmsRequest['clientMachineId'].get()
applicationId = kmsRequest['applicationId'].get()
skuId = kmsRequest['skuId'].get()
clientMachineId = str(kmsRequest['clientMachineId'].get())
applicationId = str(kmsRequest['applicationId'].get())
skuId = str(kmsRequest['skuId'].get())
requestDatetime = filetimes.filetime_to_dt(kmsRequest['requestTime'])
# Try and localize the request time, if pytz is available
@ -270,11 +151,21 @@ class kmsBase:
except ImportError:
local_dt = requestDatetime
kmsdata = parse(tokenize(open(kmsdb)), lesslist=False)['KmsData'][0]
appName, skuName = applicationId, skuId
for app in kmsdata['AppItem']:
if app['@Id'] == applicationId:
appName = app['@DisplayName']
for kms in app['KmsItem']:
for sku in kms.get('SkuItem', []):
if sku['@Id'] == skuId:
skuName = sku['@DisplayName']
infoDict = {
"machineName" : kmsRequest.getMachineName(),
"clientMachineId" : str(clientMachineId),
"appId" : appIds.get(applicationId, str(applicationId)),
"skuId" : skuIds.get(skuId, str(skuId)),
"clientMachineId" : clientMachineId,
"appId" : appName,
"skuId" : skuName,
"licenseStatus" : kmsRequest.getLicenseStatus(),
"requestTime" : int(time.time()),
"kmsEpid" : None

71
uxml2dict.py Normal file
View File

@ -0,0 +1,71 @@
try: # pragma no cover
from collections import OrderedDict
except ImportError: # pragma no cover
try:
from ordereddict import OrderedDict
except ImportError:
try:
from ucollections import OrderedDict # micropython
except ImportError:
OrderedDict = dict
TEXT = "TEXT"
START_TAG = "START_TAG"
#START_TAG_DONE = "START_TAG_DONE"
END_TAG = "END_TAG"
PI = "PI"
#PI_DONE = "PI_DONE"
ATTR = "ATTR"
#ATTR_VAL = "ATTR_VAL"
def parseitem(iter_tok, parsed, lesslist):
while True:
try:
tok = next(iter_tok)
except StopIteration:
return iter_tok
if tok[0] == PI:
pass
elif tok[0] == ATTR:
_, (namespace, attr), value = tok
if namespace:
attr = namespace + ':' + attr
parsed['@' + attr] = value
elif tok[0] == TEXT:
_, text = tok
parsed['#text'] = text
elif tok[0] == START_TAG:
_, (namespace, tag) = tok
if namespace:
tag = namespace + ':' + tag
d = OrderedDict()
iter_tok = parseitem(iter_tok, d, lesslist)
if not d:
d = None
elif len(d) == 1 and '#text' in d:
d = d['#text']
parsed.setdefault(tag, [])
if lesslist and len(parsed[tag]) == 1:
parsed[tag] = [parsed[tag]]
parsed[tag].append(d)
if lesslist and len(parsed[tag]) == 1:
parsed[tag] = parsed[tag][0]
elif tok[0] == END_TAG:
return iter_tok
else:
raise NotImplementedError('Token %s not support' % tok[0])
def parse(iter_tok, lesslist=True):
parsed = OrderedDict()
parseitem(iter_tok, parsed, lesslist)
return parsed
if __name__ == '__main__':
import json
import xmltok
iter_tok = xmltok.tokenize(open('vector-text.svg'))
parsed = parse(iter_tok)
print(json.dumps(parsed, indent=4))

144
xmltok.py Normal file
View File

@ -0,0 +1,144 @@
TEXT = "TEXT"
START_TAG = "START_TAG"
#START_TAG_DONE = "START_TAG_DONE"
END_TAG = "END_TAG"
PI = "PI"
#PI_DONE = "PI_DONE"
ATTR = "ATTR"
#ATTR_VAL = "ATTR_VAL"
class XMLSyntaxError(Exception):
pass
class XMLTokenizer:
def __init__(self, f):
self.f = f
self.nextch()
def curch(self):
return self.c
def getch(self):
c = self.c
self.nextch()
return c
def eof(self):
return self.c == ""
def nextch(self):
self.c = self.f.read(1)
if not self.c:
raise StopIteration
return self.c
def skip_ws(self):
while self.curch().isspace():
self.nextch()
def isident(self):
self.skip_ws()
return self.curch().isalpha()
def getident(self):
self.skip_ws()
ident = ""
while True:
c = self.curch()
if not(c.isalpha() or c.isdigit() or c in "_-."):
break
ident += self.getch()
return ident
def getnsident(self):
ns = ""
ident = self.getident()
if self.curch() == ":":
self.nextch()
ns = ident
ident = self.getident()
return (ns, ident)
def match(self, c):
self.skip_ws()
if self.curch() == c:
self.nextch()
return True
return False
def expect(self, c):
if not self.match(c):
raise XMLSyntaxError
def lex_attrs_till(self):
while self.isident():
attr = self.getnsident()
#yield (ATTR, attr)
self.expect("=")
self.expect('"')
val = ""
while self.curch() != '"':
val += self.getch()
#yield (ATTR_VAL, val)
self.expect('"')
yield (ATTR, attr, val)
def tokenize(self):
while not self.eof():
if self.match("<"):
if self.match("/"):
yield (END_TAG, self.getnsident())
self.expect(">")
elif self.match("?"):
yield (PI, self.getident())
for tok in self.lex_attrs_till():
yield tok
self.expect("?")
self.expect(">")
elif self.match("!"):
self.expect("-")
self.expect("-")
last3 = ''
while True:
last3 = last3[-2:] + self.getch()
if last3 == "-->":
break
else:
tag = self.getnsident()
yield (START_TAG, tag)
for tok in self.lex_attrs_till():
yield tok
if self.match("/"):
yield (END_TAG, tag)
self.expect(">")
else:
text = ""
while self.curch() != "<":
text += self.getch()
if text:
yield (TEXT, text)
def gfind(gen, pred):
for i in gen:
if pred(i):
return i
def text_of(gen, tag):
# Return text content of a leaf tag
def match_tag(t):
if t[0] != START_TAG:
return False
if isinstance(tag, ()):
return t[1] == tag
return t[1][1] == tag
gfind(gen, match_tag)
# Assumes no attributes
t, val = next(gen)
assert t == TEXT
return val
def tokenize(file):
return XMLTokenizer(file).tokenize()