-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[Python 2 to 3] Bytes fixes #674
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #674 +/- ##
==========================================
+ Coverage 80.69% 80.71% +0.01%
==========================================
Files 137 137
Lines 33903 34005 +102
==========================================
+ Hits 27357 27446 +89
- Misses 6546 6559 +13
|
a14e143 to
fa5c364
Compare
961e207 to
c63a39a
Compare
87b0e92 to
dd1db1e
Compare
4411665 to
718e2c2
Compare
|
Ok I'm now able to boot scapy using python 3 (windows and ubuntu)... Tons of stuff must be broken though... |
ad6dbfd to
1abf6ea
Compare
|
Rebased (apply mtury's work). |
a89665a to
6e6c372
Compare
|
Status update:
|
66f503c to
85d171d
Compare
|
@gpotter2 don't forget to update the title when it its ready to be reviewed =) |
85d171d to
644c22d
Compare
7ac2994 to
81b8c9a
Compare
81b8c9a to
4608906
Compare
545adc4 to
5354974
Compare
|
I've added python 3 launchers |
5354974 to
43d372e
Compare
scapy/layers/inet6.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, nice catch
scapy/tools/UTscapy.py
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the new indentation needed ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the change log is a bit messy but the code is
if six.PY2:
def crc32(x):
return "%08X" % (0xffffffff & zlib.crc32(x))
def sha1(x):
return hashlib.sha1(x).hexdigest().upper()
else:
def crc32(x):
return "%08X" % (0xffffffff & zlib.crc32(bytearray(x, "utf8")))
def sha1(x):
return hashlib.sha1(x.encode("utf8")).hexdigest().upper()
|
It looks good to me ! |
fc2a438 to
5e88574
Compare
Here's the most boring part of it. That should bring neally all bytes support for the
core. Contribution files will be changed later.This PR:
-- raw(x) : returns the byte form of a string/packet/int/list of ints
-- plain_str(x) : does exactly the opposite: bytes/int ==> str
-- hex_bytes / bytes_hex ==> converts hex => bytes or bytes => hex
raw