Skip to content

Commit

Permalink
modify readme
Browse files Browse the repository at this point in the history
  • Loading branch information
dylenfu committed May 11, 2020
1 parent f7bc03a commit 138760d
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 9 deletions.
8 changes: 2 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,5 @@ clean:
rm -rf *.8 *.o *.out *.6 *exe
rm -rf dht-tool dht-tool-*

restart:
make clean && make dht-tool && ./dht-tool

docker:
make clean && make
docker build -t dht:latest .
remake:
make clean && make dht-tool
6 changes: 5 additions & 1 deletion methods/endpoint.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,9 @@ func init() {
core.OntTool.RegMethod("heartbeat", Heartbeat)
core.OntTool.RegMethod("heartbeatInterruptPing", HeartbeatInterruptPing)
core.OntTool.RegMethod("heartbeatInterruptPong", HeartbeatInterruptPong)
core.OntTool.RegMethod("dhtCapture", DHTCapture)
core.OntTool.RegMethod("ddos", DDos)
core.OntTool.RegMethod("invalidBlockHeight", InvalidBlockHeight)
core.OntTool.RegMethod("attackRoutable", AttackRoutable)
core.OntTool.RegMethod("attackTxPool", AttackTxPool)
core.OntTool.RegMethod("doubleSpend", DoubleSpend)
}
25 changes: 23 additions & 2 deletions methods/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,29 @@ func HeartbeatInterruptPong() bool {
return true
}

func DHTCapture() bool {
// ddos 攻击
func DDos() bool {

log4.Info("dht capture success")
log4.Info("ddos attack end!")
return true
}

// 异常块高
func InvalidBlockHeight() bool {
return true
}

// 路由表攻击
func AttackRoutable() bool {
return true
}

// 非法交易攻击
func AttackTxPool() bool {
return true
}

// 双花
func DoubleSpend() bool {
return true
}
87 changes: 87 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,87 @@ handshakeWrongMsg // 握手客户端发送错误信息
heartbeat // 心跳持续测试
heartbeatInterruptPing // p2p ping中断测试
heartbeatInterruptPong // p2p pong中断测试
ddos // ddos 攻击单一节点,阻断流量(无法同步块)
invalidBlockHeight // 模拟节点持续快高异常
```

## 测试条件及结果预期
#### 1、握手测试
```dtd
条件:
a、正常握手,或者在握手时停止于某个步骤
结果:
a、正常握手连接应该成功
b、握手中断连接应该失败
```

#### 2、握手时发送非法version
```dtd
条件:
a、使用参数构造虚假version,并发送到某个目标节点
结果:
a、连接失败
```

#### 3、网络超时重试模拟
```dtd
条件:
a、握手时在某个步骤延时
结果:
a、第一次握手失败
b、第二次握手成功
```

#### 4、网络流量攻击
```dtd
条件:
a、构造多个虚假peerID
b、与单个目标sync节点距离较近
c、虚假peer主动发起连接,并持续ping
结果:
a、节点不能正常出块(出块慢甚至不出块)
```

#### 5.路由表攻击
```dtd
条件:
1.根据目标节点ID,构造大量距离目标seed节点很近的虚拟节点,
2.主动连接并ping目标节点,比如说节点最多允许接收1024个链接,其中4个链接为正常连接,
1020个链接为恶意连接,当连接数超过1024时,是否会有恶意连接挤出正常连接
结果:
a、正常连接是否会被挤出
b、节点路由被恶意节点占满
c、节点重启后仍然被恶意节点占满
d、节点主动发起连接大概率会连接上恶意节点
```

#### 6.块同步攻击
```dtd
条件:
a.测试工具所模拟的节点块高度始终高于正常节点
结果:
a.造成同步异常或者延时
```

#### 7.交易池攻击
```dtd
条件:
a、多个恶意节点持续对多个目标seed节点发送不合法交易(比如余额不足)
结果:
a、查询交易池,不同目标节点的交易持应该相同,而且都不包含不合法交易
b、测试前后查询余额,账户余额不变
```

#### 8.双花攻击
```dtd
条件:
a、单个恶意节点,对多个目标seed节点发送连续的4笔交易,其中1笔能成功,另外3笔不能成功,
比如只有2块钱的情况下,转账4次,1.1, 1.2, 1.3,1.4
结果:
a、目标seed节点交易池应该相同,都只有1笔正常的交易
b、测试前后查询余额账户,只转出一笔
```

## 测试参数:
Expand All @@ -50,3 +131,9 @@ StopServerAfterUpdateKad = 8 // 握手时服务端更新kad后停止
StopServerAfterReadKad = 9 // 握手时服务端读取kad后停止
StopServerAfterReadAck = 10 // 握手时服务端接收ack后停止
```

## TODO
. dump dht
. dump txnPool
. utils for sending tx
. utils for getting block height & account balance

0 comments on commit 138760d

Please sign in to comment.