VB.NET simple way to prevent .exe from accessing internet - vb.net

Is there a simple way to do this without having to programme a complete application level firewall or using Windows firewall?
I found this very interesting: Winsock Injector
It disables the use of Windows Sockets (winsock) for selected processes.
Can such an injector be done in VB.NET and does it work for everything?
I tried the injector but it doesnt seem to work for certain applications
Thanks

You could probably use Code Access Security to prevent this. The implementations for each .NET Framework versions vary, but there should be a way similar to this.
http://msdn.microsoft.com/en-us/library/4b7hy971%28v=vs.85%29.aspx
Here is the help doc for the WebBrowserPermission attribute.
http://msdn.microsoft.com/en-us/library/system.security.permissions.webbrowserpermission%28v=vs.85%29.aspx
Based on your edits, the above won't work.
You want to block the COMPUTER's access to the internet, not the application you are writing.
The easiest brute force method to block internet access in this case would be to disable the Network Connection itself. For an example how to do this, see this question.

Related

Selenium RemoteWebDriver and Windows Authentication Dialogs

I've seen this question has been asked a few times, and lots of solutions get suggested - but none of them seem to work for the RemoteWebDriver (ie: using Selenium Grid). They're usually centered around using the local ChromeDriver/FirefoxDriver/IEDriver classes.
I am using the .NET bindings, by the way :).
What I want to do is fairly simple (in terms of requirement). I have a Selenium Server setup, and am currently using the RemoteWebDriver to perform automated UI tests on various sites. This setup is working fine.
However, some sites use NTLM/Windows Authentication, and we need to start writing automated tests for these. However, as far as I can tell, there is no solution for this.
I have seen the following "solutions", but - unless someone can correct me - they either don't work consistently, or will not work using RemoteWebDriver:
Using the IAlert functionality (like here). However, this isn't implemented in the .NET bindings, and doesn't work for all browsers as far as I can tell.
Using the Robot API to interact with the popup (like here). But this is for running on your local machine, and not supported by RemoteWebDriver.
Using AutoIt to do a similar thing to the Robot API. However, this won't work using RemoteWebDriver.
Passing the credentials in the URL (eg: http://username:password#example.com). However, this doesn't work for Windows Authentication - just normal HTTP Basic Authentication.
I can't actually see any other solutions, unless anyone else can help?
A workaround currently is to log onto the Selenium server, go to the sites in each browser, and save the credentials. But this isn't ideal, and adds a level of manual interaction to each test.
Any help would be appreciated :).
It appears I have found my own solution - use a proxy which adds the NTLM negotiation/authorisation automatically. Pretty simple to setup :).
http://cntlm.sourceforge.net/

Registry Monitoring and Redirection Help (vb.net)

I'm learning in VB.NET. This is my first language.
I'm trying to build a launcher for an application with uncertain registry write location. I'm working on makeing the application portable. (app is based on low .NET framework for compatibility)
I looked for different methods like forcing registry virtualization or use registry virtualization through an api. (Thinking I can offload the writes if they're consolidated.)
I was also thinking that I could monitor the registry for any writes by a certain PID. I've also looked for an application that did this. Redirected any writes like sandboxie does. But with no luck.
So if I need to add more details tell me and thanks for the help.
You might check out a product like VMWare ThinApp or other Application virtualization tools, which will do this automatically for you with no need to write any code.
Maybe its just me, but this sounds like a very complicated thing you are trying to do in your first program.

How to change proxy settings while using Watin?

I am using Watin mostly to automate thing I do by hand. Sometimes, I need to change proxy. To do this, I have to set up IE to use a local proxy all the time (listens locally and forwards to a remote porxy), and then by hand change the settings of that program each time I need to use another proxy.
This is not an elegant solution! It may work, but it is not nice.
So, my question is, how do I change programmatically IE settings while using Watin? I code in VB.NET.
Thank you
try this
http://huddledmasses.org/setting-windows-internet-connection-proxy-from-c/

Browser Automation and Cross Site Scripting

I'm trying to write some web-based automation. The sites I'm hitting aren't on the same domain as my automation, so cross-site scripting issues make it impossible to access the DOM on the target website.
I don't want to use a proxy or deal with proxifying the target websites (like Selenium does, for example). Cross-platform is a nice to have, but isn't a must. I'll go Windows only if I'm forced to.
I realize I could simply write a Windows program that runs a WebBrowser control and my own set of scripts, but I don't want my users having to download an EXE from my webpage, or any registry overrides to disable cross-domain checking. It has to be extremely easy to use, no extra software downloads or anything.
I tried to write an ActiveX control which includes the MS WebBrowser control, so I could have a "browser-in-a-browser", so to speak. This didn't work. I ended up with winocc.cpp assertion failures.
What other options do I have? Would a Java applet work? I'd need a Java-based browser.. would I have to look at using JRex or Lobo?
There has just got to be a better way.
You could use a server-side language to obtain the external page using a screen scrape. I've done this using PHP and also in C#.NET, but you could use pretty much any server side language to make a web request that returns the whole chunk of HTML from the target page.
Once you have the HTML, you can do what you want with it, as it's just a string that you're going to manipulate in some way and then write on your page.

Registering every Windows login try

I want to keep a log with the attempted log-in to a machine. The OS is Windows Embbeded Standard. Is it possible to make Windows execute an application or a script after every login attempt to enable me to save that information in my database?
EDIT:
Extract from Superuser:
"Here, you can set auditing to all types of events. I believe the one you want is "Audit logon events", Set it to Failure (or Success as well if you want).
All events will now get sent to Event Viewer. ..."
Is it possible to access the Event Viewer info via WMI?
From a security viewpoint, I would assume this would not be possible. But it is possible to write your specialized GINA library which would replace the standard login system of Windows. This was done to support fingerprint readers and smart card readers, and many other alternative login methods.
But out of curiosity, what kind of problem are you trying to solve here? Windows already has plenty of build-in functionality which can be analysed by anyone who can log in.
Follow this link to see how it's done in Windows 2003. I've checked with Windows XP on a virtual machine and it works exactly the same there. So I assume it also works in embedded XP versions.For reading the event log, this link from MSDN will be practical too. This will require .NET though, which is optional on Windows XP.
WMI might be a good place to start. You could use WMI (or another method) to query the security event log for sucessful/failed logon events, too.
http://www.computerperformance.co.uk/vbscript/wmi_event_log_administrator.htm