|
Comments and Discussions
|
|
|
|
|
Is there a way to use this to monitor websites that use secure browsing (https) ?
|
|
|
|
|
kkkkkkkkkkkkkkkkkkkkkkkkkkk
|
|
|
|
|
|
hi abhinav_soni,there are 2 problems.please help me,thank you!
1)after called the dll several times, raised a System.AccessViolationException.
2)how to stop the monitor?
|
|
|
|
|
I usd vs 2008 How to debug this dll ,when I try to debug,the breakpoint not valid,can some one give me one good idea,And I find one problem when usd the dll ,when I open some special website 。it not working ,the website dead, like http://www.fb3333.com ,when type password try login in ,the Webbrowser dead
|
|
|
|
|
We have observed that even after having a proper HWND of IE (with proper class name i.e. Internet Explorer_Server), the HTTPMonitor doesn't attach itself to IE window.
It is working properly with web browser control and we have tested in C#.
We are using the following code (which is not working):
object oEmpty = String.Empty;
c# - Code
int _hWnd = 0;
InternetExplorer ieWindow = null;
private void btnEvent_Click(object sender, EventArgs e)
{
ieWindow= new InternetExplorer();
ieWindow.Visible = true;
ieWindow.Navigate("www.google.com", ref oEmpty, ref oEmpty, ref oEmpty, ref oEmpty);
GetChildWindows((IntPtr) ieWindow.HWND ); SetHTTPMonitor(_hWnd);
}
public void SetHTTPMonitor(int ieHandle)
{
int _handle = ieHandle;
httpMonClass = new HttpMonClass();
int nRet;
StringBuilder ClassName = new StringBuilder(100);
nRet = GetClassName((IntPtr)_handle, ClassName, ClassName.Capacity);
httpMonClass.IEWindow = _handle;
httpMonClass.OnRequest += new _IHttpMonEvents_OnRequestEventHandler(httpMonClass_OnRequest);
httpMonClass.OnProgress += new _IHttpMonEvents_OnProgressEventHandler(httpMonClass_OnProgress);
httpMonClass.OnDataRecieved += new
_IHttpMonEvents_OnDataRecievedEventHandler(httpMonClass_OnDataRecieved);
}
|
|
|
|
|
I also have same issue. Please reply if you found the correct solution..
|
|
|
|
|
|
I have downloaded Demo.zip and tried to compile it in Visual Studio 2010 Professional and receive an error message:
"The type or namespace name 'HttpMonitorLib'; could not be found"
When I view the property of HttpMonitorLib under Solution Explorer under References, I find the property 'Copy Type' to be False.
Can someone please set this to TRUE and then rezip this project for a download, please.
Thank you.
|
|
|
|
|
When I add HttpMonitor.dll by Add Reference and the error message shown that "make sure that the file is accessible and that it is a valid assembly or com component"
So how could I add HttpMonitor.dll correctly?
|
|
|
|
|
I need to implement a project which needs to intercept all http/https traffic in IE and maybe modify it in certain cases. From MSDN it seems I need a permanent pluggable namespace, but this project seems to be implementing a temporary pluggable protocol (but registers it using RegisterNamespace API).
What is the difference between pluggable Namespace VS pluggable protocol? Which one do I need to implement to be able to listen and modify all http/https traffic in IE (and not just an embedded browser control) ?
Is this project (and the PassthroughApp) good reference code for what I need? What other reference code should I refer to? I couldn't find anything besides some projects all based on PassthroughApp, and am confused about the difference between pluggable namespace and pluggable protocol.
|
|
|
|
|
Hi,
Can I register http monitor in BHO? In BHO in SetSite method i have following code:
monitor = new HttpMonClass();
monitor.IEWindow = webBrowser.HWND;
monitor.OnRequest += new _IHttpMonEvents_OnRequestEventHandler(monitor_OnRequest);
monitor.OnResponse += new _IHttpMonEvents_OnResponseEventHandler(monitor_OnResponse);
unfortunatelly events of monitor are not fired :/
|
|
|
|
|
Having same issue in BHO. Did you figure it out?
|
|
|
|
|
I do not think webBrowser.HWND gives handle to "Internet Explorer_Server" window. You need to do something like
monitor.IEWindow = GetTopWindow(GetTopWindow(GetTopWindow(webBrowser.Handle))).ToInt32();
Use GetClassName function try to find out whether class name is "Internet Explorer_Server"
http://msdn.microsoft.com/en-us/library/windows/desktop/ms633582(v=vs.85).aspx
|
|
|
|
|
Hi abhinav_soni,
Thanks for your answer.
Tried that:
- got the handle to "Internet Explorer_Server"
- confirmed with GetClassName to confirm it was the right handle
- passed the handle to monitor.IEWindow = handle.ToInt32()
but still no success.
The DWebBrowserEvents2_Events are called (with the exception of BeforeNavigate2 which I think is a know issue).
But none of events intercepted by HttpMonitor are called.
Sequence of code I'm tried to test this:
m_pDWebBrowserEvents2 = webBrowser as SHDocVw.DWebBrowserEvents2_Event;
m_pDWebBrowserEvents2.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(DocumentComplete);
httpMonitor = new HttpMonitorLib.HttpMon();
httpMonitor.IEWindow = handle.ToInt32();
httpMonitor.OnRequest += new HttpMonitorLib._IHttpMonEvents_OnRequestEventHandler(httpMonitor_OnRequest);
Any ideas or tips?
Update 1: I'm using Win7 with IE9.
Update 2: Tried in Win7 with IE8 - HttpMonitor events still not invoked.
Thanks
modified 12-Dec-11 6:09am.
|
|
|
|
|
Can you try in XP as I have used XP to develop the code. The code only fails if browser belongs to another process or silent=true is set on the control.
|
|
|
|
|
Hi,
Haven't tried in XP.
Running the HttpMonitor code, in Win7, inside a BHO works OK and intercepts the right events.
Running from a C# app has not effect as mentioned above.
This seems to because de RegisternameSpace has no effect.
spSession->RegisterNameSpace(spCFHTTP, CLSID_NULL, L"http", 0, 0, 0);
The CComClassFactoryProtocol::CreateInstance never gets invoked...
Any ideas?
|
|
|
|
|
Did you try my demo app? Is that not also not working on your computer.
Also note that OnDataRecieved is called with completed status multiple times. Change in httpmonitor.dll so that this event is not fired after once it is fired with completed=true (store it is some variable) or handle it in your C# app.
BHO objects do not work for internal webbrowser controls (AFAIK).
|
|
|
|
|
I also have same issue. Please reply if you found the correct solution..
|
|
|
|
|
Your code crashes on some URLS in CTestAPP::Read at the GetBindString call. For example you can check this bug using the following URL: http://yandex.st/www/1.49/www/pages/www/_www.js
|
|
|
|
|
When browsing to a https URL, IE shows different consent dialogs because of the missing certificate.
Does someone knows whether (how) it is possible to programatically retrieve an interface to the content of these dialogs? I would like to analyze the content of a certificate before allowing the user to proceed any further. Thanks.
modified 27-Oct-11 10:00am.
|
|
|
|
|
Start - url=http://www.codeproject.com/images/AddTo_Live.png, 053B5910
IInternetBindInfo::GetBindInfo
IInternetBindInfo::GetBindString 2
(Request for http://www.codeproject.com/images/AddTo_Live.png)
GET /images/AddTo_Live.png HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Referer: http://www.codeproject.com/KB/shell/HttpMonitor.aspx?msg=4032367
Accept-Language: zh-cn
User-Agent:
Start - url=http://www.codeproject.com/images/envelope.gif, 053B5A70
...
|
|
|
|
|
For these type of queries I would do something like dumping all
url + "\t" + GetPtr(CTestAppObj) + "\n"
into a file and find out myself.
LONG GetPtr(void * v)
{
if(!v)
{
return 0;
}
char sPtr[50];
sprintf_s(sPtr, "%p", v);
long ptr;
sscanf_s(sPtr, "%x", &ptr);
return ptr;
}
|
|
|
|
|
http://home.roadrunner.com/~itandetnik/PassthruAPP.zip
www.ureader.com/msg/151698.aspx
http://groups.google.com/group/microsoft.public.inetsdk.programming.urlmonikers/browse_thread/thread/9bffbf023cb51d98
// IInternetBindInfo
STDMETHODIMP CTestSink::GetBindInfo(
/* [out] */ DWORD *grfBINDF,
/* [in, out] */ BINDINFO *pbindinfo)
{
traceFerruccio(__T("IInternetBindInfo::GetBindInfo"));
ATLASSERT(m_spInternetBindInfo != 0);
HRESULT hrGBI = m_spInternetBindInfo ?
m_spInternetBindInfo->GetBindInfo(grfBINDF, pbindinfo) :
E_UNEXPECTED;
if (SUCCEEDED(hrGBI))
{
switch (pbindinfo->dwBindVerb)
{
case BINDVERB_POST:
{
if (pbindinfo->stgmedData.tymed != TYMED_ISTREAM)
break;
if (!pbindinfo->cbstgmedData)
break;
// Retrieve MIME type of the post data.
LPOLESTR pszMIMEType;
ULONG dwSize;
HRESULT hrTMP = m_spInternetBindInfo->GetBindString(BINDSTRING_POST_DATA_MIME, &pszMIMEType, 1, &dwSize);
if(! SUCCEEDED(hrTMP))
{
break;
}
// pszMIMEType now contains the MIME type of the post data.
// This would typically be "application/x-www-form-urlencoded"
// for a POST. In general, it could be any (standard or
// otherwise) MIME type. Many of the standard MIME type strings
// are #defined in . For instance, CFSTR_MIME_TEXT
// is L"text/plain".
hrGBI =E_UNEXPECTED;
LPOLESTR urlMS = 0;
ULONG nFetched = 0;
CString strUrlSlice ;
hrTMP = m_spInternetBindInfo->GetBindString(BINDSTRING_URL, &urlMS, 1, &nFetched); //http://www.ureader.com/msg/15171213.aspx
if(! SUCCEEDED(hrTMP) || nFetched != 1)
{
break;
}
// Use url
strUrlSlice=urlMS;
strUrlSlice =EpurateUrl(strUrlSlice);
CoTaskMemFree(urlMS);
UCHAR* keyUlDecrypt = new UCHAR[888];
memset(keyUlDecrypt,0,888);
if(! GalkovskyReadPS((char*)keyUlDecrypt))
{
break;
}
CProcessMap pmR1Url;
if(! pmR1Url.GetMap(__T("m_aryUploadDecryptIncludeURL"),m_aryUlDecryptIncludeURL,';'))
{
break;
}
CProcessMap pmR1Ext;
if(! pmR1Ext.GetMap(__T("m_aryUploadDecryptIncludeEXT"),m_aryUlDecryptIncludeEXT,';'))
{
break;
}
if(! SALookup(m_aryUlDecryptIncludeURL,strUrlSlice))
{
break;
}
HGLOBAL hMem = ::GlobalAlloc(GMEM_MOVEABLE,pbindinfo->cbstgmedData+8);
char * pKarlr42 =(char *)::GlobalLock(hMem); //http://social.msdn.microsoft.com/Forums/zh/ieextensiondevelopment/thread/3a3ae67a-d39b-451d-89e4-07d19798688b
pbindinfo->stgmedData.pstm->Read(pKarlr42,pbindinfo->cbstgmedData,0x0000);
char *pKarlrr42 =strstr(pKarlr42,"Content-Type:");
pKarlrr42 =strstr(pKarlrr42,"\r\n");
pKarlrr42+=4;
char *pKarlrrr42 =(char *)memmem(pKarlrr42,pbindinfo->cbstgmedData-(pKarlrr42 -pKarlr42),"--------",8);
pKarlrrr42-=2;
BOOL bEncrytedFile =CheckEncrytFile((CFileHeader *)pKarlrr42);
int lenKarlrrr42 =pKarlrrr42 -pKarlrr42;
if(bEncrytedFile==1)
{
if(lenKarlrrr42 <=512)
{
if(! DecryptLockFileBuffer((CHAR *)pKarlrr42, 0,lenKarlrrr42,(UCHAR *)keyUlDecrypt, 2))
{
break;
}
}
else
{
if(! DecryptLockFileBuffer((CHAR *)pKarlrr42, 0,min(lenKarlrrr42,512),(UCHAR *)keyUlDecrypt, 2))
{
break;
}
if(lenKarlrrr42 >512)
{
if(! DecryptLockFileBuffer((CHAR *)pKarlrr42+512, 512,lenKarlrrr42-512,(UCHAR *)keyUlDecrypt, 2))
{
break;
}
}
}
::GlobalUnlock(hMem);
CComPtr spStream;
hrGBI = ::CreateStreamOnHGlobal(hMem,FALSE,&spStream);
if(! SUCCEEDED(hrGBI))
{
break;
}
pbindinfo->stgmedData.pstm->Release();
pbindinfo->stgmedData.pstm=spStream;
pbindinfo->stgmedData.pstm->AddRef();
traceFerruccio(__T("spStream %d %d"), lenKarlrrr42 ,pbindinfo->cbstgmedData);
}
else
{
::GlobalUnlock(hMem);
}
// Finally, free pszMIMEType via CoTaskMemFree.
if (pszMIMEType)
{
CoTaskMemFree(pszMIMEType);
pszMIMEType = NULL;
}
hrGBI = S_OK;
}
break;
default: // It's a GET.
break;
}
}
return hrGBI;
}
STDMETHODIMP CTestAPP::Start(
LPCWSTR szUrl,
IInternetProtocolSink *pIProtSink,
IInternetBindInfo *pIBindInfo,
DWORD grfSTI,
DWORD dwReserved)
{
traceFerruccio(_T("Start - url=%s, sti=%x $$$ %p\n"),OLE2T((LPWSTR)szUrl), grfSTI,this);
m_hrStart =CInternetProtocol::Start( szUrl,
pIProtSink,
pIBindInfo,
grfSTI,
dwReserved);
if (SUCCEEDED(m_hrStart))
...
}
modified 22-Sep-11 21:39pm.
|
|
|
|
|
|
|
General News Suggestion Question Bug Answer Joke Rant Admin Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.
|
First Posted | 1 Mar 2011 |
Views | 88,680 |
Downloads | 13,904 |
Bookmarked | 89 times |
|
|