【问题标题】:Download and start sh.x and .run files with curl or wget使用 curl 或 wget 下载并启动 sh.x 和 .run 文件
【发布时间】:2020-07-09 01:53:04
【问题描述】:

我通常使用以下命令从终端启动 bash 程序:

curl https://example.com/assets/file/file.sh | bash

但如果我对 .run 或 .sh.x 文件做同样的事情,它就不起作用。 我尝试了两种不同的方式:

curl https://example.com/assets/file/file.sh.x | bash

或者

wget -O - https://example.com/assets/file/file.run | bash

我在终端中看到一系列不允许脚本启动的语法错误或 ascii 代码。

在网上我没有找到任何可以帮助我解决问题的方法。

是否可以解决这个问题,还是文件扩展名不允许?

wget file.sh.x 文件的输出:

HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/octet-stream]
Saving to: ‘STDOUT’

-                                 [ <=>                                              ]  11.94K  --.-KB/s    in 0s

2020-03-28 16:03:19 (43.6 MB/s) - written to stdout [12224]

bash: line 1: syntax error near unexpected token `)'
bash: line 1: `ELF>@)@8  @@@@888      '

file.sh.x 文件的卷曲输出:

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 12224    0 12bash: line 1: syntax error near unexpected token `)':--     0
2bash: line 1: `ELF>@)@8 @@@@888      '
24    0     0  39432      0 --:--:-- --:--:-- --:--:-- 39432
(23) Failed writing body

file.sh.x 内容类似于:

...
    7f45 4c46 0201 0100 0000 0000 0000 0000
    0300 3e00 0100 0000 d00b 0000 0000 0000
    4000 0000 0000 0000 0029 0000 0000 0000
    0000 0000 4000 3800 0900 4000 1b00 1a00
    0600 0000 0400 0000 4000 0000 0000 0000
    4000 0000 0000 0000 4000 0000 0000 0000
    f801 0000 0000 0000 f801 0000 0000 0000
    0800 0000 0000 0000 0300 0000 0400 0000
    3802 0000 0000 0000 3802 0000 0000 0000
    3802 0000 0000 0000 1c00 0000 0000 0000
    1c00 0000 0000 0000 0100 0000 0000 0000
...

wget file.run 的输出:

HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-makeself]
Saving to: ‘STDOUT’

-                                 [ <=>                                              ]  12.86K  --.-KB/s    in 0s

2020-03-28 16:08:50 (44.6 MB/s) - written to stdout [13173]

Verifying archive integrity...head: cannot open 'bash' for reading: No such file or directory
main: line 80: bash: No such file or directory
Error in MD5 checksums: d41d8cd98f00b204e9800998ecf8427e is different from 42a127ab90433f4d3fabc166a4e0ca24

file.run 的卷曲输出:

 % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13173    0 13173    0     0  32932      0 --:--:-- --:--:-- --:--:-- 32932
Verifying archive integrity...head: cannot open 'bash' for reading: No such file or directory
main: line 80: bash: No such file or directory
Error in MD5 checksums: d41d8cd98f00b204e9800998ecf8427e is different from 42a127ab90433f4d3fabc166a4e0ca24

file.run 文件的内容很长,里面有 .run 文件的所有初始化,最后是一长串 ascii 代码。

直接在他们都工作的服务器上运行。

使用 wget 或 curl 命令不起作用

根据收到的响应,有没有办法自动启动 sh.x / run 文件,就像 bash 脚本通过在命令末尾添加“| bash”一样?

【问题讨论】:

  • file.sh.x 的内容添加到您的问题(无评论)和所有错误中。

标签: bash curl sh wget


【解决方案1】:

注意:在将一系列未知命令从网站传送到 shell 时,您真的应该非常小心!!!

您试图让bash 运行的文件是ELF 二进制文件,即编译后的可执行程序,而不是shell 脚本。你可以这样检查:

curl https://example.com/assets/file/file.sh.x > /tmp/unknown
file /tmp/unknown

【讨论】:

  • 那么有没有办法自动启动.sh.x文件或者.run文件呢?无论如何感谢您的警告,这是我的文件,我知道内容是什么。
猜你喜欢
  • 2017-04-21
  • 1970-01-01
  • 2011-05-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-10-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多