-4

I got below code to crack, and I have expanded all the jars which are having below methods still, doesn't have any clue from where the verify method taking hostname, is it taking the current machine hostname with help of API ??

hostname verifier hv= new HostnameVerifier() {

    @Override
    public boolean verify(String hostname, SSLSession session) {

        if (hostname.equals("hostname of applcation"))  
        {
            System.out.println("Host name verifier : true ");
            return true;
        }
        return false;
    }
};
  • 3
    What are you talking about? – SLaks Mar 22 '18 at 15:53
  • https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/HostnameVerifier.html – SLaks Mar 22 '18 at 15:53
  • not able to figure out from where the method verify () getting the value for hostname parameter , is it taking the run time machine hostname ,, how its taking the hostname parameter ....i am trying to run this code in one machine and first verifying the hostname , but flow skipping verify() method execution – pankaj malvi Mar 22 '18 at 16:21
  • That verifies a remote hostname. See the interface documentation. – SLaks Mar 22 '18 at 16:22
  • correct thought the same , but it was skipping the verify() method doesn't know why, I checked putting checkpoint also but the checkpoint inside the verify() method not at all executing even though giving the same hostname of machine on which the code is running ..sorry but I am new to java,, what is the interface documentation you are referring .... – pankaj malvi Mar 22 '18 at 16:27
  • https://docs.oracle.com/javase/7/docs/api/javax/net/ssl/HostnameVerifier.html But first learn what anonymous classes are. – SLaks Mar 22 '18 at 16:29

1 Answers1

0

Open the code in an ide (like IntelliJ or Eclipse). Then right-click verify(... and lick Find all references. This will show you all places known to the IDE that reference this method. Also, consider setting a breakpoint in the first line of the method. Then run your app and have a look at the call stack.

vatbub
  • 2,713
  • 18
  • 41