• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Blocking Internet Access

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have to make an application in java which blocks the internet access for particular duration (say from 9:00 am to 1 :00 pm). I found this interesting and took it as my project ,now i am not getting a satisfactory stuff on internet .
Is this possible to develop such application in java ?
Are things like blocking packets from port 80 , creating proxy server,(i dont know how to do both but i will learn), can be used to achieve it .


Thanks in advance

 
Sheriff
Posts: 5555
326
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, Welcome to the Ranch

There are plenty of applications out there already that will do this. What's the motivation for you to reinvent the wheel?

Perhaps show us what you've tried so far, and tell us what specific problem you're having just now.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, Java is not a good language for this. But as Tim said, there should be no need to develop something yourself. Install a firewall on the computer (if there isn't one already), and configure it via an admin account appropriately.
 
ritika soni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello ,thanks for responding
#Tim Cooke , i am doing this because i want to learn how it can be done . I haven't code anything yet ,i am just trying to get the concept of blocking internet .I just thought of changing the proxy address(in internet properties) to an invalid address programmatically but haven't succeed yet . My problem is i am not getting the logic that will work to block internet access .
 
ritika soni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello #Ulf Dittmer , as i said i want to do it because i want to learn how it can be done , secondly you said java is not good choice for this purpose , could you please tell me why ?
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome again

Because Java does not gvie easy access to memory locations other than references already created. You cannot therefore easily find where internet access is occurring in Java.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The only way Java could intercept network traffic is if it handled the traffic to begin with (as a server or proxy), or through native code via some form of JNI.
 
Bartender
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

As a way to spin a positive spin on your project, you need to do much more research. Look at how to build/design firewalls - there is quite a bit out there on this.

What you will find is that you will probably need to create a module (if unix/linux) OR (windows) write some very low code that filters the port or create a driver to do the filtering.

Most of the above will be in c, c++ or c#; but you will find that out for yourself.

In the '90s there were a lot of write your own firewall (look at O'Rilliey's site - i think there a book maybe '95 How to write a firewall). But you really need to understand network security and understand
how this is implemented in the operating system you are interested in.

I also suggest you visit source forge and look at firewall products.

Overall - we don't write this stuff in java and we use products that have been created for us. (what the others have been telling you). but if you want to know the details, you will need to drill down and do the research first.

hope this helps.

-steve
 
ritika soni
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to all , as every one said java is not a good choice for this purpose , i am going to develop the same using c or c++
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

If you are running it in Windows, one way – but very primitive – is to use the Runtime class and command prompt commands: ipconfig /release and ipconfig /renew. There are classes that return the system's time also...
Someone may say that this can't be considered as 'blocking internet access', but it's a sort of, so you can make the application such that it executes the ipconfig /release command consequently until the specified time occurs, so even if the user knows how to reconnect, that wouldn't be effective. You can make the application to run on startup, etc...
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ricochet Droja wrote:Someone may say that this can't be considered as 'blocking internet access', but it's a sort of...



As far as I know, renewing the lease on the machine's IP address doesn't prevent any applications from accessing the internet at all. So it's not even "sort of".
 
Ricochet Droja
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:

Ricochet Droja wrote:Someone may say that this can't be considered as 'blocking internet access', but it's a sort of...



As far as I know, renewing the lease on the machine's IP address doesn't prevent any applications from accessing the internet at all. So it's not even "sort of".



I didn't say that we execute the same commands at the same time, when the specified time occurs(ex: 1 pm), the ipconfig /renew command is executed ergo the internet access is retrieved! You didn't get my point!
 
Paul Clapham
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ricochet Droja wrote:You didn't get my point!



Apparently not. Did you mean that the code should do "ipconfig /release" at 9 am and then "ipconfig /renew" at 1 pm, in answer to the original post? In that case, yeah, but you seem to agree with me that it isn't really a good answer. I'm sure you can show us several ways that could be defeated by the person who wants to access the internet.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic