Committer: root <root@fruw.org>
This commit is contained in:
21
powershell/xlsx-ip/LICENSE
Normal file
21
powershell/xlsx-ip/LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 fruworg
|
||||
|
||||
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.
|
64
powershell/xlsx-ip/xlsx-ip.ps1
Normal file
64
powershell/xlsx-ip/xlsx-ip.ps1
Normal file
@ -0,0 +1,64 @@
|
||||
#Перед началом необходимо выполнить следующие команды:
|
||||
#Install-module PSExcel
|
||||
#Get-command -module psexcel
|
||||
clear
|
||||
Write-Host "
|
||||
.__ .__
|
||||
___ __| | _________ ___ |__|_____
|
||||
\ \/ / | / ___/\ \/ / ______ | \____ \
|
||||
> <| |__\___ \ > < /_____/ | | |_> >
|
||||
/__/\_ \____/____ >/__/\_ \ |__| __/
|
||||
\/ \/ \/ |__|
|
||||
"
|
||||
if ($Args.count -ne 0){
|
||||
$Value = $Args
|
||||
} else {
|
||||
$Value = Read-Host " Введите имена файлов"
|
||||
Write-Host ""
|
||||
$Value = $Value -split " "
|
||||
}
|
||||
|
||||
for ($i=0; $i -lt $Value.count; $i++){
|
||||
$Path = "$(pwd)\" + [string]$Value[$i] + ".xlsx"
|
||||
try{
|
||||
$File = Import-XLSX -Path $Path
|
||||
$Out = $File.IP -match "\d" -replace "ip address "
|
||||
$Out = $Out -replace " 255\.0\.0\.0", "/8"
|
||||
$Out = $Out -replace " 255\.128\.0\.0", "/9"
|
||||
$Out = $Out -replace " 255\.192\.0\.0", "/10"
|
||||
$Out = $Out -replace " 255\.224\.0\.0", "/11"
|
||||
$Out = $Out -replace " 255\.240\.0\.0", "/12"
|
||||
$Out = $Out -replace " 255\.248\.0\.0", "/13"
|
||||
$Out = $Out -replace " 255\.252\.0\.0", "/14"
|
||||
$Out = $Out -replace " 255\.254\.0\.0", "/15"
|
||||
$Out = $Out -replace " 255\.255\.0\.0", "/16"
|
||||
$Out = $Out -replace " 255\.255\.128", "/17"
|
||||
$Out = $Out -replace " 255\.255\.192\.0", "/18"
|
||||
$Out = $Out -replace " 255\.255\.224\.0", "/19"
|
||||
$Out = $Out -replace " 255\.255\.240\.0", "/20"
|
||||
$Out = $Out -replace " 255\.255\.252\.0", "/22"
|
||||
$Out = $Out -replace " 255\.255\.254\.0", "/23"
|
||||
$Out = $Out -replace " 255\.255\.255\.0", "/24"
|
||||
$Out = $Out -replace " 255\.255\.255\.128", "/25"
|
||||
$Out = $Out -replace " 255\.255\.255\.192", "/26"
|
||||
$Out = $Out -replace " 255\.255\.255\.224", "/27"
|
||||
$Out = $Out -replace " 255\.255\.255\.240", "/28"
|
||||
$Out = $Out -replace " 255\.255\.255\.248", "/29"
|
||||
$Out = $Out -replace " 255\.255\.255\.252", "/30"
|
||||
$Out | Out-File .\except.txt -Append -Encoding UTF8
|
||||
cat .\except.txt | select -Unique | sc .\except.txt
|
||||
$nerr = $nerr + " $Path
|
||||
"
|
||||
}
|
||||
catch{
|
||||
$err = $err + " $Path
|
||||
"}
|
||||
}
|
||||
if ($nerr -match "[A-z]"){
|
||||
Write-Host -ForegroundColor Gree " Файлы ниже обработаны:
|
||||
$nerr"}
|
||||
if ($err -match "[A-z]"){
|
||||
Write-Host -ForegroundColor Red " Файлы ниже не найдены:
|
||||
$err"
|
||||
}
|
||||
Read-Host -Prompt " Выполнено! Нажмите Enter"
|
Reference in New Issue
Block a user