Acrylic Proxy DNS Setup

|

While still configuring my changes to Raspberry Pi Setup Proxy Server this works on an individual computer.

NOTE: I have this setup mainly for the Wi-Fi, if you want it for wired connections you will need to change Wi-Fi to “Ethernet” or “Ethernet 2”

Step 1: Download and Setup Acrylic

clear

# URL Parameter
$WebURL = "http://www.kittell.net/downloads/Acrylic.exe"

# Directory Parameter
$FileDirectory = "$($env:USERPROFILE)$("\downloads\")"

# If directory doesn't exist create the directory
if((Test-Path $FileDirectory) -eq 0)
    {
        mkdir $FileDirectory;
        cd $FileDirectory;
    }

# We assume the file you download is named what you want it to be on your computer
$FileName = [System.IO.Path]::GetFileName($WebURL)

# Concatenate the two values to prepare the download
$FullFilePath = "$($FileDirectory)$($FileName)"

# Give a basic message to the user to let them know what we are doing
Write-Host "Downloading '$WebURL' to '$FullFilePath'"

    $uri = New-Object "System.Uri" "$WebURL" 
    $request = [System.Net.HttpWebRequest]::Create($uri) 
    $request.set_Timeout(15000) #15 second timeout 
    $response = $request.GetResponse() 
    $totalLength = [System.Math]::Floor($response.get_ContentLength()/1024) 
    $responseStream = $response.GetResponseStream() 
    $targetStream = New-Object -TypeName System.IO.FileStream -ArgumentList $FullFilePath, Create 
    $buffer = new-object byte[] 10KB 
    $count = $responseStream.Read($buffer,0,$buffer.length) 
    $downloadedBytes = $count 
    while ($count -gt 0) 
    {         
        [System.Console]::Write("`r`nDownloaded {0}K of {1}K", [System.Math]::Floor($downloadedBytes/1024), $totalLength) 
        $targetStream.Write($buffer, 0, $count) 
        $count = $responseStream.Read($buffer,0,$buffer.length) 
        $downloadedBytes = $downloadedBytes + $count 
    } 
  
    $targetStream.Flush()
    $targetStream.Close() 
    $targetStream.Dispose() 
    $responseStream.Dispose() 


# Give a basic message to the user to let them know we are done
Write-Host "`r`nDownload complete"

start-process $FullFilePath -wait

cat 'C:\Program Files (x86)\Acrylic DNS Proxy\AcrylicConfiguration.ini' | %{$_ -replace "PrimaryServerAddress=8.8.8.8","PrimaryServerAddress=208.67.222.123"}
cat 'C:\Program Files (x86)\Acrylic DNS Proxy\AcrylicConfiguration.ini' | %{$_ -replace "SecondaryServerAddress=8.8.4.4","SecondaryServerAddress=208.67.220.123"}

ipconfig /flushdns

& "C:\Program Files (x86)\Acrylic DNS Proxy\AcrylicController.exe" PurgeAcrylicCacheDataSilently

Set-DNSClientServerAddress –interfaceAlias Wi-Fi –ServerAddresses ("127.0.0.1")
Get-DnsClientServerAddress -InterfaceAlias Wi-Fi

Acrylic was created and is maintained at http://mayakron.altervista.org, made available to anyone under the GNU General Public License

All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.