Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reverse MIB storage format #1611

Merged
merged 3 commits into from
Sep 29, 2018
Merged

Reverse MIB storage format #1611

merged 3 commits into from
Sep 29, 2018

Conversation

gpotter2
Copy link
Member

@gpotter2 gpotter2 commented Sep 23, 2018

See #1441

This PR reverse the way MIB data is stored in scapy: it makes more sense to use the unique OID as key in the storage dictionaries, rather than its value, that can be a duplicate

I'm pretty sure this even improve speed, as we use self[key] less often.

Warning: This PR has 2 breaking changes

  • The format of the data dictionaries (raw) has changed, so direct usages of the dictionaries will fail (unlikely to be used as so: people should use conf.mib)
  • The real values are now being used, rather than the formatted ones (as the values were stored as keys). This means that - which was previously converted to _ (I.e sha1-...) will not be replaced anymore. This is the wanted usage, but not the one there used to be. (I’m open to a compatibility “- to _” function if necessary, but I’d rather move away from it)

@gpotter2 gpotter2 requested a review from guedou September 23, 2018 11:01
@gpotter2 gpotter2 added the cleanup Performs some code clean-up label Sep 23, 2018
@codecov-io
Copy link

codecov-io commented Sep 23, 2018

Codecov Report

Merging #1611 into master will decrease coverage by 10.1%.
The diff coverage is 82.6%.

@@             Coverage Diff             @@
##           master    #1611       +/-   ##
===========================================
- Coverage   85.26%   75.16%   -10.11%     
===========================================
  Files         179      125       -54     
  Lines       42143    29489    -12654     
===========================================
- Hits        35935    22164    -13771     
- Misses       6208     7325     +1117
Impacted Files Coverage Δ
scapy/asn1/mib.py 89.04% <82.6%> (-1.1%) ⬇️
scapy/layers/tls/automaton.py 15.78% <0%> (-64.92%) ⬇️
scapy/sendrecv.py 24.55% <0%> (-58.75%) ⬇️
scapy/arch/bpf/core.py 25.24% <0%> (-54.37%) ⬇️
scapy/arch/common.py 42% <0%> (-52%) ⬇️
scapy/as_resolvers.py 32.71% <0%> (-48.6%) ⬇️
scapy/layers/tls/automaton_cli.py 31.88% <0%> (-45.15%) ⬇️
scapy/layers/tls/automaton_srv.py 26.66% <0%> (-44.71%) ⬇️
scapy/contrib/ppi_geotag.py 47.69% <0%> (-42.31%) ⬇️
scapy/modules/nmap.py 57.46% <0%> (-39.56%) ⬇️
... and 103 more

@gpotter2 gpotter2 force-pushed the mib-reformat branch 3 times, most recently from da6d107 to 898394a Compare September 23, 2018 23:15
Copy link
Member

@guedou guedou left a comment

Choose a reason for hiding this comment

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

Looks good to me. Could you add docstrings do the methods that you are modifying? Thanks!

@gpotter2
Copy link
Member Author

Added some vague quite vague docstrings (I'm not 100% sure of each's function exact doings)

@guedou
Copy link
Member

guedou commented Sep 29, 2018

@gpotter2 Thanks! This will help us get a better understanding of the code.

@guedou guedou merged commit c48faea into secdev:master Sep 29, 2018
@gpotter2 gpotter2 deleted the mib-reformat branch September 29, 2018 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup Performs some code clean-up
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants