`
huangxx
  • 浏览: 321799 次
  • 来自: ...
社区版块
存档分类
最新评论

How to get IP address of the browser

阅读更多
http://www.faqts.com/knowledge_base/view.phtml/aid/9005

How to get IP address of the browser when its operating behind a proxy/firewall? (applets...activex....??)
i have copied the code in my front page but it doesnt work. i dont have .asp setup.
Can u plz send me a simple javascript for .html page to do this job? just MAC address is required
Nov 23rd, 2006 22:39
Anzer M, Michael Scalise, Silvio Pedroso, Hari prasad, Qamar Ahmad, Built in ActiveX Problem in Windows XP

Hi,
there are some problems with below ActiveX it wont work in two builds of
Windows XP. Details are

The components used
<object classid="CLSID:76A64158-CB41-11D1-8B02-00600806D9B6"
id="locator" VIEWASTEXT></object>

<object classid="CLSID:75718C9A-F029-11d1-A1AC-00C04FB6C223"
id="theId"></object>

It works for all system except two. The specifications of the systems
are as follows:
IE version       - 6
OS                   - Windows Xp Professional version
6.0.2900.2180.xpsp_sp2_rtm.040803-2158
and Windows Xp Professional version 6.0.2900.2180.xpsp_sp2_gdr.050301-1519

The systems are configured exactly like the others. It seems that
something is restricting the Active X control from loading into the page.

Please let me know if there is any work around or patch to this problem...

----End----

Hi,

You may use a client side javascript in order to discover the IP
address.

<script language="javascript">
   alert(location.hostaddress);
</script>

(The solution above doesn't work. It retrieves only the public Ip
address, not the IPaddress on the PC behind the firewall/router. My
solution below does work, but it is a bit more complicated. Mike
Scalise 9/18/2003)

This solution does retrieve IP addresses from behind a firewall. It
does have limitations. The client computer must be running Windows. It
requires ActiveX to be enabled in the browser.
The first file uses Windows Management Instrumentation (WMI) to
retrieve the physical address of your network card (MAC Address) and
the IP address currently assigned to that computer. Remember, if client
computer gets an address using DHCP, this Ip address may change daily.
The MAC address never changes. It is burned into your network card and
is supposed to be unique in the world. (In fact, microsoft uses the MAC
address and the curent date and time to generate GUID's. )

The first page does an asyncronous call to the WMI system. When the
async call it is done, then it then automatically posts the data to
another file which displayed the results. Nifty cool.
Mike Scalise
  


Copy and paste the two ASPFiles below.

The first ASP file- NIC5.ASP

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
	<head>
		<title>WMI Scripting HTML</title>

		<script FOR="foo" EVENT="OnCompleted(hResult, 
pErrorObject, pAsyncContext)" LANGUAGE="JScript">

             document.forms[0].txtMACAddr.value=unescape(MACAddr);
             document.forms[0].txtIPAddr.value=unescape(IPAddr);
             document.forms[0].txtDNSName.value=unescape(sDNSName);
             document.formbar.submit();
        </script>
		<script FOR="foo" EVENT="OnObjectReady(objObject, 
objAsyncContext)" LANGUAGE="JScript">

         if(objObject.IPEnabled != null && objObject.IPEnabled !
= "undefined" && objObject.IPEnabled == true)
                  {

                   if(objObject.MACAddress != null && 
objObject.MACAddress != "undefined")
                         MACAddr = objObject.MACAddress;


                   if(objObject.IPEnabled && objObject.IPAddress(0) != 
null && objObject.IPAddress(0) != "undefined")
                         IPAddr = objObject.IPAddress(0);

                   if(objObject.DNSHostName != null && 
objObject.DNSHostName != "undefined")
                      sDNSName = objObject.DNSHostName;

                   }
        </script>

	</head>
	<body>
		<p>



			<FONT color="red"><span 
ID="info"> </span>. </FONT>
			<object classid="CLSID:76A64158-CB41-11D1-8B02-
00600806D9B6" id="locator" VIEWASTEXT>
			</object>
			<object classid="CLSID:75718C9A-F029-11d1-A1AC-
00C04FB6C223" id="foo">
			</object>

			<script LANGUAGE="JScript">

             			var service = locator.ConnectServer();
             			var MACAddr ;
             			var IPAddr ;
             			var DomainAddr;
             			var sDNSName;
             			service.Security_.ImpersonationLevel=3;
             			service.InstancesOfAsync
(foo, 'Win32_NetworkAdapterConfiguration');
        		</script>
		</p>


<form method="POST" action="NICPost.asp" id="formfoo" name="formbar">

	<input type="hidden"  name="txtMACAddr">
	<input type="hidden"  name="txtIPAddr">
	<input type="hidden"  name="txtDNSName">

</form>


	</body>
</html>

*************************
This is the second file. It is an ASP page, but you could change it to
plain HTML and use Java to retrieve the form field values, if you
wanted.

NICPost.asp

<HTML>
	<HEAD>
	</HEAD>
	<BODY>
		Network Interface Card Information Page
		<BR>
		<BR>
		<BR>
		You are at IP Address <STRONG>
			<%=request.form("txtIPAddr")%>
		</STRONG>
		<BR>
		Your MAC address on your network card is <STRONG>
			<% =request.form("txtMACAddr")%>
		</STRONG>
		<BR>
		Your DNS Host name is <STRONG>
			<% =request.form("txtDNSName")%>
		</STRONG>
		<BR>
		<BR>
		<BR>
		To confirm your IP and MAC address information, go to 
the command prompt and 
		type in
		<BR>
		<BR>
		IPCONFIG/ALL
		<BR>
		<BR>
		ASP reports that your IP Address is <STRONG>
			<%
		response.Write Request.Servervariables("REMOTE_ADDR")
		%>
		</STRONG>which is your external WAN IP address that 
anyone can see,
		<BR>
		but maybe be shared by hundreds of users if you use Net 
Address Translation 
		(NAT)
		<BR>
		through a common router.
	</BODY>
</HTML>

分享到:
评论

相关推荐

    端口查看工具

    of the remote IP address (requires to download an external file from here) * Version 1.41: o Fixed bug: CurrPorts failed to display the current Auto Refresh status in Menu. * Version 1.40: o ...

    VB编程资源大全(英文源码 网络)

    You must know each others IP address and have an understanding of ports&lt;END&gt;&lt;br&gt;16 , inteferorprovider.zip program which communicates with each other and allows one computer to perform a task on ...

    Intrusion Detection: Network Security beyond the Firewall

    How Does One Get the Data? Intrusion Detection Inside a Firewall Relying on Others for Data System Data Sources syslog Audit Trails Tracing the Path of Activity Can Be Difficult Monitoring ...

    a project model for the FreeBSD Project.7z

    An example of a port is the port for the web-browser Mozilla. It contains information about where to fetch the source, what patches to apply and how, and how the package should be installed on the ...

    VB编程资源大全(英文源码 表单)

    InetPass.zip This example demonstrates how to get windows' cached passwords. "This example will show all of the cached passwords on a local system !"&lt;END&gt;&lt;br&gt;29 , Toolbar1.zip Label ToolBar....

    XDA成员开发出Carrier IQ检测程序(Android)

    Select a service and press the button again to get a dump of the service. Ports & Agents: HTC Checkin DB (Root Only)- Shows what info you are sending to htc when checking in automatically Google ...

    eric5-5.3.1

    This is part of the Qt distribution and may be used to display help files. Mercurial This is a distributed version control system available from &lt;mercurial.selenic.com&gt;. It is the one used by ...

    google api php client

    1. If you have delegated domain-wide access to the service account and you want to impersonate a user account, specify the email address of the user account using the method setSubject: ```php $...

    JavaScript Cookbook

    This cookbook is chock-full of code recipes that address common programming tasks, as well as techniques for building web apps that work in any browser. Just copy and paste the code samples into your...

    VB编程资源大全(英文源码 控件)

    on left and right side of a text box.&lt;END&gt;&lt;br&gt;40,Assist.zip A simple application with source code which shows how to save the contents of a rich text box without the help of common dialog box.&lt;END&gt;...

    .htaccess

    Of course, this will only work if you know the IP addresses you want to ban and, as most people on the internet now have a dynamic IP address, so this is not always the best way to limit usage. ...

    VB编程资源大全(英文源码 控制)

    This demonstrates most of the event procedures of the CM Dialog control.&lt;END&gt;&lt;br&gt;27 , campbell-reg.zip This demonstrates how to write and retrieve information from the registry.&lt;END&gt;&lt;br&gt;28 , ...

    ICS delphixe10源码版

    Don't forget to mention your name, street address, EMail and web site. Contributions: -------------- ICS has been designed by Fran鏾is PIETTE but many other peoples are working on the components ...

    Visual C++ 编程资源大全(英文源码 网络)

    1,pop3.zip CPop3Connection - an MFC Class to encapsulate the POP3 protocol(15KB)&lt;END&gt;&lt;br&gt;2,ipenum.zip IPEnum - an MFC class and console app to allow IP address enumeration(11KB)&lt;END&gt;&lt;br&gt;3,smtp....

    php.ini-development

    You can redirect all of the output of your scripts to a function. For ; example, if you set output_handler to "mb_output_handler", character ; encoding will be transparently converted to the ...

    python3.6.5参考手册 chm

    Changes to the Handling of Deprecation Warnings Python 3.1 Features PEP 372: Adding an Ordered Dictionary to collections PEP 378: Format Specifier for Thousands Separator PEP 389: The argparse ...

Global site tag (gtag.js) - Google Analytics