Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
miladashrafi committed Dec 24, 2021
1 parent e2b3aa1 commit 8eb27a0
Show file tree
Hide file tree
Showing 12 changed files with 65 additions and 53 deletions.
5 changes: 0 additions & 5 deletions Batch/Shecan OFF.bat

This file was deleted.

5 changes: 0 additions & 5 deletions Batch/Shecan ON.bat

This file was deleted.

Binary file removed Icons/off.ico
Binary file not shown.
Binary file removed Icons/on.ico
Binary file not shown.
37 changes: 20 additions & 17 deletions Powershell/Shecan OFF.ps1
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
Get-DnsClientServerAddress -AddressFamily IPv4
Write-Host ""
Write-Host 'Enter Network Adapter Index Number From Above List' -ForegroundColor Yellow
$I = Read-Host -Prompt 'Interface Index'
Set-DnsClientServerAddress -InterfaceIndex $I -ResetServerAddresses
Write-Host "Network DNS RESET Successfully."


$inputFound = $false
Do {
$I = Read-Host -Prompt 'Interface Index'

If ($I -ne "" -and $I -ne $null) {
Set-DnsClientServerAddress -InterfaceIndex $I -ResetServerAddresses
Write-Host "Network DNS RESET Successfully."
$inputFound = $true
try{
Get-DnsClientServerAddress -AddressFamily IPv4
Write-Host ""
Write-Host 'Enter Network Adapter Index Number From Above List' -ForegroundColor Yellow
$inputFound = $false
Do {
$I = Read-Host -Prompt 'Interface Index'
If ($I -ne "" -and $I -ne $null) {
Set-DnsClientServerAddress -InterfaceIndex $I -ResetServerAddresses
Clear-Host
Write-Host "Network DNS RESET Successfully." -ForegroundColor Green
$inputFound = $true
}
}
While ($inputFound -eq $false)
}
catch{
Clear-Host
Write-Host "**** An error occurred:" -ForegroundColor Red
Write-Host $_ -ForegroundColor Red
Write-Host $_.ScriptStackTrace -ForegroundColor Red
}
While ($inputFound -eq $false)
57 changes: 33 additions & 24 deletions Powershell/Shecan ON.ps1
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
$WebResponse = Invoke-WebRequest "https://shecan.ir"
$DnsElementList = $WebResponse.AllElements | Where {$_.Class -eq "shecan-dns-ips"}
$DnsList = @()
for ($Index = 1; $Index -le 2; $Index++)
{
Write-Host $DnsElementList[$Index-1].innerText -ForegroundColor Red
$DnsList += '"' + $DnsElementList[$Index-1].innerText + '"'
}
$Value = '(' + ($DnsList -join ',') + ')'

Get-DnsClientServerAddress -AddressFamily IPv4
Write-Host ""
Write-Host $Value -ForegroundColor Red
Write-Host 'Enter Network Adapter Index Number From Above List' -ForegroundColor Yellow

$inputFound = $false
Do {
$I = Read-Host -Prompt 'Interface Index'

If ($I -ne "" -and $I -ne $null) {
Invoke-Expression "Set-DnsClientServerAddress -InterfaceIndex $I -ServerAddresses $Value"
Write-Host "Network DNS SET Successfully."
$inputFound = $true
try{
Get-DnsClientServerAddress -AddressFamily IPv4
Write-Host ""
Write-Host 'Enter Network Adapter Index Number From Above List' -ForegroundColor Yellow
$inputFound = $false
Do {
$I = Read-Host -Prompt 'Interface Index'
If ($I -ne "" -and $I -ne $null) {
Write-Host "Please wait ..."
Clear-Host
Write-Host "Getting DNS(s) from Shecan.ir ..." -ForegroundColor Gray
$WebResponse = Invoke-WebRequest "https://shecan.ir" -ForegroundColor Gray
$DnsElementList = $WebResponse.AllElements | Where {$_.Class -eq "shecan-dns-ips"}
$DnsList = @()
for ($Index = 1; $Index -le 2; $Index++)
{
Write-Host "DNS"$Index":" $DnsElementList[$Index-1].innerText -ForegroundColor Red
$DnsList += '"' + $DnsElementList[$Index-1].innerText + '"'
}
$Value = '(' + ($DnsList -join ',') + ')'
Invoke-Expression "Set-DnsClientServerAddress -InterfaceIndex $I -ServerAddresses $Value"
Clear-Host
Write-Host "Network DNS SET Successfully." -ForegroundColor Green
$inputFound = $true
}
}
While ($inputFound -eq $false)
}
While ($inputFound -eq $false)
catch{
Clear-Host
Write-Host "**** An error occurred:" -ForegroundColor Red
Write-Host $_ -ForegroundColor Red
Write-Host $_.ScriptStackTrace -ForegroundColor Red
}



2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

- This tool will needs internet to get original Shecan DNS IPs from website: https://shecan.ir

- Please run shortcuts or batch files as administrator.
- Please run batch files as administrator.



Expand Down
2 changes: 1 addition & 1 deletion Readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ A utility to automatically set/unset Shecan DNS(s).

This tool will needs internet to get original Shecan DNS IPs from website: https://shecan.ir

Please run shortcuts or batch files as administrator.
Please run batch files as administrator.
5 changes: 5 additions & 0 deletions Shecan OFF.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
cd /D %~dp0
cls
Powershell.exe -f "Powershell\Shecan OFF.ps1"
pause
Binary file removed Shecan OFF.lnk
Binary file not shown.
5 changes: 5 additions & 0 deletions Shecan ON.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@echo off
cd /D %~dp0
cls
Powershell.exe -f "Powershell\Shecan ON.ps1"
pause
Binary file removed Shecan ON.lnk
Binary file not shown.

0 comments on commit 8eb27a0

Please sign in to comment.