Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fuzzBackEnd
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钱炳权
fuzzBackEnd
Commits
9cfe5d97
Commit
9cfe5d97
authored
Mar 28, 2024
by
钱炳权
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
24/3/28 生成方法、变异方法接入成功并能成功输出至窗口
parent
287f71df
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
423 additions
and
57 deletions
+423
-57
spring.log
fuzzbackend/log/spring.log
+0
-0
pom.xml
fuzzbackend/pom.xml
+6
-1
SpringContextUtil.java
...java/com/example/fuzzControll/conf/SpringContextUtil.java
+4
-44
kittyProperties.java
...n/java/com/example/fuzzControll/conf/kittyProperties.java
+36
-0
protocolConstent.java
.../com/example/fuzzControll/constents/protocolConstent.java
+13
-0
generateMethodController.java
...ple/fuzzControll/controller/generateMethodController.java
+28
-0
protocolTemplatController.java
...le/fuzzControll/controller/protocolTemplatController.java
+31
-0
testControler.java
...va/com/example/fuzzControll/controller/testControler.java
+1
-0
vulnerabilityTypeController.java
.../fuzzControll/controller/vulnerabilityTypeController.java
+10
-0
generateMethodEntity.java
...om/example/fuzzControll/pojo/vo/generateMethodEntity.java
+13
-0
protocolGenerationEntity.java
...xample/fuzzControll/pojo/vo/protocolGenerationEntity.java
+15
-0
generateMethodService.java
...m/example/fuzzControll/service/generateMethodService.java
+8
-0
generateMethodServiceImpl.java
.../fuzzControll/service/impl/generateMethodServiceImpl.java
+53
-0
protocolTemplateImpl.java
...ample/fuzzControll/service/impl/protocolTemplateImpl.java
+147
-0
protocolTemplateService.java
...example/fuzzControll/service/protocolTemplateService.java
+10
-0
cmdTools.java
...rc/main/java/com/example/fuzzControll/tools/cmdTools.java
+0
-0
application-dev.yml
fuzzbackend/src/main/resources/application-dev.yml
+5
-0
log4j.properties
fuzzbackend/src/main/resources/log4j.properties
+41
-0
result.html
fuzzbackend/src/main/resources/result.html
+2
-12
No files found.
fuzzbackend/log/spring.log
View file @
9cfe5d97
This diff is collapsed.
Click to expand it.
fuzzbackend/pom.xml
View file @
9cfe5d97
...
...
@@ -58,7 +58,12 @@
<artifactId>
spring-boot-starter-websocket
</artifactId>
<version>
2.7.2
</version>
</dependency>
<!-- log4j - slf4j 日志依赖 结束-->
<dependency>
<groupId>
com.fasterxml.uuid
</groupId>
<artifactId>
java-uuid-generator
</artifactId>
<version>
3.1.5
</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
...
...
fuzzbackend/src/main/java/com/example/fuzzControll/conf/SpringContextUtil.java
View file @
9cfe5d97
...
...
@@ -25,31 +25,11 @@ import org.springframework.stereotype.Component;
public
class
SpringContextUtil
implements
ApplicationContextAware
{
private
static
ApplicationContext
applicationContext
;
/********************************************************************
* 函数名称: SpringContextUtil//函数名称
* 功能描述: SpringContextUtil构造函数//函数功能、性能等的描述
* 输入参数: 无//输入参数说明,包括每个参数的作用、取值说明及参数间关系
* 输出参数: 无//对输出参数的说明
* 返 回 值: 无//函数返回值的说明
* 其它说明: 无//其它说明
* 修改日期 版本号 修改人 修改内容
*--------------------------------------------------------------------
* 2023/01/30 v1.00.00 xoxxox xoxxox
********************************************************************/
public
SpringContextUtil
()
{
}
/********************************************************************
* 函数名称: setApplicationContext//函数名称
* 功能描述: 设置Application上下文//函数功能、性能等的描述
* 输入参数: 无//输入参数说明,包括每个参数的作用、取值说明及参数间关系
* 输出参数: 无//对输出参数的说明
* 返 回 值: 无//函数返回值的说明
* 其它说明: 无//其它说明
* 修改日期 版本号 修改人 修改内容
*--------------------------------------------------------------------
* 2023/01/30 v1.00.00 xoxxox xoxxox
********************************************************************/
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
if
(
SpringContextUtil
.
applicationContext
==
null
)
{
...
...
@@ -58,32 +38,12 @@ public class SpringContextUtil implements ApplicationContextAware {
}
/********************************************************************
* 函数名称: getBean//函数名称
* 功能描述: 跟据bean名称获取bean//函数功能、性能等的描述
* 输入参数: name是bean名称//输入参数说明,包括每个参数的作用、取值说明及参数间关系
* 输出参数: 无//对输出参数的说明
* 返 回 值: Object//函数返回值的说明
* 其它说明: 无//其它说明
* 修改日期 版本号 修改人 修改内容
*--------------------------------------------------------------------
* 2023/01/30 v1.00.00 xoxxox xoxxox
********************************************************************/
public
static
Object
getBean
(
String
name
)
{
return
applicationContext
.
getBean
(
name
);
}
/********************************************************************
* 函数名称: getBean//函数名称
* 功能描述: 跟据bean类型获取bean//函数功能、性能等的描述
* 输入参数: 无//输入参数说明,包括每个参数的作用、取值说明及参数间关系
* 输出参数: 无//对输出参数的说明
* 返 回 值: 无//函数返回值的说明
* 其它说明: 无//其它说明
* 修改日期 版本号 修改人 修改内容
*--------------------------------------------------------------------
* 2023/01/30 v1.00.00 xoxxox xoxxox
********************************************************************/
public
static
Object
getBean
(
Class
<?>
requiredType
)
{
return
applicationContext
.
getBean
(
requiredType
);
}
...
...
fuzzbackend/src/main/java/com/example/fuzzControll/conf/kittyProperties.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
conf
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
@Component
(
"kittyProperties"
)
@ConfigurationProperties
(
prefix
=
"kitty"
)
public
class
kittyProperties
{
String
path
;
String
venvPath
;
String
methodPath
;
public
String
getPath
()
{
return
path
;
}
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
}
public
String
getVenvPath
()
{
return
venvPath
;
}
public
void
setVenvPath
(
String
venvPath
)
{
this
.
venvPath
=
venvPath
;
}
public
String
getMethodPath
()
{
return
methodPath
;
}
public
void
setMethodPath
(
String
methodPath
)
{
this
.
methodPath
=
methodPath
;
}
}
fuzzbackend/src/main/java/com/example/fuzzControll/constents/protocolConstent.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
constents
;
public
class
protocolConstent
{
public
static
final
String
RAW
=
"arp_raw.py "
;
public
static
final
String
BGP
=
"bgp_tcp.py "
;
public
static
final
String
DHCP
=
"dhcp_scapy.py "
;
public
static
final
String
DNS
=
"dns_scapy.py "
;
public
static
final
String
FRP
=
"frp_udp.py "
;
public
static
final
String
FTP
=
"ftp_raw.py "
;
public
static
final
String
HDLC
=
"hdlc_raw.py "
;
public
static
final
String
HTTP_DOS_QUMU
=
"http_dos_qemu.py "
;
//todo 还有一堆协议需要写
}
fuzzbackend/src/main/java/com/example/fuzzControll/controller/generateMethodController.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
controller
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.generateMethodEntity
;
import
com.example.fuzzControll.pojo.vo.protocolGenerationEntity
;
import
com.example.fuzzControll.service.generateMethodService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/generateMethod"
)
public
class
generateMethodController
{
@Autowired
generateMethodService
service
;
@RequestMapping
(
value
=
"/generate"
,
method
=
RequestMethod
.
POST
)
public
AjaxResult
upload
(
@RequestBody
generateMethodEntity
generateMethodEntity
)
{
try
{
service
.
generation
(
generateMethodEntity
);
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
"变异方法使用失败!"
);
}
return
AjaxResult
.
success
(
"变异方法生成成功!"
);
}
}
fuzzbackend/src/main/java/com/example/fuzzControll/controller/protocolTemplatController.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
controller
;
import
com.example.fuzzControll.pojo.vo.AjaxResult
;
import
com.example.fuzzControll.pojo.vo.protocolGenerationEntity
;
import
com.example.fuzzControll.service.protocolTemplateService
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.multipart.MultipartFile
;
@RestController
@RequestMapping
(
"/protocolTemplate"
)
public
class
protocolTemplatController
{
@Autowired
protocolTemplateService
protocolTemplateService
;
/**
* seeFileUpload
*/
@RequestMapping
(
value
=
"/generation"
,
method
=
RequestMethod
.
POST
)
public
AjaxResult
upload
(
@RequestBody
protocolGenerationEntity
protocolGeneration
)
{
try
{
protocolTemplateService
.
generation
(
protocolGeneration
);
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
"模板文件生成失败!"
);
}
return
AjaxResult
.
success
(
"模板文件生成成功!"
);
}
}
fuzzbackend/src/main/java/com/example/fuzzControll/controller/testControler.java
View file @
9cfe5d97
...
...
@@ -22,6 +22,7 @@ public class testControler {
public
AjaxResult
list
(
@RequestBody
cmdStartParams
cmdStartParams
)
{
try
{
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
service
.
testStart
(
cmdStartParams
);
}
...
...
fuzzbackend/src/main/java/com/example/fuzzControll/controller/vulnerabilityTypeController.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
controller
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"/vulnerabilityType"
)
public
class
vulnerabilityTypeController
{
}
fuzzbackend/src/main/java/com/example/fuzzControll/pojo/vo/generateMethodEntity.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
pojo
.
vo
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
@Data
@Setter
@Getter
public
class
generateMethodEntity
{
String
methodName
;
String
[]
paramJson
;
}
fuzzbackend/src/main/java/com/example/fuzzControll/pojo/vo/protocolGenerationEntity.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
pojo
.
vo
;
import
com.alibaba.fastjson.JSONObject
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
lombok.Data
;
import
lombok.Getter
;
import
lombok.Setter
;
@Data
@Getter
@Setter
public
class
protocolGenerationEntity
{
String
protocolName
;
String
[]
paramJson
;
}
fuzzbackend/src/main/java/com/example/fuzzControll/service/generateMethodService.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
service
;
import
com.example.fuzzControll.pojo.vo.generateMethodEntity
;
import
com.example.fuzzControll.pojo.vo.protocolGenerationEntity
;
public
interface
generateMethodService
{
void
generation
(
generateMethodEntity
generateMethodEntity
);
}
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/generateMethodServiceImpl.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.example.fuzzControll.conf.kittyProperties
;
import
com.example.fuzzControll.pojo.vo.generateMethodEntity
;
import
com.example.fuzzControll.pojo.vo.protocolGenerationEntity
;
import
com.example.fuzzControll.service.generateMethodService
;
import
com.example.fuzzControll.tools.cmdTools
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
@Service
@Slf4j
public
class
generateMethodServiceImpl
implements
generateMethodService
{
cmdTools
cmdTools
=
new
cmdTools
();
@Autowired
kittyProperties
kitty
;
@Override
public
void
generation
(
generateMethodEntity
generateMethodEntity
)
{
String
cmd
=
parseParameters
(
generateMethodEntity
);
cmdTools
.
runProgramCmdAndResultTofile
(
cmd
);
}
public
String
parseParameters
(
generateMethodEntity
generateMethodEntity
)
{
switch
(
generateMethodEntity
.
getMethodName
().
toLowerCase
())
{
case
"foreach"
:
return
foreachCmd
(
generateMethodEntity
);
default
:
log
.
error
(
"未知变异方法![{}]"
,
generateMethodEntity
.
getMethodName
());
return
null
;
}
}
private
String
foreachCmd
(
generateMethodEntity
generateMethodEntity
)
{
String
target_host
=
null
;
String
target_port
=
null
;
String
s1
=
null
;
String
s2
=
null
;
String
s3
=
null
;
try
{
target_host
=
generateMethodEntity
.
getParamJson
()[
0
];
target_port
=
generateMethodEntity
.
getParamJson
()[
1
];
s1
=
generateMethodEntity
.
getParamJson
()[
2
];
s2
=
generateMethodEntity
.
getParamJson
()[
3
];
s3
=
generateMethodEntity
.
getParamJson
()[
4
];
}
catch
(
Exception
e
)
{
log
.
error
(
"http_dos_qemu参数解析失败!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getMethodPath
()
+
"generate_method_test.py -f "
+
s1
+
" "
+
s2
+
" "
+
s3
+
" --host="
+
target_host
+
" --port="
+
target_port
;
}
//todo 还有很多生成方法
}
fuzzbackend/src/main/java/com/example/fuzzControll/service/impl/protocolTemplateImpl.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
service
.
impl
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.example.fuzzControll.conf.kittyProperties
;
import
com.example.fuzzControll.conf.seedProperties
;
import
com.example.fuzzControll.constents.protocolConstent
;
import
com.example.fuzzControll.pojo.vo.protocolGenerationEntity
;
import
com.example.fuzzControll.service.protocolTemplateService
;
import
com.example.fuzzControll.tools.cmdTools
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
@Slf4j
@Service
public
class
protocolTemplateImpl
implements
protocolTemplateService
{
cmdTools
cmdTools
=
new
cmdTools
();
@Autowired
kittyProperties
kitty
;
@Override
public
void
generation
(
protocolGenerationEntity
protocolGeneration
)
{
String
cmd
=
parseParameters
(
protocolGeneration
);
cmdTools
.
runProgramCmdAndResultTofile
(
cmd
);
}
public
String
parseParameters
(
protocolGenerationEntity
protocolGeneration
)
{
switch
(
protocolGeneration
.
getProtocolName
().
toLowerCase
())
{
case
"arp"
:
return
arpCmd
(
protocolGeneration
);
case
"bgp"
:
return
bgpCmd
(
protocolGeneration
);
case
"dhcp"
:
return
dhcpCmd
(
protocolGeneration
);
case
"dns"
:
return
dnsCmd
(
protocolGeneration
);
case
"frp"
:
return
frpCmd
(
protocolGeneration
);
case
"ftp"
:
return
ftpCmd
(
protocolGeneration
);
case
"hdlc"
:
return
hdlcCmd
(
protocolGeneration
);
case
"http_dos_qemu"
:
return
http_dos_qemuCmd
(
protocolGeneration
);
default
:
log
.
error
(
"未知协议![{}]"
,
protocolGeneration
.
getProtocolName
());
return
null
;
}
}
private
String
http_dos_qemuCmd
(
protocolGenerationEntity
protocolGeneration
)
{
String
dst_ip
=
null
;
String
port
=
null
;
try
{
dst_ip
=
protocolGeneration
.
getParamJson
()[
0
];
port
=
protocolGeneration
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"http_dos_qemu参数解析失败!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
protocolConstent
.
HTTP_DOS_QUMU
+
" -d "
+
dst_ip
+
" -p "
+
port
;
}
private
String
hdlcCmd
(
protocolGenerationEntity
protocolGeneration
)
{
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
protocolConstent
.
HDLC
;
}
private
String
ftpCmd
(
protocolGenerationEntity
protocolGeneration
)
{
String
target_host
=
null
;
String
target_port
=
null
;
try
{
target_host
=
protocolGeneration
.
getParamJson
()[
0
];
target_port
=
protocolGeneration
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"frp参数解析失败!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
protocolConstent
.
FTP
+
target_host
+
" "
+
target_port
;
}
private
String
frpCmd
(
protocolGenerationEntity
protocolGeneration
)
{
String
target_host
=
null
;
String
target_port
=
null
;
try
{
target_host
=
protocolGeneration
.
getParamJson
()[
0
];
target_port
=
protocolGeneration
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"frp参数解析失败!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
protocolConstent
.
FRP
+
target_host
+
" "
+
target_port
;
}
private
String
dnsCmd
(
protocolGenerationEntity
protocolGeneration
)
{
String
dst_ip
=
null
;
String
dst_port
=
null
;
try
{
dst_ip
=
protocolGeneration
.
getParamJson
()[
0
];
dst_port
=
protocolGeneration
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"dns参数解析失败!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
protocolConstent
.
DNS
+
dst_ip
+
" "
+
dst_port
;
}
private
String
dhcpCmd
(
protocolGenerationEntity
protocolGeneration
)
{
String
dst_ip
=
null
;
String
dst_port
=
null
;
try
{
dst_ip
=
protocolGeneration
.
getParamJson
()[
0
];
dst_port
=
protocolGeneration
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"dhcp参数解析失败!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
protocolConstent
.
DHCP
+
dst_ip
+
" "
+
dst_port
;
}
private
String
bgpCmd
(
protocolGenerationEntity
protocolGeneration
)
{
String
src_ip
=
null
;
String
src_port
=
null
;
String
dst_ip
=
null
;
String
dst_port
=
null
;
try
{
src_ip
=
protocolGeneration
.
getParamJson
()[
0
];
src_port
=
protocolGeneration
.
getParamJson
()[
1
];
dst_ip
=
protocolGeneration
.
getParamJson
()[
2
];
dst_port
=
protocolGeneration
.
getParamJson
()[
3
];
}
catch
(
Exception
e
)
{
log
.
error
(
"bgp参数解析失败!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
protocolConstent
.
BGP
+
src_ip
+
" "
+
src_port
+
" "
+
dst_ip
+
" "
+
dst_port
;
}
public
String
arpCmd
(
protocolGenerationEntity
protocolGeneration
)
{
String
dst_mac
=
null
;
String
src_mac
=
null
;
try
{
dst_mac
=
protocolGeneration
.
getParamJson
()[
0
];
src_mac
=
protocolGeneration
.
getParamJson
()[
1
];
}
catch
(
Exception
e
)
{
log
.
error
(
"arp参数解析失败!"
);
}
return
kitty
.
getVenvPath
()
+
" "
+
kitty
.
getPath
()
+
protocolConstent
.
RAW
+
dst_mac
+
" "
+
src_mac
;
}
}
fuzzbackend/src/main/java/com/example/fuzzControll/service/protocolTemplateService.java
0 → 100644
View file @
9cfe5d97
package
com
.
example
.
fuzzControll
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.example.fuzzControll.pojo.vo.protocolGenerationEntity
;
import
org.springframework.web.multipart.MultipartFile
;
public
interface
protocolTemplateService
{
void
generation
(
protocolGenerationEntity
protocolGeneration
);
}
fuzzbackend/src/main/java/com/example/fuzzControll/tools/cmdTools.java
View file @
9cfe5d97
This diff is collapsed.
Click to expand it.
fuzzbackend/src/main/resources/application-dev.yml
View file @
9cfe5d97
...
...
@@ -16,3 +16,7 @@ logging:
filepath
:
seedPath
:
"
/home/qbq/aflnet/tutorials/live555/in-rtsp"
kitty
:
path
:
"
/home/qbq/fuzz50/kitty/renix/"
#kitty项目下的各协议生成模板python文件路径
venvPath
:
"
/home/qbq/fuzz50/kitty/venv/bin/python"
methodPath
:
"
/home/qbq/fuzz50/kitty/2020test/"
#kitty下变异方法路径
\ No newline at end of file
fuzzbackend/src/main/resources/log4j.properties
0 → 100644
View file @
9cfe5d97
# Global logging configuration
# 设置日志输出级别以及输出目的地,可以设置多个输出目的地,开发环境下,日志级别要设置成DEBUG或者ERROR
# 前面写日志级别,逗号后面写输出目的地:我自己下面设置的目的地相对应,以逗号分开
# log4j.rootLogger = [level],appenderName1,appenderName2,…
log4j.rootLogger
=
INFO,CONSOLE,LOGFILE
# log4j.rootLogger=DEBUG,CONSOLE,LOGFILE
#### 控制台输出 ####
log4j.appender.CONSOLE
=
org.apache.log4j.ConsoleAppender
# 输出到控制台
log4j.appender.CONSOLE.Target
=
System.out
# 指定控制台输出日志级别
# log4j.appender.CONSOLE.Threshold = DEBUG
# 默认值是 true, 表示是否立即输出
# log4j.appender.CONSOLE.ImmediateFlush = true
# 设置编码方式
log4j.appender.CONSOLE.Encoding
=
UTF-8
# 日志输出布局
log4j.appender.CONSOLE.layout
=
org.apache.log4j.PatternLayout
# 如果日志输出布局为PatternLayout 自定义级别,需要使用ConversionPattern指定输出格式
log4j.appender.CONSOLE.layout.ConversionPattern
=
[%d{yyyy-MM-dd HH:mm:ss}] %5p (%c:%L) >>> %m%n
#### 输出错误信息到文件 ####
log4j.appender.LOGFILE
=
org.apache.log4j.FileAppender
# 指定输出文件路径
#log4j.appender.LOGFILE.File =F://Intellij idea/logs/error.log
log4j.appender.LOGFILE.File
=
./logs/error.log
#日志输出到文件,默认为true
log4j.appender.LOGFILE.Append
=
true
# 指定输出日志级别
# log4j.appender.LOGFILE.Threshold = ERROR
# 是否立即输出,默认值是 true,
# log4j.appender.LOGFILE.ImmediateFlush = true
# 设置编码方式
log4j.appender.LOGFILE.Encoding
=
UTF-8
# 日志输出布局
log4j.appender.LOGFILE.layout
=
org.apache.log4j.PatternLayout
# 如果日志输出布局为PatternLayout 自定义级别,需要使用ConversionPattern指定输出格式
log4j.appender.LOGFILE.layout.ConversionPattern
=
%-d{yyyy-MM-dd HH:mm:ss} [ %t:%r ] - [ %p ] %m%n
fuzzbackend/src/main/resources/result.html
View file @
9cfe5d97
...
...
@@ -9,14 +9,13 @@
var
ws2
=
null
;
function
myFunction
()
{
ws1
=
new
WebSocket
(
"ws://127.0.0.1:8080/websocket/testResult/"
+
"web"
+
100
);
ws2
=
new
WebSocket
(
"ws://127.0.0.1:8080/websocket/testResult/"
+
"backend"
+
100
);
ws1
.
onmessage
=
function
(
evt
)
{
console
.
log
(
evt
);
var
received_msg
=
JSON
.
parse
(
evt
.
data
)
;
const
nameValue
=
Object
.
values
(
received_msg
)
var
context
=
'<div class="sendMsg">'
+
'
系统数据
:<br/>'
+
'
时钟
<h3>'
+
nameValue
+
'</h3><br/>'
+
'
aflnet
:<br/>'
+
'
aflnet
<h3>'
+
nameValue
+
'</h3><br/>'
+
' </div>'
;
document
.
getElementById
(
"sendDiv"
).
innerHTML
=
context
;
};
...
...
@@ -25,15 +24,6 @@
// 关闭 websocket
alert
(
"连接已关闭..."
);
};
ws2
.
onmessage
=
function
(
evt
)
{
var
received_msg
=
evt
.
data
;
console
.
log
(
"received"
)
alert
(
"接收到数据:"
+
received_msg
);
};
ws2
.
onclose
=
function
()
{
// 关闭 websocket
alert
(
"连接已关闭..."
);
};
}
</script>
<body
onload=
"javascript:myFunction()"
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment