Last active
April 15, 2024 03:27
-
-
Save ParticleG/11483dd3504043f387c614c0980fff67 to your computer and use it in GitHub Desktop.
H3C Firewall Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
::----------------RequestAdmin---------------- | |
::Check for permissions | |
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system" | |
::If error flag set, we do not have admin. | |
if "%errorlevel%" NEQ "0" ( | |
echo "Requesting administrative privileges..." | |
goto RequestAdmin_UACPrompt | |
) else ( goto RequestAdmin_isAdmin ) | |
:RequestAdmin_UACPrompt | |
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs" | |
set params= %* | |
IF "%~1" == "" ( | |
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs" | |
) else ( | |
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 0 >> "%temp%\getadmin.vbs" | |
) | |
"%temp%\getadmin.vbs" | |
del "%temp%\getadmin.vbs" | |
exit /B | |
:RequestAdmin_isAdmin | |
pushd "%CD%" | |
CD /D "%~dp0" | |
::----------------RequestAdmin---------------- | |
::----------------SetActionType---------------- | |
:SetActionType | |
IF "%~1" == "" ( | |
SET /p ACTION_TYPE="Enter your action type (ADD / DELETE):" | |
) else ( | |
SET ACTION_TYPE=%1 | |
) | |
if "%ACTION_TYPE%"=="ADD" ( | |
echo Adding routes... | |
) else if "%ACTION_TYPE%"=="DELETE" ( | |
echo Deleting routes... | |
) else if "%~1" == "" ( | |
echo Invalid action type! Please try again. | |
goto SetActionType | |
) else ( | |
exit /B | |
) | |
::----------------SetActionType---------------- | |
SET MASK_32=255.255.255.255 | |
SET MASK_24=255.255.255.0 | |
SET TARGET_IP=192.168.2.250 | |
SET CloudMusicList= ^ | |
"42.186.111.84 %MASK_32%" ^ | |
"42.186.120.205 %MASK_32%" ^ | |
"59.111.179.214 %MASK_32%" ^ | |
"59.111.181.35 %MASK_32%" ^ | |
"61.153.154.214 %MASK_32%" ^ | |
"115.223.9.0 %MASK_24%" ^ | |
"115.231.170.0 %MASK_24%" ^ | |
"115.236.121.0 %MASK_24%" ^ | |
"115.238.119.0 %MASK_24%" ^ | |
"122.228.234.0 %MASK_24%" ^ | |
"125.124.252.115 %MASK_32%" ^ | |
"183.136.182.0 %MASK_24%" ^ | |
"222.73.33.0 %MASK_24%" | |
SET GithubList= ^ | |
"140.82.114.22 %MASK_32%" | |
SET MicrosoftList= ^ | |
"222.186.57.69 %MASK_32%" | |
SET QQNTList= ^ | |
"36.155.236.165 %MASK_32%" ^ | |
"36.249.92.52 %MASK_32%" ^ | |
"42.81.184.82 %MASK_32%" ^ | |
"42.81.193.250 %MASK_32%" ^ | |
"49.86.42.91 %MASK_32%" ^ | |
"101.69.99.85 %MASK_32%" ^ | |
"101.89.41.249 %MASK_32%" ^ | |
"101.91.17.0 %MASK_24%" ^ | |
"101.91.21.160 %MASK_32%" ^ | |
"101.226.144.104 %MASK_32%" ^ | |
"106.39.206.82 %MASK_32%" ^ | |
"111.3.90.195 %MASK_32%" ^ | |
"112.65.194.165 %MASK_32%" ^ | |
"113.240.74.35 %MASK_32%" ^ | |
"113.240.76.0 %MASK_24%" ^ | |
"113.250.23.16 %MASK_32%" ^ | |
"115.238.202.102 %MASK_32%" ^ | |
"116.31.99.0 %MASK_24%" ^ | |
"117.89.177.187 %MASK_32%" ^ | |
"120.232.31.239 %MASK_32%" ^ | |
"121.14.193.44 %MASK_32%" ^ | |
"121.229.94.0 %MASK_24%" ^ | |
"122.193.7.205 %MASK_32%" ^ | |
"140.82.114.22 %MASK_32%" ^ | |
"140.206.161.106 %MASK_32%" ^ | |
"153.37.100.201 %MASK_32%" ^ | |
"157.148.63.107 %MASK_32%" ^ | |
"157.255.5.249 %MASK_32%" ^ | |
"175.6.87.228 %MASK_32%" ^ | |
"180.101.241.0 %MASK_24%" ^ | |
"180.101.246.0 %MASK_24%" ^ | |
"180.102.58.231 %MASK_32%" ^ | |
"180.109.192.140 %MASK_32%" ^ | |
"180.110.193.191 %MASK_32%" ^ | |
"182.50.8.156 %MASK_32%" ^ | |
"183.47.102.193 %MASK_32%" ^ | |
"183.60.225.0 %MASK_24%" ^ | |
"183.60.230.0 %MASK_24%" ^ | |
"183.204.14.13 %MASK_32%" ^ | |
"220.194.118.230 %MASK_32%" ^ | |
"222.94.109.0 %MASK_24%" | |
SET UnknownList= ^ | |
"20.44.10.122 %MASK_32%" | |
for %%a in (%CloudMusicList% %QQNTList%) do ( | |
for /f "tokens=1,2 delims= " %%i in (%%a) do ( | |
if "%ACTION_TYPE%"=="ADD" ( | |
ROUTE %ACTION_TYPE% %%i MASK %%j %TARGET_IP% | |
) else ( | |
ROUTE %ACTION_TYPE% %%i MASK %%j | |
) | |
) | |
) | |
IF "%~1" == "" ( | |
pause | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment