• 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

port scanning

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i try to check....which port is busy...or listen mode......

but its give EXCEPTION.......



ITS GIVE AN EXCEPTION
java.net.ConnectException: Connection refused: connect

My objective is if i open yahoo page that means port 80 HTTP is active....so its must in listen mode ....but why my code is give Exception
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Connection refused means you cannot connect on the port. Are you sure it's open?

And you should close your sockets.
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I believe your basic assumption is incorrect. Namely:

dashang trivedi wrote:My objective is if i open yahoo page that means port 80 HTTP is active....so its must in listen mode ....but why my code is give Exception



If you open a yahoo page, then it means that yahoo.com is listening on port 80. Not you. Think about this from the perspective of what a web browser does (in normal mode): if you tell your web browser to connect to yahoo.com, the browser has to know what port to connect to: it defaults to assuming that yahoo will be listening on port 80, so it is relatively easy to connect their. Likewise, if you were to run a web server on your personal computer, browsers would assume that they can connect to you using port 80.

But if you have a web server on your personal computer that is using port 80, does that mean that you cannot make outgoing connections to any other web server?

To put that another way: the other web server does not care what port you are using as your outgoing port: it only cares about what port it must listen to. So you can use port 6000 on your computer to connect to port 80 on the yahoo.com servers, and that way your local port 80 is free for you to run your own personal web server.

If I look at my current outgoing connections to coderanch.com, I see:

From that I can see that I do not have a single local connection to coderanch.com that uses port 80. I have ports 55257 ... 55262 on my personal computer that are all connecting to coderanch.com

Make sense?
 
dashang trivedi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
so sir is it possible .....if i open yahoo.com or any site which use HTTP protocol ...then LOG the entry...which store source address ,destination address,port ....
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not with Java directly.

You would need to know the operating system on use on the computer you wish to monitor, and you would need administrator access to it. Then you could install some software into the protocol stack to track this.

There is a huge legal minefield here. I suggest you talk to your system administrators for simpler solutions that are legal in your jurisdiction.
 
dashang trivedi
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sir i want to develop that code ...
i m stop just because how the event is call i m not getting.....how any event is call when ip request is sending or receiving..

is it possible in java to manipulate the ip layer of network communication. Basically I want to be able to get my hands on packets BEFORE their port is resolved and they're passed onto their service application

Can you please tell me the way.....what to do....just abstract view... then i develop the code...and post it...

so many software are available in market like wire-shark,tcpdump,snort they store the ip address log....

so i think it can be develop in java also....
 
Andrew Monkhouse
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

dashang trivedi wrote:is it possible in java to manipulate the ip layer of network communication. Basically I want to be able to get my hands on packets BEFORE their port is resolved and they're passed onto their service application


This is not possible with Java.

To get your hands on the packets at that low level, you will have to develop code in a language that can access the low level drivers and will compile to native machine language on the platform it is to be deployed on.

Java compiles to byte code, not to native machine code. And in order to maintain cross-platform compatibility it does not access the drivers at such a low level.

dashang trivedi wrote:so many software are available in market like wire-shark,tcpdump,snort they store the ip address log....


  • wire-shark is developed in C
  • tcpdump is developed in C
  • snort is developed in C


  • dashang trivedi wrote:so i think it can be develop in java also....


    While I admire your zeal for developing this in Java, I think you are bound for disappointment. Different languages are just tools to be used, and are not always interchangeable. It is said that to the man with a hammer, every problem is a nail: this sounds like what you are trying to do here. Java and C are two different languages that each have good and bad points. This is the sort of problem that can be solved using C (not easily, but it can be done). This is not the sort of problem that Java is meant to solve.
     
    Ranch Hand
    Posts: 222
    Google Web Toolkit Eclipse IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Andrew Monkhouse wrote:Not with Java directly.

    You would need to know the operating system on use on the computer you wish to monitor, and you would need administrator access to it. Then you could install some software into the protocol stack to track this.

    There is a huge legal minefield here. I suggest you talk to your system administrators for simpler solutions that are legal in your jurisdiction.



    What can be illegal about this? If of course he is not planning to put this software on some other computer without permission..
     
    Rancher
    Posts: 1337
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Elchin Asgarli wrote:What can be illegal about this?


    As Andrew said, it depends on the jurisdiction. There have been court decisions that port scanning a computer that is not under your control, or which you are explicitly allowed to probe, is considered an attack (and thus illegal).
     
    Elchin Asgarli
    Ranch Hand
    Posts: 222
    Google Web Toolkit Eclipse IDE Chrome
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Lester Burnham wrote:

    Elchin Asgarli wrote:What can be illegal about this?


    As Andrew said, it depends on the jurisdiction. There have been court decisions that port scanning a computer that is not under your control, or which you are explicitly allowed to probe, is considered an attack (and thus illegal).



    That makes sense.. Because Dashang was talking about getting packets before they reach destination and talking about wireshark, I thought he wants to do packet sniffing, which on his own machine should never be illegal.
     
    Don't get me started about those stupid light bulbs.
    reply
      Bookmark Topic Watch Topic
    • New Topic