Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Finding the site URL I am in Internet explorer, Firefox, Opera, Chrome, etc...

Posted on 2008-11-14
7
Medium Priority
?
451 Views
Last Modified: 2013-11-05
Hi, guys,

I wonder if there is a way to know what is the URL of a site when I am in a browser (could be Opera, Firefox, Chrome, IE7)... My task is to build a text file with all the sites visited by an user... Any ideas...

regards
manuel Lopez (lopem)
0
Comment
Question by:lopem
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 6

Accepted Solution

by:
dathho earned 152 total points
ID: 22964700
One more that looks promising for you...
http://blogs.techrepublic.com.com/window-on-windows/?p=745 
0
 
LVL 18

Assisted Solution

by:Johnjces
Johnjces earned 300 total points
ID: 22965157
One more here on I.E. Check my assisted answer on that Q.

John

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_23025576.html
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 18

Assisted Solution

by:Johnjces
Johnjces earned 300 total points
ID: 22965172
Wopps... I.E. should be EE (Experts Exchange)
0
 
LVL 13

Expert Comment

by:ThievingSix
ID: 22965243
What about scanning for all connections made through port 80 and get the sites that way?
0
 
LVL 3

Author Comment

by:lopem
ID: 22965253
Hi, Thieving six,

I don't know how to scan a port thru delphi. Any code to share?

regards
Manuel Lopez (lopem)
0
 
LVL 13

Assisted Solution

by:ThievingSix
ThievingSix earned 148 total points
ID: 22965363
Use the unit shown below like this:

var
  FBufferTCP : PMIB_TCPTABLE_OWNER_PID;

implementation


function GetIP(AIP: DWORD): WideString;
var bytes: array[0..3] of Byte;
begin
  Move(AIP, bytes[0], SizeOf(AIP));
  Result := IntToStr(bytes[0]) + '.' +
            IntToStr(bytes[1]) + '.' +
            IntToStr(bytes[2]) + '.' +
            IntToStr(bytes[3]);
end;

function GetPort(APort: DWORD): DWORD;
begin
  Result := (APort div 256) + (APort mod 256) * 256;
end;

procedure ReadTCPTable;
var wsadata: TWSAData;
    ret: DWORD;
    dwSize: DWORD;
begin
  if not IPHelperLoaded then
    Exit;
  WSAStartup(2, wsadata);
  try
    if IPHelperVistaLoaded then begin
      dwSize := 0;
      ret := GetExtendedTcpTable(FBufferTCP, @dwSize, True, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0);
      if ret = ERROR_INSUFFICIENT_BUFFER then begin
        GetMem(FBufferTCP, dwSize);
        GetExtendedTcpTable(FBufferTCP, @dwSize, True, AF_INET, TCP_TABLE_OWNER_PID_ALL, 0);
      end;
    end else if IPHelperXPLoaded then
      AllocateAndGetTcpExTableFromStack(@FBufferTCP, True, GetProcessHeap, 2, 2);
  finally
    WSACleanup;
  end;
end;

procedure GetALLIPFromPort(Port: Integer; OutIPs: TStringList);
var
  item: MIB_TCPROW_OWNER_PID;
  item2: MIB_TCPROW;
  I : Integer;
begin
  ReadTCPTable;
  For I := 0 To FBufferTCP^.dwNumEntries - 1 Do
    begin
    item := FBufferTCP^.table[I];
    If GetPort(Item.dwLocalPort) = Port Then
      begin
      OutIPs.Add(GetIP(Item.dwRemoteAddr));
    end;
  end;
end;



unit uIPHelperAPI;
 
interface
 
uses Windows;
 
 
resourcestring
  ResTCPStateClosed = 'Closed';
  ResTCPStateListen = 'Listen';
  ResTCPStateSynSent = 'SynSent';
  ResTCPStateSynRcvd = 'SynRcvd';
  ResTCPStateEst = 'Established';
  ResTCPStateFW1 = 'Fin Wait1';
  ResTCPStateFW2 = 'Fin Wait2';
  ResTCPStateCloseWait = 'Close Wait';
  ResTCPStateClosing = 'Closing';
  ResTCPStateLastAck = 'Last ACK';
  ResTCPStateTimeWait = 'Time Wait';
  ResTCPStateDeleteTCB = 'Delete TCB';
 
const
 
     TCP_STATES: array[1..12] of string = (ResTCPStateClosed,
                                           ResTCPStateListen,
                                           ResTCPStateSynSent,
                                           ResTCPStateSynRcvd,
                                           ResTCPStateEst,
                                           ResTCPStateFW1,
                                           ResTCPStateFW2,
                                           ResTCPStateCloseWait,
                                           ResTCPStateClosing,
                                           ResTCPStateLastAck,
                                           ResTCPStateTimeWait,
                                           ResTCPStateDeleteTCB);
 
type
 
    TCP_TABLE_CLASS = (TCP_TABLE_BASIC_LISTENER, TCP_TABLE_BASIC_CONNECTIONS,
                       TCP_TABLE_BASIC_ALL, TCP_TABLE_OWNER_PID_LISTENER,
                       TCP_TABLE_OWNER_PID_CONNECTIONS, TCP_TABLE_OWNER_PID_ALL,
                       TCP_TABLE_OWNER_MODULE_LISTENER, TCP_TABLE_OWNER_MODULE_CONNECTIONS,
                       TCP_TABLE_OWNER_MODULE_ALL);
 
    UDP_TABLE_CLASS = (UDP_TABLE_BASIC, UDP_TABLE_OWNER_PID, UDP_TABLE_OWNER_MODULE);
 
    PMIB_TCPROW = ^MIB_TCPROW;
    MIB_TCPROW = packed record
      dwState: DWORD;
      dwLocalAddr: DWORD;
      dwLocalPort: DWORD;
      dwRemoteAddr: DWORD;
      dwRemotePort: DWORD;
    end;
 
    PMIB_TCPROW_OWNER_PID = ^MIB_TCPROW_OWNER_PID;
    MIB_TCPROW_OWNER_PID = packed record
      dwState: DWORD;
      dwLocalAddr: DWORD;
      dwLocalPort: DWORD;
      dwRemoteAddr: DWORD;
      dwRemotePort: DWORD;
      dwOwnerPID: DWORD;
    end;
 
    PMIB_UDPROW_OWNER_PID = ^MIB_UDPROW_OWNER_PID;
    MIB_UDPROW_OWNER_PID = packed record
      dwLocalAddr: DWORD;
      dwLocalPort: DWORD;
      dwOwnerPID: DWORD;
    end;
 
    PMIB_TCPTABLE_OWNER_PID = ^MIB_TCPTABLE_OWNER_PID;
    MIB_TCPTABLE_OWNER_PID = packed record
      dwNumEntries: DWORD;
      table: array [0..0] of MIB_TCPROW_OWNER_PID;
    end;
 
    PMIB_UDPTABLE_OWNER_PID = ^MIB_UDPTABLE_OWNER_PID;
    MIB_UDPTABLE_OWNER_PID = packed record
      dwNumEntries: DWORD;
      table: array [0..0] of MIB_UDPROW_OWNER_PID;
    end;
 
    TAllocateAndGetTcpExTableFromStack = function (pTcpTable: PMIB_TCPTABLE_OWNER_PID;bOrder: BOOL;heap: THandle;
                                                   zero: DWORD;flags: DWORD):DWORD;stdcall;
    TAllocateAndGetUdpExTableFromStack = function (pTcpTable: PMIB_TCPTABLE_OWNER_PID;bOrder: BOOL;heap: THandle;
                                                   zero: DWORD;flags: DWORD):DWORD;stdcall;
    TSendTcpEntry = function (pTCPRow: PMIB_TCPROW):DWORD;stdcall;
    TGetExtendedTcpTable = function (pTcpTable: PMIB_TCPTABLE_OWNER_PID;pdwSize: PDWORD;bOrder: BOOL;ulAf: ULONG;
                                     TableClass: TCP_TABLE_CLASS;Reserved: ULONG):DWORD;stdcall;
    TGetExtendedUdpTable = function (pTcpTable: PMIB_UDPTABLE_OWNER_PID;pdwSize: PDWORD;bOrder: BOOL;ulAf: ULONG;
                                     TableClass: UDP_TABLE_CLASS;Reserved: ULONG):DWORD;stdcall;
 
const
  MIB_TCP_STATE_CLOSED = 1;
  MIB_TCP_STATE_LISTEN = 2;
  MIB_TCP_STATE_SYN_SENT = 3;
  MIB_TCP_STATE_SYN_RCVD = 4;
  MIB_TCP_STATE_ESTAB = 5;
  MIB_TCP_STATE_FIN_WAIT1 = 6;
  MIB_TCP_STATE_FIN_WAIT2 = 7;
  MIB_TCP_STATE_CLOSE_WAIT = 8;
  MIB_TCP_STATE_CLOSING = 9;
  MIB_TCP_STATE_LAST_ACK = 10;
  MIB_TCP_STATE_TIME_WAIT = 11;
  MIB_TCP_STATE_DELETE_TCB = 12;
 
var
   IPHelperLoaded: Boolean;
   IPHelperXPLoaded: Boolean;
   IPHelperVistaLoaded: Boolean;
   AllocateAndGetTcpExTableFromStack: TAllocateAndGetTcpExTableFromStack;
   AllocateAndGetUdpExTableFromStack: TAllocateAndGetUdpExTableFromStack;
   SetTcpEntry: TSendTcpEntry;
   GetExtendedTcpTable: TGetExtendedTcpTable;
   GetExtendedUdpTable: TGetExtendedUdpTable;
 
implementation
 
const
     iphelper = 'iphlpapi.dll';
var
   LibHandle: THandle;
   
procedure LoadIPHelper;
begin
  LibHandle := LoadLibrary(iphelper);
  if LibHandle <> INVALID_HANDLE_VALUE then begin
    @AllocateAndGetTcpExTableFromStack := GetProcAddress(LibHandle, 'AllocateAndGetTcpExTableFromStack');
    @AllocateAndGetUdpExTableFromStack := GetProcAddress(LibHandle, 'AllocateAndGetUdpExTableFromStack');
    @SetTcpEntry := GetProcAddress(LibHandle, 'SetTcpEntry');
    @GetExtendedTcpTable := GetProcAddress(LibHandle, 'GetExtendedTcpTable');
    @GetExtendedUdpTable := GetProcAddress(LibHandle, 'GetExtendedUdpTable');
  end;
  IPHelperLoaded := (LibHandle <> INVALID_HANDLE_VALUE) and Assigned(SetTcpEntry);
  IPHelperXPLoaded := IPHelperLoaded and
                      (Assigned(AllocateAndGetTcpExTableFromStack) and Assigned(AllocateAndGetUdpExTableFromStack));
  IPHelperVistaLoaded := IPHelperLoaded and
                         (Assigned(GetExtendedTcpTable) and Assigned(GetExtendedUdpTable));
end;
 
procedure ReleaseIPHelper;
begin
  if LibHandle <> INVALID_HANDLE_VALUE then
    FreeLibrary(LibHandle);
end;
 
initialization
 
  LoadIPHelper;
 
finalization
 
  ReleaseIPHelper;
 
end.

Open in new window

0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Screencast - Getting to Know the Pipeline
Suggested Courses
Course of the Month11 days, 7 hours left to enroll

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question