diff --git a/Nettify/assets/IspInfo/getispinfo.ps1 b/Nettify/assets/IspInfo/getispinfo.ps1 index 4f2ec90..7a18e1b 100644 --- a/Nettify/assets/IspInfo/getispinfo.ps1 +++ b/Nettify/assets/IspInfo/getispinfo.ps1 @@ -3,6 +3,7 @@ Set-Variable DATABASEADDRESS "https://autoconfig.thunderbird.net/v1.1/" Write-Output "Downloading the ISP list..." Set-Variable ISPS ((Invoke-WebRequest -Uri $DATABASEADDRESS).links.href | Select-Object -Skip 5) +if (Test-Path "$PSScriptRoot\isps.txt") { Remove-Item -Path "$PSScriptRoot\isps.txt" } $ISPS | ForEach-Object -Process { Set-Variable XMLFILE "$PSScriptRoot\$_.xml" @@ -11,6 +12,5 @@ $ISPS | ForEach-Object -Process { $a = Get-Content $XMLFILE $b = '' Set-Content $XMLFILE -value $b,$a - if (Test-Path "$PSScriptRoot\isps.txt") { Remove-Item -Path "$PSScriptRoot\isps.txt" } Write-Output "$_" >> "$PSScriptRoot\isps.txt" } diff --git a/Nettify/assets/IspInfo/getispinfo.sh b/Nettify/assets/IspInfo/getispinfo.sh index 23c9191..62f94d9 100644 --- a/Nettify/assets/IspInfo/getispinfo.sh +++ b/Nettify/assets/IspInfo/getispinfo.sh @@ -21,6 +21,7 @@ readarray -t ISPS < <(cat $DBFILE | grep -oP 'href=".+?"' | tail -n +6 | cut -b # Form URLs and download their information one by one here ISPCOUNT=${#ISPS[@]} +rm -f $ROOT/isps.txt for ISPIDX in "${!ISPS[@]}" do ISP=${ISPS[ISPIDX]} @@ -41,7 +42,6 @@ do sed -i '1 i\' $OUTPUTFILE # Write ISP name to file - rm -f $ROOT/isps.txt printf "${ISP}\n" >> $ROOT/isps.txt done