I want to control internet connection programmatically, (I use Visual Studio .net (C#)). I want to process all the requests that are sent to the internet.
For example, if a user on any browser type "google.com", I want to get this request before it's sent to the internet.
Simply, it's a process that Windows uses to send and retrieve data from a communication port, please do any one have a simple article that explain this process, also does any one have an idea how to control the data flow on communication ports using dot net.
You may want to check out how Fiddler, a transparent proxy that automatically adds itself to the WININET chain so that it can see every request being made, works.
According to this MSDN article:
...the program registers itself as the
system proxy for Microsoft Windows
Internet Services (WinInet), the HTTP
layer used by Internet Explorer,
Microsoft Office, and many other
products.
Additionally, take a look at the answers to this question - How to create a simple Proxy in C#.
Related
I want to get information from a web socket running on a website. however since I am not aware of handshaking process I am unable to establish a successful connection to the websocket and retrieve the information being published on the websocket. I assume this falls on the website confidentiality and unless they provide me the documents it is highly unlikely I can get the data directly from the websocket (please correct me if I am wrong).
However since I can view the data from "WS" tab in network section of the chrome (developer mode). I was wondering if there is a way to replicate this programmatically using selenium or any headless browser and I get this information inside my program. my main objective is to get the information using C# however I am open to any other way to get this data.
This is the sample picture of a WS
I have also found this extension "chrome.devtools.network" but I am not sure if it can do the thing I want. I am still searching any advice or help is highly appreciated
With new versions of Selenium webdrive (version 4 - It's beta version) you can create a devtool session of the driver
driver.getDevTools().createSession();
With wich you can send any devtool commands. You should create a web socket event and send the request through it. You can refer this link for Network Domain Chrome DevTools Protocol.
Also, you can use logging preferences properties and intercept performance logs to fetch messages sent and received through websocket.
driver.manage().logs().get(LogType.PERFORMANCE);
I tried the last solution using Java ang get this result for requesting this link
Complete source code is provided here
Note that you should wait until the chrome driver quit. Then in console you'll see the sent and received messages
I know I can use Remote Desktop ActiveX control, but I am trying to implement solution browser based solution just like browserstack.com etc, they have implemented same by using Flash which connects to their server which in turn might be rdp gateway.
I have looked at library Cassia, https://code.google.com/p/cassia/source/browse/trunk/Samples/SessionInfo/Source/SessionInfo/Program.cs, but I am not able to understand how to actually grab the screen and send input after we call WTSStartRemoteControlSession method.
I want to call these methods from an ASP.NET MVC Web Application, which basically stores scripts for automated UI testing. Most of the time, no body will be keeping any UI open, our test server will automatically create RDP session, run everything and then email results.
Only for recording tests, programmers will use Web UI which will communicate with server purely through web sockets and download images of screen. Using ActiveX control is not possible as we use UI Automation to capture text/UI element information etc.
Yeah, Cassia and the WTS API won't help you much here, since they're more for administering servers than interacting with individual sessions.
You could try an HTML5 RDP client like Guacamole. It has a JavaScript client API that allows you to send key and mouse events.
As an alternative, very comparable to Guacamole, you can try Myrtille, also open source and using FreeRDP as rdp client through an HTTP gateway. The main difference is it's done in .NET (C#) and thus is more intended for Windows Servers.
I want creating a online file transfer app. I would like the user to drag-drop an item into the file transfer application to initiate the file transfer just like skype or other messengers. can anyone give me good links or sample code for this
One of the most complex part in the "peer-to-peer" data transfer is session initiation, since user can be hidden behind NAT, firewall or proxy server. You probably should take a look at SIP protocol for session initialization - it is used in many VoIP services. Some time ago I found this SIP tutorial rather descriptive, but there are many other docs.
Also, probably it would be useful to take a look at XMPP protocol (GTalk is implemented with this protocol), there is file transfer extension.
MSRP (Message Session Relay Protocol) is designed to send messages and files. It is used by
SIMPLE messaging systems. If might be worthwhile investigating.
Konnetic are the only provider of MSRP .NET solutions I know of.
I'm working with asp.net MVC. Now I don't know how to send data form a server (using asp.net ) to another server using (win32 console command line). Plz help me.
P/S: Is there any security hole in this method.
Well generally the case is that most ports today are blocked behind firewalls so setting something like that up with winsock, is outdated. If you are tring to connect two servers there are many options, You could look into the System.Web.WebClient,System.Net.HttpWebRequest,Microsoft's Sync Framework, Rhino queues but heres the run down on the first two.
In short, HttpWebRequest gives you more fine grained control over your
request. WebClient does not. It encapsulates most of the stuff for you.
WebClient is very useful if you want to do specialized, one-off tasks, eg:
download file, do forms post etc.
HttpWebRequest is useful if you want to do more complicated stuff.
The WebClient is especically simplified, we can use it's DownloadData,
DownLoadFile to retreive file/stream from remote webserver. Here are some
tech articles and resources describing using webclient or webrequest:
Hosting WCF services, WebClient
here
and webrequest here.
You have two servers trying to communicate. If you are going to use IP (I am assuming you will since you mentioned Winsock) you must choose between these two protocols:
TCP
UDP
Once you've decided which one to use, you can write a server process (the console application) that listen to a specific port (TCP or UDP port depending on what you've chosen) that will serve your client process (the ASP.NET application).
If you use TCP/IP, you use sockets to communicate. If you use UDP/IP, you will send and receive independent packets.
Here is a TCP/IP client/server code sample in C# you can use. You will wrap and run the client portion of this example is a class you can access within ASP.NET MVC.
Here is a UDP/IP server code sample in C#.
Regarding your question of the security of this approach, the question does not provide enough information to answer it properly. You will need to provide more information.
I would like to track messages sent and received though Windows Live Messenger. I would then like to collate these messages into a database (not in the scope of this question).
The question is how and where should I track these messages. The simplest way it to force all clients to keep history files and read those, but it is not really the solution that I am looking for. Is there a way to track them from a server running in the same domain, I have read a little into Windows Communicator, I have also seen a lot of people chat about http://dev.live.com/messenger/ but I was hoping that someone may have addressed this problem already :)
I would like to do this using C# .NET 3.5
Check out MSNPSharp. Its a .NET msn library. Its very powerful and allows you to sign in from multiple locations. So you can sign in and listen to other conversations happening on a given account.
Its very straight forward to use. Download the full source code, there's a sample application that demonstrates its use in full detail.
http://code.google.com/p/msnp-sharp/
Here is two idea that might work.
The first one is the easiest but can be easily avoided by the user if he doesn't want to be logged. It would be to use MSN Plus over the MSN. With MSN Plus you have an API that let you get all messages from any Chat Windows... and a lot more. Of course, if the user is not you, the user can simply uninstall Msn Plus and your program will not log any data.
The second idea is better if you have a network that you require to check all Msn Conversation. If you use WireShark you can see that conversation are not crypted (well the last time I did it) and you can check the port and protocol to simply get the data from the network.
Hope it gives you a way to what you need.
Just two ideas
1. First the standard MSN protocol is plain text (from what I understand) so you could intercept the messages on the firewall and then put them in the DB and do the correlation there.
2. If this is in an organisation you could use Office Communicator which is the "corporate" version of MSN and has that functionality built in already. You can then just go in via their SDK and get the correlated data.
I managed to find two ways of doing this, though both are not really programmatic solutions, so may not appeal to this audience.
Make use of a Jabber gateway to set up forwards between your jabber client and the other IM networks. Traffic flows between your jabber enabled client and the jabber server via the jabber server. The Jabber server then translates this to the destination networks protocol and forwards the message. Likewise messages from the external IM networks are routed and translated by the Jabber server. An example of this is PSI <-> IceWarp Merak <-> MSN
Make use of Symantec IM Manager to intercept messages from the messaging clients on your network. You will need to either use host files or local DNS rules to convince the your local PCs that Messenger.hotmail.com is actually located at 192.168.0.59 and not at Microsoft.
Hope it helps other people that may want to do the same.