使用 telnet 和 JavaScript 检索 html/aspx 源代码
我需要获取存储在我公司服务器上的 aspx 页面的源代码,我无权访问该服务器(或任何服务器 - 因此不考虑服务器语言 ),我在我的 PC 上本地使用 HTA。
我写了这段代码:(JavaScript)
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("telnet -fh:/telnetlog.txt xxx.xxx.xxx.com 80"); //The host address
setTimeout("WshShell.SendKeys('GET /subfolder/page.aspx HTTP/1.0~~')",1000);
它在家里有很多页面,但现在我有 HTTP/1.1 401..
我能做什么呢?我从 IE 访问此页面没有任何问题。 任何其他想法也可以考虑!
谢谢, 罗特姆
I need to get the source of aspx page that is stored on my company's server, I don't have access to the server (Or any server - so server language not considered), I'm using HTA localy on my PC.
I wrote this code: (JavaScript)
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("telnet -fh:/telnetlog.txt xxx.xxx.xxx.com 80"); //The host address
setTimeout("WshShell.SendKeys('GET /subfolder/page.aspx HTTP/1.0~~')",1000);
It worked at home with many pages, but now I've got HTTP/1.1 401..
What can I do about it? I'm getting to this page from IE with no problems.
Any other ideas also be considered!
Thanks,
Rotem
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
401 表示服务器希望您进行身份验证,可能使用 NTLM。我严重怀疑是否可以使用 JScript 和 telnet 来实现 NTLM。
HTA 的运行安全性低于常规网页 - 因此,您可能能够通过跨站点 XmlHttpRequest 获取该页面。这将通过 IE 的安全层,该安全层应该(?)为请求提供来自浏览器的 NTLM 凭据。
从 HTA 使用 XmlHttpRequest 就像从浏览器使用 XmlHttpRequest 一样:
responseText
参数将包含服务器的响应(HTML)。您还应该能够使用 jQuery 等 javascript 库,而不是编写自己的支持代码。
401 means the server wants you to authenticate, probably with NTLM. I seriously doubt it's possible to implement NTLM using JScript and telnet.
HTA's run with lower security than regular web pages - as such, you might be able to get the page with a cross site XmlHttpRequest. That will go through IE's security layer, which should (?) provide the request with the NTLM credentials from your browser.
Using an XmlHttpRequest from an HTA is just like using one from a browser:
The
responseText
parameter will contain the server's response (the HTML).You should also be able to use a javascript library like jQuery instead of writing your own support code.
我只是这样理解:
您想在您无权访问的服务器上下载网页的 aspx 代码吗?严重地?
只需致电网络管理员即可。如果您确实为该公司工作并且有权获取此信息,那么他们可以帮助您。
如果没有的话,我希望 SO 上的其他人能够保持冷静,而不是试图为你破解一台机器。
Just so I understand:
You want to download the aspx code for a web page on a server that you do not have access to? Seriously?
Just call the network admin. If you really work for that company AND are authorized to get this info then they can help you out.
If not then, I hope others on SO have better presence of mind than to try and hack a machine for you.