Skip to content

Commit 6f710c4

Browse files
authored
Merge pull request #3 from scy-phy/modbus
Modbus
2 parents b2c47ab + efb84d8 commit 6f710c4

24 files changed

+1831
-457
lines changed

.travis.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# MiniCPS .travis.yml
22
#
3-
# Commits that have [ci skip] anywhere in the commit messages are ignored by Travis CI.
3+
# NOTE: Commits that have [ci skip] anywhere in the commit messages are ignored by Travis CI.
4+
# NOTE: Validate file using https://lint.travis-ci.org/
5+
6+
# NOTE: When sudo is enabled Travis will use a non docker based infrastructure
7+
# sudo: required
48

59
language: python
610

@@ -9,22 +13,22 @@ branches:
913
- master
1014

1115
python:
12-
- "2.6"
1316
- "2.7"
1417

15-
# travis-ci automatically preinstalls
16-
#
18+
# NOTE: Travis-ci automatically preinstalls
1719
# pytest
1820
# nose
1921
# mock
2022

21-
# travis-ci automatically installs
23+
# NOTE: Travis-ci automatically runs
2224
#
23-
# pip install -r requirements.txt
25+
install:
26+
- pip install -r requirements.txt
2427

25-
# TODO: add mininet-based tests
28+
# TODO: Add mininet-based tests
2629
script: make tests-travis
2730

31+
# NOTE: https://docs.travis-ci.com/user/notifications/
2832
notifications:
2933
email:
3034
on_success: change

Makefile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
MININET = sudo mn
55

66
PYTHON = sudo python
7-
PYTHON_OPTS =
7+
PYTHON_OPTS =
88

99
# regex testMatch: (?:^|[b_.-])[Tt]est)
1010
# --exe: include also executable files
@@ -14,10 +14,10 @@ PYTHON_OPTS =
1414
# TODO: add testing conditionals for verbosity, doctest plugin and coverage plugin
1515
# http://web.mit.edu/gnu/doc/html/make_7.html
1616

17-
# sudo because of mininet
17+
# NOTE: sudo because of mininet
1818
TESTER = sudo nosetests
1919
TESTER_TRAVIS = nosetests
20-
TESTER_OPTS = -s -v --exe
20+
TESTER_OPTS = -s -v --exe --rednose
2121
TESTER_OPTS_COV_HTML = $(TESTER_OPTS) --with-coverage --cover-html
2222

2323
# http://stackoverflow.com/questions/3931741/why-does-make-think-the-target-is-up-to-date
@@ -81,18 +81,30 @@ test-networks:
8181
test-sdns:
8282
$(TESTER) $(TESTER_OPTS) tests/sdns_tests.py
8383

84+
8485
test-protocols:
8586
$(TESTER) $(TESTER_OPTS) tests/protocols_tests.py
8687

88+
test-enip:
89+
$(TESTER) $(TESTER_OPTS) tests/protocols_tests.py:TestEnipProtocol
90+
91+
test-modbus:
92+
$(TESTER) $(TESTER_OPTS) tests/protocols_tests.py:TestModbusProtocol
93+
94+
8795
test-utils:
8896
$(TESTER) $(TESTER_OPTS) tests/utils_tests.py
8997

9098
test-states:
9199
$(TESTER) $(TESTER_OPTS) tests/states_tests.py
92100

101+
93102
test-devices:
94103
$(TESTER) $(TESTER_OPTS) tests/devices_tests.py
95104

105+
test-device:
106+
$(TESTER) $(TESTER_OPTS) tests/devices_tests.py:TestDevice
107+
96108

97109
# clean {{{1
98110
clean: clean-cover clean-pyc clean-logs

RELEASES.md

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,39 @@
1-
Version 1.0.0 (2016-07-01)
2-
==========================
1+
# Releases and change log
32

4-
Public API
5-
----------
3+
## Version 1.1.0 (2017-TODO-TODO)
64

7-
* network API core functions: `send` and `receive`
8-
* physical layer API core functions: `set` and `get`
5+
### Public API
96

10-
Industrial protocol support
11-
----------------------------
7+
* Bug fixes
128

13-
* subset of Ethernet/IP: `cpppo`
9+
### Industrial protocol support
1410

15-
Physical layer backend support
16-
------------------------------
11+
* Modbus through `pymodbus`
1712

18-
* SQLite3: `sqlite3`
13+
### Test suite
14+
15+
* Added `rednose` for better user interface
16+
* Added `raises` decorator to test for expected Exceptions
17+
* Bug fixes
18+
19+
20+
### Misc
21+
22+
* We are an awesome ICS security tool:
23+
[![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/hslatman/awesome-industrial-control-system-security)
24+
25+
26+
## Version 1.0.0 (2016-07-01)
27+
28+
### Public API
29+
30+
* Network API core functions: `send` and `receive`
31+
* Physical layer API core functions: `set` and `get`
32+
33+
### Industrial protocol support
34+
35+
* Subset of Ethernet/IP through `cpppo`
36+
37+
### Physical layer backend support
38+
39+
* SQLite3 through `sqlite3`

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,9 @@
6666
# built documents.
6767
#
6868
# The short X.Y version.
69-
version = '1.0'
69+
version = '1.1'
7070
# The full version, including alpha/beta/rc tags.
71-
release = '1.0.0'
71+
release = '1.1.0'
7272

7373
# The language for content autogenerated by Sphinx. Refer to documentation
7474
# for a list of supported languages.

examples/swat-s1/plc1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ def main_loop(self):
8181

8282
# TODO: use it when implement raw water tank
8383
# read from PLC2 (constant value)
84-
fit201 = float(self.recieve(FIT201_2, PLC2_ADDR))
84+
fit201 = float(self.receive(FIT201_2, PLC2_ADDR))
8585
print "DEBUG PLC1 - receive fit201: %f" % fit201
8686
self.send(FIT201_1, fit201, PLC1_ADDR)
8787

8888
# # read from PLC3
89-
lit301 = float(self.recieve(LIT301_3, PLC3_ADDR))
89+
lit301 = float(self.receive(LIT301_3, PLC3_ADDR))
9090
print "DEBUG PLC1 - receive lit301: %f" % lit301
9191
self.send(LIT301_1, lit301, PLC1_ADDR)
9292

examples/swat-s1/plc2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def main_loop(self):
4242
print "DEBUG PLC2 - get fit201: %f" % fit201
4343

4444
self.send(FIT201_2, fit201, PLC2_ADDR)
45-
# fit201 = self.recieve(FIT201_2, PLC2_ADDR)
45+
# fit201 = self.receive(FIT201_2, PLC2_ADDR)
4646
# print "DEBUG PLC2 - receive fit201: ", fit201
4747

4848
time.sleep(PLC_PERIOD_SEC)

examples/swat-s1/run.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ def __init__(self, name, net):
2727
'plc1', 'plc2', 'plc3', 's1')
2828

2929
# SPHINX_SWAT_TUTORIAL RUN(
30-
# plc2.cmd(sys.executable + ' plc2.py &')
31-
# plc3.cmd(sys.executable + ' plc3.py &')
32-
# plc1.cmd(sys.executable + ' plc1.py &')
33-
# s1.cmd(sys.executable + ' physical_process.py &')
30+
plc2.cmd(sys.executable + ' plc2.py &')
31+
plc3.cmd(sys.executable + ' plc3.py &')
32+
plc1.cmd(sys.executable + ' plc1.py &')
33+
s1.cmd(sys.executable + ' physical_process.py &')
3434
# SPHINX_SWAT_TUTORIAL RUN)
3535

3636
CLI(self.net)

examples/toy/plc1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def main_loop(self, sleep=0.5):
4242
count = 0
4343
END = 6e6
4444
while(True):
45-
rec_s31 = self.recieve(SENSOR3_1, PLC1_ADDR)
45+
rec_s31 = self.receive(SENSOR3_1, PLC1_ADDR)
4646
# print 'DEBUG: toy plc1 receive SENSOR3_1: ', rec_s31
4747
get_s32 = self.get(SENSOR3_2)
4848
print 'DEBUG: toy plc1 get SENSOR3_2: ', get_s32

0 commit comments

Comments
 (0)