parent
45b2e15fcb
commit
00d59f5778
@ -0,0 +1,158 @@ |
||||
## LBot <https://github.com/knownsec/LBot> |
||||
<!--auto_detail_badge_begin_0b490ffb61b26b45de3ea5d7dd8a582e--> |
||||
![Language](https://img.shields.io/badge/Language-Python-blue) |
||||
![Author](https://img.shields.io/badge/Author-LoRexxar@knownsec404-orange) |
||||
![GitHub stars](https://img.shields.io/github/stars/knownsec/LBot.svg?style=flat&logo=github) |
||||
![Version](https://img.shields.io/badge/Version-V0.0.1-red) |
||||
![Time](https://img.shields.io/badge/Join-20200921-green) |
||||
<!--auto_detail_badge_end_fef74f2d7ea73fcc43ff78e05b1e7451--> |
||||
|
||||
|
||||
LBot的基础模型是脱胎于LSpider诞生的多线程任务调度模型。 |
||||
|
||||
主要是用于方便的写一个xss的bot程序。 |
||||
|
||||
使用者可以简单的修改其逻辑以及配置环境,即可获得一个简单的xss的bot程序。由于原型来自于爬虫程序,所以只要前端有一定的频率限制,后端很难出现问题,比较稳定。 |
||||
|
||||
# install |
||||
|
||||
## 下载Lbot |
||||
|
||||
``` |
||||
git clone https://github.com/knownsec/LBot.git |
||||
``` |
||||
|
||||
## 修改配置文件 |
||||
|
||||
``` |
||||
cp LBot/settings.py.bak LBot/settings.py |
||||
``` |
||||
|
||||
并配置其中相关的mysql配置 |
||||
|
||||
``` |
||||
DATABASES = { |
||||
'default': { |
||||
'ENGINE': 'django.db.backends.mysql', |
||||
'NAME': 'disable', |
||||
'USER': 'root', |
||||
'PASSWORD': '', |
||||
'HOST': '127.0.0.1', |
||||
'PORT': '3306', |
||||
'OPTIONS': { |
||||
'init_command': 'SET default_storage_engine=INNODB;SET NAMES utf8mb4', |
||||
'charset': 'utf8mb4', |
||||
}, |
||||
'TEST': { |
||||
'CHARSET': 'utf8', |
||||
'COLLATION': 'utf8_general_ci', |
||||
}, |
||||
} |
||||
} |
||||
``` |
||||
## 配置环境 |
||||
|
||||
``` |
||||
python3 -m pip install django |
||||
``` |
||||
|
||||
如果mysqlclient无法安装,还需要提前安装 |
||||
|
||||
``` |
||||
sudo apt-get install libmysqlclient-dev |
||||
``` |
||||
|
||||
## 同步数据库配置 |
||||
|
||||
``` |
||||
python3 manage.py makemigrations |
||||
python3 manage.py migrate |
||||
``` |
||||
|
||||
## 配置chrome headless |
||||
|
||||
``` |
||||
sudo wget http://www.linuxidc.com/files/repo/google-chrome.list -P /etc/apt/sources.list.d/ |
||||
|
||||
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - |
||||
|
||||
sudo apt-get update |
||||
|
||||
sudo apt-get install google-chrome-stable |
||||
``` |
||||
|
||||
看一下chrome的版本 |
||||
|
||||
```bash |
||||
lorexxar@instance-1:~/lorexxar/lspider/LSpider$ google-chrome --version |
||||
Google Chrome 81.0.4044.138 |
||||
``` |
||||
|
||||
去官网下载对应版本的webdriver放在bin目录下 |
||||
|
||||
``` |
||||
https://chromedriver.chromium.org/downloads |
||||
``` |
||||
|
||||
修改名字 |
||||
```bash |
||||
mv bin/chromedriver bin/chromedriver_linux64 |
||||
|
||||
``` |
||||
|
||||
## 针对守护的xss题目魔改bot程序 |
||||
|
||||
主流的xss bot守护方式一共有两种,一种是依靠cookie或者ip限制bot访问,另一种是通过登录账号模拟管理员的bot。 |
||||
|
||||
``` |
||||
# Bot admin pass |
||||
CTF_BACK_USER = 'admin' |
||||
CTF_BACK_PASS = 'adminsecretpass' |
||||
CTF_BACK_COOKIE = "s3cr3t_k3y_f0r_4dmin" |
||||
``` |
||||
|
||||
如果是依赖cookie的需要设置HOME_PAGE |
||||
``` |
||||
# homepage |
||||
|
||||
HOME_PAGE = "http://127.0.0.1/index.php" |
||||
``` |
||||
|
||||
核心bot部分主要在`Botend\views.py` function `LBotCore` |
||||
|
||||
``` |
||||
reportt = ReportTask.objects.filter(aread=0).first() |
||||
|
||||
if not reportt: |
||||
continue |
||||
|
||||
# 任务锁 |
||||
reportt.aread = 1 |
||||
reportt.save() |
||||
|
||||
# cookie 方式 |
||||
report_url = reportt.url |
||||
cookies = "admin="+CTF_BACK_COOKIE |
||||
|
||||
self.req = LReq(is_chrome=True) |
||||
|
||||
# 访问目标 |
||||
self.req.get(report_url, 'RespByChrome', 0, cookies) |
||||
|
||||
``` |
||||
|
||||
|
||||
# usage |
||||
|
||||
``` |
||||
python3 manage.py LBotCoreBackend |
||||
``` |
||||
|
||||
|
||||
<!--auto_detail_active_begin_e1c6fb434b6f0baf6912c7a1934f772b--> |
||||
## 项目相关 |
||||
|
||||
|
||||
## 最近更新 |
||||
|
||||
<!--auto_detail_active_end_f9cf7911015e9913b7e691a7a5878527--> |
@ -0,0 +1,155 @@ |
||||
## PortForward <https://github.com/knownsec/PortForward> |
||||
<!--auto_detail_badge_begin_0b490ffb61b26b45de3ea5d7dd8a582e--> |
||||
![Language](https://img.shields.io/badge/Language-Golang-blue) |
||||
![Author](https://img.shields.io/badge/Author-knownsec404-orange) |
||||
![GitHub stars](https://img.shields.io/github/stars/knownsec/PortForward.svg?style=flat&logo=github) |
||||
![Version](https://img.shields.io/badge/Version-V0.5.0-red) |
||||
![Time](https://img.shields.io/badge/Join-20201022-green) |
||||
<!--auto_detail_badge_end_fef74f2d7ea73fcc43ff78e05b1e7451--> |
||||
|
||||
|
||||
## 0x00 前言 |
||||
`PortForward` 是使用 Golang 进行开发的端口转发工具,解决在某些场景下 `内外网无法互通`的问题。 |
||||
|
||||
`PortForward` 的功能如下: |
||||
|
||||
1. 支持 tcp/udp 协议层的端口转发 |
||||
2. 支持级联 |
||||
3. 支持正向/反向连接模式 |
||||
4. 支持多通道 |
||||
5. 支持 ipv6 |
||||
|
||||
本文对 `PortForward` 进行了详细的介绍。 |
||||
|
||||
目录: |
||||
|
||||
1. 使用说明 |
||||
2. 工作场景 |
||||
3. 源码结构 |
||||
4. 逻辑结构 |
||||
5. 端口转发的实现 |
||||
6. udp的knock报文 |
||||
7. udp的超时设置 |
||||
8. listen-listen的超时设置 |
||||
9. 多通路的实现 |
||||
10. issue |
||||
11. contributions |
||||
|
||||
## 0x01 使用说明 |
||||
**1.使用** |
||||
|
||||
Usage: |
||||
./portforward [proto] [sock1] [sock2] |
||||
Option: |
||||
proto the port forward with protocol(tcp/udp) |
||||
sock format: [method:address:port] |
||||
method the sock mode(listen/conn) |
||||
Example: |
||||
tcp conn:192.168.1.1:3389 conn:192.168.1.10:23333 |
||||
udp listen:192.168.1.3:5353 conn:8.8.8.8:53 |
||||
tcp listen:[fe80::1%lo0]:8888 conn:[fe80::1%lo0]:7777 |
||||
|
||||
version: 0.5.0(build-20201022) |
||||
|
||||
**2.编译** |
||||
|
||||
Golang 1.12及以上 |
||||
GO111MODULE=on |
||||
|
||||
git clone https://github.com/knownsec/Portforward.git |
||||
./build.sh |
||||
|
||||
|
||||
## 0x02 工作场景 |
||||
这里列举了一些 `PortForward` 的工作场景,如下: |
||||
|
||||
**2.1 简单模式** |
||||
<div align="center"> |
||||
<img src="https://github.com/knownsec/PortForward/raw/master/Images/simple_forward.png" width="500"> |
||||
</br>[图1.简单转发模式] |
||||
</div> |
||||
|
||||
**2.2 受限主机转发** |
||||
<div align="center"> |
||||
<img src="https://github.com/knownsec/PortForward/raw/master/Images/restricted_forward.png" width="500"> |
||||
</br>[图2.受限主机转发模式图] |
||||
</div> |
||||
|
||||
**2.3 级联端口转发** |
||||
<div align="center"> |
||||
<img src="https://github.com/knownsec/PortForward/raw/master/Images/mutil_forward.png" width="500"> |
||||
</br>[图3.级联端口转发] |
||||
</div> |
||||
|
||||
|
||||
## 0x03 源码结构 |
||||
|
||||
. |
||||
├── CHANGELOG |
||||
├── Images // images resource |
||||
├── README.md |
||||
├── build.sh // compile script |
||||
├── forward.go // portforward main logic |
||||
├── go.mod |
||||
├── log.go // log module |
||||
├── main.go // main, parse arguments |
||||
├── tcp.go // tcp layer |
||||
└── udp.go // udp layer |
||||
|
||||
|
||||
## 0x04 逻辑结构 |
||||
`PortForward` 支持 `TCP` , `UDP` 协议层的端口转发,代码抽象后逻辑结构框架如下: |
||||
<div align="center"> |
||||
<img src="https://github.com/knownsec/PortForward/raw/master/Images/portforward_framework.png" width="500"> |
||||
</br>[图4.整体框架] |
||||
</div> |
||||
|
||||
|
||||
## 0x05 端口转发的实现 |
||||
端口转发程序作为网络传输的中间人,无非就是将两端的 socket 对象进行联通,数据就可以通过这条「链路」进行传输了。 |
||||
|
||||
按照这样的思路,我们从需求开始分析和抽象,可以这么认为:无论是作为 `tcp` 还是 `udp` 运行,无论是作为 `connect` 还是 `listen` 运行,最终都将获得两个 socket,其中一个连向原服务,另一个与客户端连接;最终将这两端的 socket 联通即可实现端口转发。 |
||||
|
||||
在 Golang 中我们采用了 `io.Copy()` 来联通两个 socket,但是 `io.Copy` 必须要求对象实现了 `io.Reader/io.Writer` 接口,`tcp` 的 socket 可以直接支持,而 `udp` 的 socket 需要我们进行封装。 |
||||
|
||||
|
||||
## 0x06 udp的knock报文 |
||||
在 `udp` 的 `connect` 模式下,我们在连接服务器成功后,立即发送了一个 `knock` 报文,如下: |
||||
|
||||
conn, err := net.DialTimeout("udp", ... |
||||
_, err = conn.Write([]byte("\x00")) |
||||
|
||||
其作用是通知远程 `udp` 服务器我们已经连上了(`udp` 创建连接后,仅在本地操作系统层进行了注册,只有当发送一个报文到对端后,远程服务器才能感知到新连接),当我们在 `udp` 的 `conn-conn` 模式下运行时,这个报文是必须的。 |
||||
|
||||
|
||||
## 0x07 udp的超时设置 |
||||
在 `udp` 的实现中,我们为所有的 `udp` 连接 socket 对象都设置了超时时间(`tcp` 中不需要),这是因为在 `udp` 中,socket 对象无法感知对端退出,如果不设置超时时间,将会一直在 `conn.Read()` 阻塞下去。 |
||||
|
||||
我们设置了 `udp` 超时时间为 60 秒,当 60 秒无数据传输,本次建立的虚拟通信链路将销毁,端口转发程序将重新创建新的通信链路。 |
||||
|
||||
|
||||
## 0x08 listen-listen的超时设置 |
||||
对于 `listen-listen` 模式,需要等待两端的客户端都连上端口转发程序后,才能将两个 socket 进行联通。 |
||||
|
||||
为此我们在此处设置了 120 秒的超时时间,也就是说当其中一端有客户端连接后,另一端在 120 秒内没有连接,我们就销毁这个未成功建立的通信链路;用户重新连接即可。 |
||||
|
||||
>如果没有这个超时,可能某些场景遗留了某个连接,将造成后续的通信链路错位。 |
||||
|
||||
|
||||
## 0x09 多通路的实现 |
||||
多通路可以支持同时发起多个连接,这里我们以 `tcp` 作为例子来说明。为了处理这种情况,我们的处理方式是: |
||||
|
||||
1. `listen-conn`: 每当 listen 服务器接收到新连接后,与远端创建新的连接,并将两个 socket 进行联通。 |
||||
2. `listen-listen`: (好像没有实际场景)两端的 listen 服务器接收到新连接后,将两个 socket 进行联通。 |
||||
3. `conn-conn`: 创建 sock1 的连接,当 sock1 端收到数据,创建与 sock2 的连接,将两个 socket 进行联通;随后继续创建 sock1 连接(预留)。 |
||||
|
||||
>我们在 `udp` 中也加入了多通路的支持,和 `tcp` 基本类似,但由于 `udp` 是无连接的,我们不能像 `tcp` 直接联通两个 socket 对象。我们在 `udp listen` 服务器中维护了一个临时表,使用 `ip:port` 作为标志,以描述各个通信链路的联通情况,依据此进行流量的分发。 |
||||
|
||||
|
||||
<!--auto_detail_active_begin_e1c6fb434b6f0baf6912c7a1934f772b--> |
||||
## 项目相关 |
||||
|
||||
|
||||
## 最近更新 |
||||
|
||||
<!--auto_detail_active_end_f9cf7911015e9913b7e691a7a5878527--> |
@ -0,0 +1,139 @@ |
||||
## shellcodeloader <https://github.com/knownsec/shellcodeloader> |
||||
<!--auto_detail_badge_begin_0b490ffb61b26b45de3ea5d7dd8a582e--> |
||||
![Language](https://img.shields.io/badge/Language-C++-blue) |
||||
![Author](https://img.shields.io/badge/Author-m0ngo0se@knownsec404-orange) |
||||
![GitHub stars](https://img.shields.io/github/stars/knownsec/shellcodeloader.svg?style=flat&logo=github) |
||||
![Version](https://img.shields.io/badge/Version-V1.1-red) |
||||
![Time](https://img.shields.io/badge/Join-20201125-green) |
||||
<!--auto_detail_badge_end_fef74f2d7ea73fcc43ff78e05b1e7451--> |
||||
|
||||
|
||||
# ShellcodeLoader |
||||
|
||||
Language: [English](https://github.com/knownsec/shellcodeloader/blob/master/Readme.md) |
||||
|
||||
Windows平台的shellcode免杀加载器。 |
||||
|
||||
## 功能特点 |
||||
|
||||
1. 自带多种加载方式。32位自带13种加载方式,64位自带12种加载方式。 |
||||
|
||||
2. 支持拓展。如果发现新的利用方式,按指定方式开发模板即可。 |
||||
|
||||
3. shellcode自动随机加密。使用时间为种子,生成128位密钥进行加密,相同shellcode出来的加载器的md5也不相同。 |
||||
|
||||
|
||||
|
||||
## 编译环境和方法 |
||||
|
||||
环境:生成器使用MFC实现UI,生成器和加载器模板均使用C++开发,VS2015静态编译。 |
||||
|
||||
方法:使用VS2015打开项目的解决方案(.sln),再进行编译即可。你也可以从[realse](https://github.com/knownsec/shellcodeloader/releases/)下载成品。 |
||||
|
||||
|
||||
|
||||
## 文件组成 |
||||
|
||||
本工具由生成器(shellcodeLoader.exe),和众多加载器模板组成。不同的加载器模板需放入对应位数的目录。并最终放入生成器同目录下的DATA目录。 |
||||
|
||||
<img src="https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/image-20201124160121278.png" alt="image-20201124160121278" style="zoom:80%;" /> |
||||
|
||||
|
||||
## 使用方法 |
||||
|
||||
1. **打开生成器** |
||||
|
||||
![image-20201124160202106](https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/image-20201124160202106.png) |
||||
|
||||
|
||||
|
||||
2. **将想要加载的shellcode源文件(.bin)拖入该窗口** |
||||
|
||||
![image-20201124160330548](https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/image-20201124160330548.png) |
||||
|
||||
|
||||
|
||||
3. **勾选加载器的运行位数,并选择你需要的配置选项,是否需要自启动(自带方式皆为注册表方式自启动),是否需要反沙箱(64位下多数杀软不需要该选项即可免杀)** |
||||
|
||||
|
||||
|
||||
4. **选择你想要的加载方式,不同位数下的加载方式会有不同,其取决于DATA目录下对应的加载器模板。** |
||||
|
||||
![image-20201124160839607](https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/image-20201124160839607.png) |
||||
|
||||
|
||||
|
||||
5. **点击生成,则会在桌面生成最终的加载器。** |
||||
|
||||
![image-20201124161035698](https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/image-20201124161035698.png) |
||||
|
||||
## 拓展方法 |
||||
|
||||
1. 在你新的模板源文件前包含public.hpp. |
||||
|
||||
|
||||
|
||||
2. 调用GetShellcodeFromRes()函数获取shellcode信息,注意100不可更改,除非你改了生成器中的资源序号。 |
||||
|
||||
![image-20201124162327193](https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/image-20201124162327193.png) |
||||
|
||||
其返回shellcode的数据指针,并且,shellcodeSize就是shellcode的大小。多数情况下,这一步是不需要进行更改的,你可以在获取shellcode之后做任何事。 |
||||
|
||||
|
||||
|
||||
3. 按照你需要的方法加载shellcode,完成后进行编译(PS:请确保你进行了静态编译,且取消了调试符号链接). |
||||
|
||||
![image-20201124162721783](https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/image-20201124162721783.png) |
||||
|
||||
|
||||
|
||||
4. 将编译出来的文件进行指定命名,这里的命名就是UI上最终现实的加载方式名称,并将其后缀改为DAT,放入指DATA目录下指定位数的目录中,生成器会自动获取该加载方式。 |
||||
|
||||
![image-20201124162912373](https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/image-20201124162912373.png) |
||||
|
||||
|
||||
|
||||
### 关于public.hpp |
||||
|
||||
public.hpp源码中含有必要的注释。如果你想要其他的方式进行反沙箱,你可以更改antisandbox中的函数;如果你想要其他方式自启动,你可以更改autostart函数中的内容。其他函数体的内容多数情况下是不需要更改的。 |
||||
|
||||
|
||||
|
||||
## 使用效果 |
||||
|
||||
VT检测效果,均以CS原始shellcode,并不勾选反沙箱为例: |
||||
|
||||
| 加载方式 | 未绕过率 | |
||||
| ------------------------ | -------- | |
||||
| CreateThreadpoolWait加载 | 3/72 | |
||||
| Fiber加载 | 4/72 | |
||||
| NtTestAlert加载 | 5/70 | |
||||
| SEH异常加载 | 2/72 | |
||||
| TLS回调加载 | 28/71 | |
||||
| 动态加载 | 1/72 | |
||||
| 动态加载plus | 28/71 | |
||||
| 系统call加载 | 1/69 | |
||||
| APC注入加载 | 6/72 | |
||||
| Early Brid APC注入加载 | 4/72 | |
||||
| NtCreateSection注入加载 | 2/71 | |
||||
| 入口点劫持注入加载 | 3/72 | |
||||
| 线程劫持注入加载 | 6/72 | |
||||
|
||||
在动态加载方式勾选反沙箱之后,结果如下: |
||||
|
||||
![1fef278889c961331a185698c35d220](https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/1fef278889c961331a185698c35d220.png) |
||||
|
||||
|
||||
|
||||
使用该加载器bypass诺顿的智能防火墙出网拦截,并上线: |
||||
|
||||
![image-20201124163815942](https://github.com/knownsec/shellcodeloader/raw/master/Readme.assets/image-20201124163815942.png) |
||||
|
||||
|
||||
<!--auto_detail_active_begin_e1c6fb434b6f0baf6912c7a1934f772b--> |
||||
## 项目相关 |
||||
|
||||
|
||||
## 最近更新 |
||||
|
||||
<!--auto_detail_active_end_f9cf7911015e9913b7e691a7a5878527--> |
@ -0,0 +1,82 @@ |
||||
## wam <https://github.com/knownsec/wam> |
||||
<!--auto_detail_badge_begin_0b490ffb61b26b45de3ea5d7dd8a582e--> |
||||
![Language](https://img.shields.io/badge/Language-Python-blue) |
||||
![Author](https://img.shields.io/badge/Author-knownsec404-orange) |
||||
![GitHub stars](https://img.shields.io/github/stars/knownsec/wam.svg?style=flat&logo=github) |
||||
![Version](https://img.shields.io/badge/Version-V1.0-red) |
||||
![Time](https://img.shields.io/badge/Join-20200821-green) |
||||
<!--auto_detail_badge_end_fef74f2d7ea73fcc43ff78e05b1e7451--> |
||||
|
||||
|
||||
### Introduction |
||||
|
||||
WAM is a platform powered by Python to monitor "Web App", "The dynamic network information". To a certain extent, it greatly help the security researchers save time on tracking the vulnerable code updates and industry dynamics of investment. |
||||
|
||||
- AM Model: This module can monitor every updates on all of apps on internet, analysising the changes to make Tag and provide mail notification; |
||||
|
||||
- IDM Model: This module uses Web crawler to fetch the industry dynamic information and report that to users; |
||||
|
||||
- VDR Model: This module manager all of application package in the history, and save the updated version of which DIFF details; |
||||
|
||||
### Development |
||||
- Lang: Python 2.7 |
||||
- Framewrok: Django 1.7.11 |
||||
- UI: [Semantic-ui](http://www.semantic-ui.com/) |
||||
- Database: Mysql |
||||
|
||||
### Models |
||||
|
||||
- AM (App Monitoring) |
||||
- IDM (Information Dynamic Monitoring) |
||||
- VDR (The Relationship Between Vulnerability And Database) |
||||
|
||||
#### App Monitoring |
||||
|
||||
#### Information Dynamic Monitoring |
||||
|
||||
#### The Relationship Between Vulnerability And Database |
||||
|
||||
--- |
||||
### How to Use |
||||
--- |
||||
#### Step 1. Get WAM source code |
||||
`git clone https://github.com/knownsec/wam.git` |
||||
|
||||
#### Step 2. Update settings |
||||
update email server and user settings |
||||
**TODO settings with dabase Storage** |
||||
* `monitor/utils/local_settings.py` |
||||
* `monitor/utils/email_list.py` |
||||
|
||||
#### Step 3. Deploy to server |
||||
* **nginx** |
||||
* **uwsgi** |
||||
* **supervisor** |
||||
|
||||
Just use `wam/conf` config files to deploy your wam code |
||||
|
||||
#### PS. WAM with LDAP auth |
||||
|
||||
Essentially, need to ensure you have the necessary development libraries installed: |
||||
|
||||
`apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev` |
||||
|
||||
then `pip install python-ldap` |
||||
and uncomment `wam/settings.py` |
||||
`AUTHENTICATION_BACKENDS` to |
||||
|
||||
```` |
||||
AUTHENTICATION_BACKENDS = ( |
||||
'wam.ldap_backend.LDAPBackend', # 如果想使LDAP 认证取消注释 |
||||
'django.contrib.auth.backends.ModelBackend', |
||||
) |
||||
```` |
||||
|
||||
|
||||
<!--auto_detail_active_begin_e1c6fb434b6f0baf6912c7a1934f772b--> |
||||
## 项目相关 |
||||
|
||||
|
||||
## 最近更新 |
||||
|
||||
<!--auto_detail_active_end_f9cf7911015e9913b7e691a7a5878527--> |
Loading…
Reference in new issue