Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
aaaddress1 committed Apr 19, 2015
0 parents commit 0b74d31
Show file tree
Hide file tree
Showing 7 changed files with 189 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Debug/
22 changes: 22 additions & 0 deletions WinHTTP-Hijacking/WinHTTP-Hijacking.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.30723.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WinHTTP-Hijacking", "WinHTTP-Hijacking\WinHTTP-Hijacking.csproj", "{25CC8D01-6140-427C-9E0E-3304014AE280}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{25CC8D01-6140-427C-9E0E-3304014AE280}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{25CC8D01-6140-427C-9E0E-3304014AE280}.Debug|Any CPU.Build.0 = Debug|Any CPU
{25CC8D01-6140-427C-9E0E-3304014AE280}.Release|Any CPU.ActiveCfg = Release|Any CPU
{25CC8D01-6140-427C-9E0E-3304014AE280}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added WinHTTP-Hijacking/WinHTTP-Hijacking.v12.suo
Binary file not shown.
73 changes: 73 additions & 0 deletions WinHTTP-Hijacking/WinHTTP-Hijacking/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;

namespace WinHTTP_Hijacking
{
class Program
{
static void Main(string[] args)
{
HttpListener listener = new HttpListener();
try
{
//NEED TO SET PROXY OF IE = 127.0.0.1:5278
//P.S. IT DOESN'T WORK ON HTTP WITH SSL.
listener.Prefixes.Add("http://*:5278/");
listener.Start();
Console.WriteLine("ADR's WinHTTP-Hijacking, By.aaaddress1.");
while (true)
{
System.Threading.ThreadPool.QueueUserWorkItem((CurrentContent) =>
{
HttpListenerRequest request = ((HttpListenerContext)CurrentContent).Request;
HttpListenerResponse response = ((HttpListenerContext)CurrentContent).Response;
HttpWebRequest Nrequest = (HttpWebRequest)WebRequest.Create(request.RawUrl);
Nrequest.Proxy = null;
MemoryStream memoryStream = new MemoryStream();
Console.WriteLine("catch request url = " +request.RawUrl);
Console.WriteLine(request.Headers["Accept"]);
Console.WriteLine();


Stream responseStream = Nrequest.GetResponse().GetResponseStream();
byte[] buffer = new byte[4096];
for (int count = -1; count != 0; )
{
count = responseStream.Read(buffer, 0, buffer.Length);
memoryStream.Write(buffer, 0, count);
}
byte[] result = memoryStream.ToArray();

if (request.Headers["Accept"].Contains("text"))
{
string CurrentHtmlSource = request.ContentEncoding.GetString(result);
if (CurrentHtmlSource.ToLower().Contains("google"))
{
result = request.ContentEncoding.GetBytes("I don't like google :(");
}
}

response.ContentLength64 = result.Length;
System.IO.Stream output = response.OutputStream;
output.Write(result, 0, result.Length);
output.Close();
}
, listener.GetContext());
}
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
finally
{
listener.Stop();
}
}

}
}
36 changes: 36 additions & 0 deletions WinHTTP-Hijacking/WinHTTP-Hijacking/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

// 組件的一般資訊是由下列的屬性集控制。
// 變更這些屬性的值即可修改組件的相關
// 資訊。
[assembly: AssemblyTitle("ConsoleApplication1")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ConsoleApplication1")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

// 將 ComVisible 設定為 false 會使得這個組件中的類型
// 對 COM 元件而言為不可見。如果您需要從 COM 存取這個組件中
// 的類型,請在該類型上將 ComVisible 屬性設定為 true。
[assembly: ComVisible(false)]

// 下列 GUID 為專案公開 (Expose) 至 COM 時所要使用的 typelib ID
[assembly: Guid("4de3531d-b38e-43cf-b940-24eb5b8d1c74")]

// 組件的版本資訊是由下列四項值構成:
//
// 主要版本
// 次要版本
// 組建編號
// 修訂編號
//
// 您可以指定所有的值,也可以依照以下的方式,使用 '*' 將組建和修訂編號
// 指定為預設值:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
54 changes: 54 additions & 0 deletions WinHTTP-Hijacking/WinHTTP-Hijacking/WinHTTP-Hijacking.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{25CC8D01-6140-427C-9E0E-3304014AE280}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WinHTTP</RootNamespace>
<AssemblyName>WinHTTP-Hijacking</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

0 comments on commit 0b74d31

Please sign in to comment.