mirror of
https://github.com/CHN-beta/xmurp-ua.git
synced 2026-01-11 01:09:25 +08:00
增加mark匹配警告 完善模块协议等信息
This commit is contained in:
2
Makefile
2
Makefile
@@ -2,7 +2,7 @@ include $(TOPDIR)/rules.mk
|
|||||||
include $(INCLUDE_DIR)/kernel.mk
|
include $(INCLUDE_DIR)/kernel.mk
|
||||||
|
|
||||||
PKG_NAME:=xmurp-ua
|
PKG_NAME:=xmurp-ua
|
||||||
PKG_RELEASE:=23
|
PKG_RELEASE:=27
|
||||||
|
|
||||||
include $(INCLUDE_DIR)/package.mk
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
|
||||||
|
|||||||
@@ -148,6 +148,7 @@ unsigned int hook_funcion(void *priv, struct sk_buff *skb, const struct nf_hook_
|
|||||||
static u_int16_t sport, dport;
|
static u_int16_t sport, dport;
|
||||||
|
|
||||||
static u_int32_t n_ua_modified = 0, n_ua_modify_faild = 0;
|
static u_int32_t n_ua_modified = 0, n_ua_modify_faild = 0;
|
||||||
|
static u_int8_t mark_matched = 0;
|
||||||
|
|
||||||
register u_int8_t jump_to_next_function = 0, ret;
|
register u_int8_t jump_to_next_function = 0, ret;
|
||||||
|
|
||||||
@@ -167,7 +168,16 @@ unsigned int hook_funcion(void *priv, struct sk_buff *skb, const struct nf_hook_
|
|||||||
if(data_end - data_start < 4)
|
if(data_end - data_start < 4)
|
||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
if(skb->mark & 0x100)
|
if(skb->mark & 0x100)
|
||||||
|
{
|
||||||
|
if(!mark_matched)
|
||||||
|
{
|
||||||
|
mark_matched = 1;
|
||||||
|
printk("xmurp-ua: Mark matched. Note that all packages with the mark will be ACCEPT without modify.\n");
|
||||||
|
printk("xmurp-ua: If the mark is not set manually, it maybe a conflict there. "
|
||||||
|
"Find out which app is using the desired bit and let it use others, or modify and recompile me.\n");
|
||||||
|
}
|
||||||
return NF_ACCEPT;
|
return NF_ACCEPT;
|
||||||
|
}
|
||||||
|
|
||||||
// 决定是否发送到下一层
|
// 决定是否发送到下一层
|
||||||
if(catch_next_frag && iph->saddr == saddr && iph->daddr == daddr &&
|
if(catch_next_frag && iph->saddr == saddr && iph->daddr == daddr &&
|
||||||
@@ -209,7 +219,7 @@ unsigned int hook_funcion(void *priv, struct sk_buff *skb, const struct nf_hook_
|
|||||||
{
|
{
|
||||||
n_ua_modified++;
|
n_ua_modified++;
|
||||||
if(n_ua_modified % 0x10000 == 0)
|
if(n_ua_modified % 0x10000 == 0)
|
||||||
printk("xmurp-ua: successfully modified %d packages, faild to modify %d packages.",
|
printk("xmurp-ua: Successfully modified %d packages, faild to modify %d packages.\n",
|
||||||
n_ua_modified, n_ua_modify_faild);
|
n_ua_modified, n_ua_modify_faild);
|
||||||
tcph->check = 0;
|
tcph->check = 0;
|
||||||
iph->check = 0;
|
iph->check = 0;
|
||||||
@@ -234,8 +244,8 @@ static int __init hook_init(void)
|
|||||||
#else
|
#else
|
||||||
ret = nf_register_hook(&nfho);
|
ret = nf_register_hook(&nfho);
|
||||||
#endif
|
#endif
|
||||||
printk("xmurp-ua start\n");
|
printk("xmurp-ua: Started.\n");
|
||||||
printk("nf_register_hook returnd %d\n", ret);
|
printk("xmurp-ua: nf_register_hook returnd %d.\n", ret);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -248,8 +258,12 @@ static void __exit hook_exit(void)
|
|||||||
#else
|
#else
|
||||||
nf_unregister_hook(&nfho);
|
nf_unregister_hook(&nfho);
|
||||||
#endif
|
#endif
|
||||||
printk("xmurp-ua stop\n");
|
printk("xmurp-ua: Stopped.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(hook_init);
|
module_init(hook_init);
|
||||||
module_exit(hook_exit);
|
module_exit(hook_exit);
|
||||||
|
|
||||||
|
MODULE_AUTHOR("Haonan Chen");
|
||||||
|
MODULE_DESCRIPTION("Modify UA in HTTP for anti-detection of router in XMU.");
|
||||||
|
MODULE_LICENSE("GPL");
|
||||||
Reference in New Issue
Block a user