Scapy --TypeError: unbound method copy() must be called with UDP instance as first argument
up vote
0
down vote
favorite
I am writing a python script that creates UDP packets at layer 2 with Scapy.
However, I continually get a "TypeError" when including UDP() options/attributes in the definition of the packet.
Code:
Return_Data = sendp( Ether(dst="ff:ff:ff:ff:ff:ff", type=0x800)
/ IP(version=4L, ihl=5L, tos=0x0, len=64,
id=0, flags=0, frag=0L, ttl=64, proto=UDP,
chksum = 30495, src="xxx.xxx.xx.xxx", dst="xxx.xxx.x.x") /
UDP(sport=31123, dport=31123, chksum=0x6f21, len=30) / Raw(load=Payload) )
Traceback (most recent call last):
File "EthCfgRx_Test_3.py", line 20, in
UDP(sport=31123, dport=31123, chksum=0x6f21, len=30) / Raw(load=Payload) )
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 349, in div
cloneB = other.copy()
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 200, in copy
clone.fields = self.copy_fields_dict(self.fields)
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 382, in copy_fields_dict
for fname, fval in six.iteritems(fields)}
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 382, in
for fname, fval in six.iteritems(fields)}
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 377, in copy_field_value
return self.get_field(fieldname).do_copy(value)
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/fields.py", line 86, in do_copy
return x.copy()
TypeError: unbound method copy() must be called with UDP instance as first argument (got nothing instead)
Any Advice?
Thanks in Advance!
python-2.7 udp typeerror scapy
add a comment |
up vote
0
down vote
favorite
I am writing a python script that creates UDP packets at layer 2 with Scapy.
However, I continually get a "TypeError" when including UDP() options/attributes in the definition of the packet.
Code:
Return_Data = sendp( Ether(dst="ff:ff:ff:ff:ff:ff", type=0x800)
/ IP(version=4L, ihl=5L, tos=0x0, len=64,
id=0, flags=0, frag=0L, ttl=64, proto=UDP,
chksum = 30495, src="xxx.xxx.xx.xxx", dst="xxx.xxx.x.x") /
UDP(sport=31123, dport=31123, chksum=0x6f21, len=30) / Raw(load=Payload) )
Traceback (most recent call last):
File "EthCfgRx_Test_3.py", line 20, in
UDP(sport=31123, dport=31123, chksum=0x6f21, len=30) / Raw(load=Payload) )
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 349, in div
cloneB = other.copy()
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 200, in copy
clone.fields = self.copy_fields_dict(self.fields)
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 382, in copy_fields_dict
for fname, fval in six.iteritems(fields)}
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 382, in
for fname, fval in six.iteritems(fields)}
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 377, in copy_field_value
return self.get_field(fieldname).do_copy(value)
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/fields.py", line 86, in do_copy
return x.copy()
TypeError: unbound method copy() must be called with UDP instance as first argument (got nothing instead)
Any Advice?
Thanks in Advance!
python-2.7 udp typeerror scapy
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am writing a python script that creates UDP packets at layer 2 with Scapy.
However, I continually get a "TypeError" when including UDP() options/attributes in the definition of the packet.
Code:
Return_Data = sendp( Ether(dst="ff:ff:ff:ff:ff:ff", type=0x800)
/ IP(version=4L, ihl=5L, tos=0x0, len=64,
id=0, flags=0, frag=0L, ttl=64, proto=UDP,
chksum = 30495, src="xxx.xxx.xx.xxx", dst="xxx.xxx.x.x") /
UDP(sport=31123, dport=31123, chksum=0x6f21, len=30) / Raw(load=Payload) )
Traceback (most recent call last):
File "EthCfgRx_Test_3.py", line 20, in
UDP(sport=31123, dport=31123, chksum=0x6f21, len=30) / Raw(load=Payload) )
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 349, in div
cloneB = other.copy()
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 200, in copy
clone.fields = self.copy_fields_dict(self.fields)
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 382, in copy_fields_dict
for fname, fval in six.iteritems(fields)}
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 382, in
for fname, fval in six.iteritems(fields)}
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 377, in copy_field_value
return self.get_field(fieldname).do_copy(value)
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/fields.py", line 86, in do_copy
return x.copy()
TypeError: unbound method copy() must be called with UDP instance as first argument (got nothing instead)
Any Advice?
Thanks in Advance!
python-2.7 udp typeerror scapy
I am writing a python script that creates UDP packets at layer 2 with Scapy.
However, I continually get a "TypeError" when including UDP() options/attributes in the definition of the packet.
Code:
Return_Data = sendp( Ether(dst="ff:ff:ff:ff:ff:ff", type=0x800)
/ IP(version=4L, ihl=5L, tos=0x0, len=64,
id=0, flags=0, frag=0L, ttl=64, proto=UDP,
chksum = 30495, src="xxx.xxx.xx.xxx", dst="xxx.xxx.x.x") /
UDP(sport=31123, dport=31123, chksum=0x6f21, len=30) / Raw(load=Payload) )
Traceback (most recent call last):
File "EthCfgRx_Test_3.py", line 20, in
UDP(sport=31123, dport=31123, chksum=0x6f21, len=30) / Raw(load=Payload) )
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 349, in div
cloneB = other.copy()
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 200, in copy
clone.fields = self.copy_fields_dict(self.fields)
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 382, in copy_fields_dict
for fname, fval in six.iteritems(fields)}
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 382, in
for fname, fval in six.iteritems(fields)}
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/packet.py", line 377, in copy_field_value
return self.get_field(fieldname).do_copy(value)
File "/home/watouser/.local/lib/python2.7/site-packages/scapy/fields.py", line 86, in do_copy
return x.copy()
TypeError: unbound method copy() must be called with UDP instance as first argument (got nothing instead)
Any Advice?
Thanks in Advance!
python-2.7 udp typeerror scapy
python-2.7 udp typeerror scapy
edited Nov 11 at 6:32
asked Nov 10 at 4:09
Universal Thinker
12
12
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
Scapy will bind automatically the packets.
The wrong part seems to be Proto=UDP
. Proto should be a number, not a class.
When doing the /
operation, the Proto will be automatically provided, so you don’t need to specify it
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53235915%2fscapy-typeerror-unbound-method-copy-must-be-called-with-udp-instance-as-fir%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Scapy will bind automatically the packets.
The wrong part seems to be Proto=UDP
. Proto should be a number, not a class.
When doing the /
operation, the Proto will be automatically provided, so you don’t need to specify it
add a comment |
up vote
0
down vote
Scapy will bind automatically the packets.
The wrong part seems to be Proto=UDP
. Proto should be a number, not a class.
When doing the /
operation, the Proto will be automatically provided, so you don’t need to specify it
add a comment |
up vote
0
down vote
up vote
0
down vote
Scapy will bind automatically the packets.
The wrong part seems to be Proto=UDP
. Proto should be a number, not a class.
When doing the /
operation, the Proto will be automatically provided, so you don’t need to specify it
Scapy will bind automatically the packets.
The wrong part seems to be Proto=UDP
. Proto should be a number, not a class.
When doing the /
operation, the Proto will be automatically provided, so you don’t need to specify it
answered Nov 11 at 14:12
Cukic0d
1,3611722
1,3611722
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53235915%2fscapy-typeerror-unbound-method-copy-must-be-called-with-udp-instance-as-fir%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown