|
-
Apr 19th, 2009, 05:17 AM
#1
Thread Starter
Junior Member
[RESOLVED] Disabling a program?
Hello, i did a program on VB 2008 Express Edition but id like to add a feature.
Id like that my program could be only accessed if you had an internet conection and if i allowed it. Id like to disable my program whenever I like for the ones who have it cant use it if i dont enable it
Is there any way i can do this?
-
Apr 19th, 2009, 05:28 AM
#2
Re: Disabling a program?
Yes but I assume you actually mean something a lot more sophisticated than checking whether someone has an internet connection?
Presumably you want something that authenticates the user to make sure its someone who is entitled/allowed to use the program, in which case you will need some kind of web service or web site to do some of the work.
Is that the kind of thing you mean?
-
Apr 19th, 2009, 05:34 AM
#3
Thread Starter
Junior Member
Re: Disabling a program?
Kind of, basicly i want to be able to disable my program if its being dangerous (The program has buttons for shutting down school computers)
-
Apr 19th, 2009, 07:33 AM
#4
Re: Disabling a program?
If you are talking about real-time monitoring of what users are doing on your program that would be difficult to achieve without a lot of effort and you may be better off looking for a 3rd party application that would let you view the user's screen and take control if necessary.
If you just want your program to send an alert to a central server if certain functionality is accessed, and then allow an "administrator" to approve the action that would be easier - your client application could make a call to your server to request permission.
To be honest you need to explain more about your setup in order to advise the best/easiest approach.
-
Apr 19th, 2009, 09:14 AM
#5
Re: Disabling a program?
Use a spammer technique.
On your website upload an image or something. Each computer will get a version of your program tied to a specific image name.
For example programPC1 will look for www.juano9z.com/pc1.jpg. If it is there, the program will do its dangerous thing. If it is not there (because you want to stop it and removed the jpg), the program will not do anything.
This way you have the 2 functionalities: internet check and enable/disable options.
-
Apr 22nd, 2009, 02:35 PM
#6
Thread Starter
Junior Member
Re: Disabling a program?
perfect, i think that would help. But How do i code that in VB 2008?
Im very new in this world of programming.
If (........) = False Then
MsgBox ("The program has been disabled")
End
else form1.show
form1.visible=True
Would it be something like that??
-
Apr 22nd, 2009, 02:38 PM
#7
Re: Disabling a program?
Do you have a web site setup which can host your file? And scripts to generate the image specific to each instance of the application?
Your basic outline is fine, except you don't need to set form1.visible = true, because form1.show does that for you.
-
Apr 22nd, 2009, 02:40 PM
#8
Thread Starter
Junior Member
Re: Disabling a program?
ok thank you, i dont have a web page but i suppose i can make one of those free ones cant I?
-
Apr 22nd, 2009, 02:42 PM
#9
Re: Disabling a program?
ok thank you, i dont have a web page but i suppose i can make one of those free ones cant I?
It depends what technology you are planning on using for generating the unique image per application instance really.
You need to bear in mind if you use a free web host you are at their mercy - if their web server goes down then none of your users will be able to run your application until they restore it.
-
Apr 22nd, 2009, 02:48 PM
#10
Thread Starter
Junior Member
Re: Disabling a program?
Well, if you could show me the easiest way basicly...
-
Apr 22nd, 2009, 02:55 PM
#11
Re: Disabling a program?
The problem is that there isn't an easy way - especially if you don't have a properly hosted web site (ideally supporting something like ASP.Net so you can have some degree of control over it).
Perhaps if you can explain more fully exactly what you are trying to do there is an alternative way of approaching it.
Software houses spend large fortunes trying to control access to their software and there aren't any really foolproof ways of doing it.
-
Apr 22nd, 2009, 05:57 PM
#12
Re: Disabling a program?
 Originally Posted by juano9z
perfect, i think that would help. But How do i code that in VB 2008?
Im very new in this world of programming.
If (........) = False Then
MsgBox ("The program has been disabled")
End
else form1.show
form1.visible=True
Would it be something like that??
Something close. It is a bad idea to use Try...Catch for program logic but the example is a quick way to illustrate what I mean. Let's use keystone_paul's avatar for this. As for the webpage, you could take a free hoster, if something changes you update the program. It's that simple and happens all the time with them windows updates. You could also pick an image hoster etc. but just to be sure: your own domain will give you the best flexibility. Some registrars offer their domains with a free webhosting package.
Code:
Try
Dim myResponse As Net.WebResponse = Nothing
Dim myWebRequest As Net.HttpWebRequest = Net.HttpWebRequest.Create("http://www.vbforums.com/image.php?u=110348")
myResponse = myWebRequest.GetResponse
MessageBox.Show("Resource exists")
Catch ex As Exception
MessageBox.Show("Resource does not exist")
End Try
-
Apr 23rd, 2009, 02:19 AM
#13
Re: Disabling a program?
The above approach will work in theory, however there are several things to note
i) If for any reason your website is down, your users won't be able to use your program
ii) If you have more than a handful of users you will need some mechanism to create the unique image for each program
iii) If you want to have finer control, ie always allow some actions to all users, always deny some actions to specific users, and sometimes allow some actions to specific users, you would need to implement different files for the different levels of functionality.
iv) It isn't that difficult for an end-user to change their system so that it redirects your program to look for the file on a different machine, ie hijack the request your website and redirect it to a local machine where they put the image you are looking for.
A better approach would be to create a webservice running on a website which is called at the point at which the user attempts an action you may want to restrict. Then the client program sends up its credentials (such as username) and what it is requesting to do (such as "delete this file"), your webservice checks in a database or file to see if the specified user should be allowed to delete the file and then returns a message to say "go ahead" or "no way" - ideally in an encrypted format so that the user cannot redirect the request and spoof a response. The client then decrypts the message and takes the appropriate action.
This also allows flexibility in that you can be as complex as you like in terms of the "vetting" of users you like, for example you could allow users access to a certain button only during office hours, or only on a Tuesday etc, rather than just a blanket Yes/No decision.
But - the above requires a web host that allows you to host your webservice and database (which a lot of free hosts wont), plus the ability and knowledge to write a web service, and careful thought as to what kind of requests you want to make and what kind of message you want to return.
That can still be circumvented but is more flexible, easier to maintain and harder to get around than just checking for the existence of a file. You will still need some form of mechanism for registering users and setting up their permissions, and you are still at the mercy of the webserver going down, but if you only try the call at the point the user is trying to perform a restricted function then users can at least use the rest of the program.
It all depends on how secure and reliable you want this blocking to be.
You still havent really explained what you mean by "i want to be able to disable my program if its being dangerous". If you mean anything other than "i want to prevent some users from having access to some functionality which is available to others" then you will need a different approach.
Last edited by keystone_paul; Apr 23rd, 2009 at 02:24 AM.
-
Apr 25th, 2009, 07:03 AM
#14
Thread Starter
Junior Member
Re: Disabling a program?
ok ty very much, ill try it
-
Apr 25th, 2009, 09:09 AM
#15
Thread Starter
Junior Member
Re: Disabling a program?
well after some tries, i created a forum and tried to use a thread as my web direction
well, i created it and when alright, but then i deleted the thread and my prgram still detects it
-
Apr 25th, 2009, 09:22 AM
#16
Re: Disabling a program?
Can you still reach the URL manually with your browser?
-
Apr 25th, 2009, 09:24 AM
#17
Thread Starter
Junior Member
-
Apr 25th, 2009, 09:37 AM
#18
Re: Disabling a program?
It returns something but not your resource 
It is some kind of redirect so you will have to compare the response too. The webmaster has decided to show a 'not found' custom page instead of a plain 404 Error.
Code:
Try
Dim myResponse As Net.WebResponse = Nothing
Dim myWebRequest As Net.HttpWebRequest = Net.HttpWebRequest.Create("http://finismundi.mforos.com/1698374/8528351-habilitar/")
myResponse = myWebRequest.GetResponse
MessageBox.Show(myResponse.ResponseUri.ToString)
If myResponse.ResponseUri.ToString <> "http://finismundi.mforos.com/1698374/8528351-habilitar/" Then
MessageBox.Show("Resource does not exist")
Else
MessageBox.Show("Resource exists")
End If
Catch ex As Exception
MessageBox.Show("Resource does not exist")
End Try
-
Apr 25th, 2009, 02:49 PM
#19
Thread Starter
Junior Member
Re: Disabling a program?
that will work? im gonna try now
-
Apr 25th, 2009, 02:57 PM
#20
Thread Starter
Junior Member
Re: Disabling a program?
Works!! I love u!
Edit: Not in a sexual way
Last edited by juano9z; Apr 25th, 2009 at 02:58 PM.
Reason: incorrect meaning
-
Apr 25th, 2009, 06:30 PM
#21
Thread Starter
Junior Member
Re: Disabling a program?
grrr... im having problems again lol
Edit:Solved for now
Last edited by juano9z; Apr 25th, 2009 at 06:56 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|