Skip to content

Commit

Permalink
ps1 self elevate
Browse files Browse the repository at this point in the history
  • Loading branch information
yxnan authored Dec 3, 2023
1 parent 7d7de1f commit e0a7270
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

下列两种方法任选其一:

1. Release获取`BlockRpg.ps1`使用管理员权限执行即可
1. Release获取`BlockRpg.ps1`右键使用Powershell执行,如果有提示需要确认,输入R然后回车即可
2. Release获取`rpglist.json`,导入火绒或者其他类似能提供IP过滤名单的软件即可

### Linux
Expand Down
7 changes: 6 additions & 1 deletion build-rpglist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ iplist_ps1=$(cat rpglist.json | jq --raw-output '
')

echo '
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
exit
}
$rulename = "Block L4D2 RPG Servers"
$iplist = @("'"$iplist_ps1"'")
Expand All @@ -86,7 +91,7 @@ if ( Get-NetFirewallRule -DisplayName $rulename 2>$null ) {
-RemoteAddress $iplist
}
echo "Done."
echo "------------- Done. -------------"
' \
> BlockRpg.ps1

Expand Down

0 comments on commit e0a7270

Please sign in to comment.