Page 1 of 1

how can i make a browser and fake domain calls etc?

Posted: Tue May 03, 2005 5:23 am
by doodlemunch
in example if i call google.com i want my own browser to go to my own site for example but anything should appear like its google.com (no this is not for bad usage or lame stuff like that, its for an exercise).

i dunno if im clear or expressed myself well or not!

i want to make a very simple browser in pb, that tells to my http server when i call google.com that its google.com do i make sense? in my server i have a domain setted up as google.com (in fact it is another name but its an example just) so the browser when calls google.com it should display MY google.com and not the real one how can i do this | do i make sense at all?

Posted: Tue May 03, 2005 5:39 am
by doodlemunch
do i need to play with dns stuff?
sorry for the lame thread title

Re: how can i make a browser and fake domain calls etc?

Posted: Tue May 03, 2005 6:38 am
by PB
> if i call google.com i want my own browser to go to my own site for
> example but anything should appear like its google.com

What do you mean by "my own browser"? Do you mean a WebGadget, or
your system browser (such as Firefox)? Anyway, here's a WebGadget way:

Code: Select all

If OpenWindow(1,300,200,450,200,#PB_Window_SystemMenu,"Test")
  CreateGadgetList(WindowID())
  StringGadget(1,0,0,425,20,"http://")
  ButtonGadget(2,425,0,25,20,"Go")
  WebGadget(3,0,20,450,170,"")
  Repeat
    ev=WaitWindowEvent()
    If ev=#PB_Event_Gadget And EventGadgetID()=2 ; Go was clicked.
      url$=GetGadgetText(1) ; Get typed URL to see if it's Google.com.
      If url$="http://www.google.com" ; If Google.com, go to PureBasic.
        SetGadgetText(3,"http://www.purebasic.com")
      EndIf
    EndIf
  Until ev=#PB_EventCloseWindow
EndIf

Posted: Wed May 04, 2005 3:47 pm
by Beach
Windows tries to resolve host names in the 'hosts' file before going out to the DNS server you have defined. This might not work for what you want to do - I thought it was worth mentioning.

The file is here on Windows XP: c:\Windows\System32\Drivers\Etc\hosts

-Beach

My 'hosts' file:

Code: Select all

# Copyright (c) 1993-1999 Microsoft Corp.
## This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

127.0.0.1       localhost

192.168.1.2	www.google.com