Skip to content

Comments

DNP3#4923

Open
nrathaus wants to merge 7 commits intosecdev:masterfrom
nrathaus:dnp3
Open

DNP3#4923
nrathaus wants to merge 7 commits intosecdev:masterfrom
nrathaus:dnp3

Conversation

@nrathaus
Copy link

Checklist:

  • If you are new to Scapy: I have checked CONTRIBUTING.md (esp. section submitting-pull-requests)
  • I squashed commits belonging together

Sorry I am not show how to do this, some guidance?

  • I added unit tests or explained why they are not relevant

Not sure if it is needed here or not - this is a new contrib protocol - should I add PCAP ? or something like s = raw(IP()...)?

  • I executed the regression tests (using tox)
  • If the PR is still not finished, please create a Draft Pull Request

--

This PR will introduce DNP3 support to scapy, it was done about 9 years ago: https://github.com/nrodofile/ScapyDNP3_lib but never integrated (unknown reason)

Copy link

@polydroi polydroi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution to Scapy.


Original code by: Copyright 2014-2016 N.R Rodofile

Licensed under the GPLv3.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please adapt the license to gplv2 only

fields_desc = [
BitEnumField("DIR", MASTER, 1, stations), # 9.2.4.1.3.1 DIR bit field
BitEnumField("PRM", MASTER, 1, stations), # 9.2.4.1.3.2 PRM bit field
ConditionalField(cond_field[0], lambda x: x.PRM == MASTER),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This cond_field array is not very readable, I suggest to directly add the fields here

chunk_len = 18
data_chunk_len = 16

# def show_data_chunks(self):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove commented code

if CRC != self.CRC:
pkt = pkt[:-2] + struct.pack("H", CRC)

self.data_chunks = []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not familiar with this protocol, but maybe it would make sense to introduce a chunk packet and add a PaketListField of chunk fields to DNP3 fields at the end.


############
############
+ DNP3

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please add more unit test, especially for the chunk handling

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, thank you for the guidance.

I would just to say that the original author of the module wrote it under GPLv3, I am not sure if I can just change it to GPLv2 - can you clarify if it is ok?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants