75 lines
2.7 KiB
Markdown
75 lines
2.7 KiB
Markdown
# 特定内容推送插件开发
|
||
|
||
| ID | Creation Date | Assignee | Status |
|
||
|----|----------------|----------|--------|
|
||
| OMPUB-740 | 2022-12-07T11:13:49.000+0800 | 冯伟浩 | 完成 |
|
||
|
||
|
||
---
|
||
|
||
对于命中代理策略条件的HTTP(S)流量调用LUA插件,插件向当前数据发起方(例如命中数据包方向为C2S,则插件向C端推送内容)推送用户预定义的html文件(用户提供html文件,文件中包含http header和http body),并对应答内容中特定字符串进行替换,具体替换规则如下:
|
||
* TTTIIIMMM:LUA脚本获取当前服务器时间,以HTTP协议date格式替换;
|
||
* LLLEEENNN:LUA脚本获取当前应答内容长度,以HTTP协议content_length格式替换;
|
||
* UUURRRIII:LUA脚本按照算法计算随机字符串。每次流量命中后,实时计算替换;
|
||
!screenshot-1.png|thumbnail!
|
||
* UUURRRLLL:用户配置的下载服务器地址,LUA脚本直接替换即可
|
||
用户如何在LUA插件中进行配置:目前暂定将以上两类配置信息直接填充到LUA脚本中,具体格式研发可以提出统一要求。
|
||
|
||
**liuyang** commented on *2022-12-07T11:17:34.846+0800*:
|
||
|
||
关于随机字符串简单说明:
|
||
* 8位随机字符串:8个数字,例如12345678
|
||
* 源IP:主机序
|
||
* 数字加:加法求和
|
||
* 转换字符串:从右向左取8位;比如0123456789,则取23456789八个字符
|
||
* Pri-key:固定字符串,直接拼接
|
||
* Md5:md5sum()计算
|
||
|
||
|
||
|
||
|
||
---
|
||
|
||
**gitlab** commented on *2022-12-19T14:43:25.552+0800*:
|
||
|
||
[冯伟浩|https://git.mesalab.cn/fengweihao] mentioned this issue in [a commit|https://git.mesalab.cn/tango/tfe/-/commit/34be0889e15a77ab157f0f4f888f691e06062424] of [TSG Appliance / tfe|https://git.mesalab.cn/tango/tfe] on branch [feature-OMPUB-740|https://git.mesalab.cn/tango/tfe/-/tree/feature-OMPUB-740]:{quote}OMPUB-740 Lua插件支持获取五元组和重写HTTP头信息{quote}
|
||
|
||
|
||
|
||
---
|
||
|
||
**liuyang** commented on *2022-12-21T17:29:24.730+0800*:
|
||
|
||
随机字符串联调说明:
|
||
联调服务器ip:43.156.12.49;登陆方式:root/z!PQ&p$X@Mux
|
||
构造GET请求: http://ip/随机串/test.html
|
||
能够成功获取test.html表示随机字符串校验通过。
|
||
若无法获取文件,则可登陆服务器查看错误日志:/var/www;随机串校验脚本和error.log在/var/www/html
|
||
|
||
|
||
|
||
---
|
||
|
||
|
||
|
||
# Attachments
|
||
|
||
Attachment: http_resp_filter_by_lua.lua
|
||
|
||
[http_resp_filter_by_lua.lua](https://gfwleak.exec.li/admin/geedge-jira/raw/branch/master/attachment/66375/http_resp_filter_by_lua.lua)
|
||
|
||
|
||
|
||
Attachment: screenshot-1.png
|
||
|
||

|
||
|
||
|
||
|
||
Attachment: screenshot-2.png
|
||
|
||

|
||
|
||
|
||
|