|
-
Jun 24th, 2000, 06:48 PM
#1
Thread Starter
Hyperactive Member
I need to block (not just close but BLOCK them) a range of ports on a computer
1. can I do it from VB ?
2. If yes , than how :-)
3. How many ports are there above 1024 ???
thnxs
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 24th, 2000, 11:05 PM
#2
PowerPoster
What do you mean BLOCK??? Juz refer to your previous thread
-
Jun 25th, 2000, 02:50 AM
#3
Thread Starter
Hyperactive Member
When I say "ports" I mean like the ones the a web server is using (80), or the one that an email is using (25) .... or ICQ ... or what ever ...
the story:
My little brother is playing an online game, the problem is that he plays it ALL the time (about 18 hours a day), and my mother asked me to build a program that will let him play only on certain hours, so I was thinking if I can block the PORT that the game is using during certain hours, than he won't be able to play (the program will run in the background all the time, openning the ports on certain hours, and blocking them all the rest of the time ..).
the problem is that I have checked and this game opens a random port between 1024 .. to whatever, so I need to block all of them.
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 04:17 AM
#4
Addicted Member
I do not think that your idea is do-able, but you can do something else, like check if the game is runing then close the whole game, this may work.
-
Jun 25th, 2000, 06:49 AM
#5
Thread Starter
Hyperactive Member
the game is not running in a window, so I don't know how to get the handle of it ...
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 07:10 AM
#6
-
Jun 25th, 2000, 07:25 AM
#7
Thread Starter
Hyperactive Member
The program doesn't really use a URL, the game is EverQuest, and its using an arbitrary port >1024 each time it starts (that's I know from their tech page), if I would be able to find the window handle (it is not running in a window mode though so I don't know how to find it without the window caption), than I will be able to shut the program off (send the handle a close command or what ever), but I need to know how to do that ...
Maybe there is a way to block IP addresses, I know the IP's of the servers it is using.
by the way, he is running win98 ...
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 07:39 AM
#8
PowerPoster
To find a window without caption is easy, but you need to know the Window Class that the EverQuest is using.
or you can just pass a zero in the lpClassname arguement, and it will find all the Window regardless to thier class type. But to do this you need to change the lpClassName from String to Long in the FindWindow APi function.
Code:
Option Explicit
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_CLOSE = &HF060&
Private EverQuest_HWND as Long
Private Sub Command1_Click
EverQuest_HWND = FindWindow(0&, vbNullString)
'If return handle is not zero, then juz close the program.
If EverQuest_HWND <> 0 Then SendMessage EverQuest_HWND, WM_SYSCOMMAND, SC_CLOSE, 0&
End Sub
-
Jun 25th, 2000, 07:49 AM
#9
PowerPoster
You also can get the respective window class base on thier current window location:
Assume the EverQuest game is running with Maximized window screen.
But I'm not sure this will work or not, because I've not try it out yet.
Code:
Option Explicit
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As Long, ByVal lpWindowName As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Const WM_SYSCOMMAND = &H112
Private Const SC_CLOSE = &HF060&
Private xReturn As String
Private Command1_Click()
'GetWindows Handle
EverQuest_HWND = WindowFromPoint(0, 0)
If EverQuest_HWND <> 0 Then
xReturn = String(255, Chr(0))
If GetClassName(EverQuest_HWND, xReturn, Len(xReturn)) <> 0 Then
EverQuest_CLASS = Left(xReturn, InStr(1, xReturn, Chr(0), vbBinaryCompare) - 1)
If EverQuest_CLASS <> "" Then
EverQuest_HWND = FindWindow(0&, EverQuest_CLASS)
SendMessage EverQuest_HWND, WM_SYSCOMMAND, SC_CLOSE, 0&
End If
End If
End If
[Edited by Chris on 06-25-2000 at 08:58 PM]
-
Jun 25th, 2000, 08:04 AM
#10
Hyperactive Member
Wipe out the game
You might want to build something that changes the name of the game executable instead, or simply deletes it, then you have a copy of it build in your program which would rewrite it at ceratin times, or just change name
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 25th, 2000, 08:21 AM
#11
Thread Starter
Hyperactive Member
Thanks guys, I will try it as soon as I can (today), and I will post the results.
I liked the Idea with renaming and saving a copy of the file name, but the problem is that my brother is a pretty smart guy when he wants to ... and he really likes this game, so I will try both ways and see which works better :-)
Thnxs, and if you have any more ideas how to "solve" the problem, please post it.
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 08:27 AM
#12
Hyperactive Member
Which game?
Depends on the game too, maybe I know something about it...
What is the game?
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 25th, 2000, 08:34 AM
#13
Thread Starter
Hyperactive Member
EverQuest
http://www.EverQuest.com
(pretty cool game actually but 18 hours a day ???).
:-)
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 08:39 AM
#14
Hyperactive Member
Is the game windows or DOS-based?
I think it's windows based as almost all new games are 
So, a windows game requeries DLL's and registry keys.. 
Getting my point?
Here's where the keys often lies
HKCU\Software\EverQuest or something
(HKLM)
You might want to change something like Installed = Yes to No so the game wont start then just change it back or something.. or hit away any dll's or devices the game uses... i'm sure you can come up with many ideas... good luck
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 25th, 2000, 08:40 AM
#15
Thread Starter
Hyperactive Member
By the way, I will also need to disable his CTRL-ALT-DEL
so he won't be able to force the system to kill the program, anyone know of a better way than that / how to disable the CTRL-ALT-DEL ?
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 08:43 AM
#16
Thread Starter
Hyperactive Member
yes, that's a good one Rodik, I might be able to rename a DLL in the system folder, and that's it, just need to find a DLL that is Important for the game, but than I still need to shut the game off after lets say 2 hours or so ...
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 08:47 AM
#17
Hyperactive Member
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 25th, 2000, 08:51 AM
#18
PowerPoster
Disable Ctrl+Atl+Del
Rodik's code is only hide your progrom from the Task Manager, but you still can call the Task Manager but pressing the Ctrl+Atl+Del key.
If you want to disable the Ctrl+Atl+Del key, you need to this way Tip 33
-
Jun 25th, 2000, 08:57 AM
#19
Thread Starter
Hyperactive Member
Wow !!!
Guys, you don't know how much you helped me with that ...
I was sitting until 5am trying to think of good ways to do it.
I even went all the way to use magic folders, and enable and disbable the folder from withing my program by sending key strokes to magic folder (password and stuff), but your Ideas are much better than that :-)
Thanks, and if you have more information, please post it !
I really appriciate it.
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 09:01 AM
#20
Hyperactive Member
Yeah Chris, you're right! My code doesn't disable Ctrl+Alt+Del which I explained but it makes a service out of his prorgam. So it doesn't matter if he can get to the taskbar cause he can't shut the program down anyway... 
I mean, if he wants, he just pushes the power button and then restarts and poof! But whatever....
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
-
Jun 25th, 2000, 09:14 AM
#21
PowerPoster
Hey, Asabi, juz bare in mind that both the hide from the Task Manager list and Disable the Ctrl+Atl+Del key will not be work under WinNT platform.
-
Jun 25th, 2000, 09:18 AM
#22
Thread Starter
Hyperactive Member
But he is using win98
And the game wouldn't work under NT anyway ... :-)
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 09:29 AM
#23
PowerPoster
Than everything should be find & under you prediction. lol
Hope you can make it.
Cheers!
-
Jun 25th, 2000, 09:35 AM
#24
Thread Starter
Hyperactive Member
Yep, Everything should be fine :-)
I will probably even write some code to check the time and date with NASA or my home machine (through an ASP page)something to make sure he doesn't try to cheat the program with dates/times .. :-)
Thanks again, I will post the results.
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 09:51 AM
#25
PowerPoster
Hi Asabi,
You said you can check the date time with NASA, can you tell me you you do it? because I'm interested too.
Cheers!
-
Jun 25th, 2000, 09:57 AM
#26
Thread Starter
Hyperactive Member
Well,
I understood from a friend that they have it somewhere on their website, if they do, than I can use the internet control to retrieve the HTML code of the page, strip out most of it, and get just the current time and date :-)
And if that doesn't work, than I can do the same with my machine.
having an ASP page that would just show the Date and Time on my home machine.
Than from withing the VB program send a URL request to my home machine, and retrieve that information.
When it is done, I will post the code here.
Cheers.
In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.
- Douglas Adams
The Hitchhiker's Guide to the Galaxy
-
Jun 25th, 2000, 01:05 PM
#27
Hyperactive Member
Nasa, huh?
Actually, NASA hasn't anything to do with this (although, they were the first to start with it). The thing is called time server, which is a 'TimeD' running on a Unix machines. Most of them come with it and the format is simple.
You just connect with a winsock control the time-port which is 37 and you get a three charachter long garbage then it disconnects. So, I don't know what to do with this three character long string, but there is some way to decrypt it. It's supposed to be fast since even the milliseconds are sent.
The two most used protocols are Network Time Protocol (Internet RFC-1305a) and Simple Network Time Protocol (SNTP).
I don't know how the client works because I've never used it before.
If you want to know more, here are some links.
A type of search you could do
Time Servers
Signed, Rodik ([email protected])
Programmer,usesVB6ED
===========================
Copyright©RodikCo,2002.
Dont mind this signature ;] Its old
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
|