after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def lookup_target(self, name):
# Look up name in this scope only. Declare as Python
# variable if not found.
entry = self.lookup_here(name)
if not entry:
entry = self.lookup_here_unmangled(name)
if entry and entry.is_pyglobal:
self._emit_class_private_warning(entry.pos, name)... | def lookup_target(self, name):
# Look up name in this scope only. Declare as Python
# variable if not found.
entry = self.lookup_here(name)
if not entry:
entry = self.declare_var(name, py_object_type, None)
return entry
| https://github.com/cython/cython/issues/3548 | (bleeding) ✔ ~/source/other_source/pandas [master {pandas/master}|✚ 2]
jupiter@15:19 ➤ pip install -v .
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-zcmyaxf3
Created temporary directory: /tmp/pip-req-tracker-dfm6xgbp
Initialized build tracking at /tmp/p... | Cython.Compiler.Errors.CompileError |
def mangle_class_private_name(self, name):
# a few utilitycode names need to specifically be ignored
if name and name.lower().startswith("__pyx_"):
return name
if name and name.startswith("__") and not name.endswith("__"):
name = EncodedString("_%s%s" % (self.class_name.lstrip("_"), name))
... | def mangle_class_private_name(self, name):
# a few utilitycode names need to specifically be ignored
if name and name.lower().startswith("__pyx_"):
return name
return self.mangle_special_name(name)
| https://github.com/cython/cython/issues/3548 | (bleeding) ✔ ~/source/other_source/pandas [master {pandas/master}|✚ 2]
jupiter@15:19 ➤ pip install -v .
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-zcmyaxf3
Created temporary directory: /tmp/pip-req-tracker-dfm6xgbp
Initialized build tracking at /tmp/p... | Cython.Compiler.Errors.CompileError |
def declare_var(
self, name, type, pos, cname=None, visibility="private", api=0, in_pxd=0, is_cdef=0
):
name = self.mangle_class_private_name(name)
if type is unspecified_type:
type = py_object_type
# Add an entry for a class attribute.
entry = Scope.declare_var(
self,
name,
... | def declare_var(
self, name, type, pos, cname=None, visibility="private", api=0, in_pxd=0, is_cdef=0
):
name = self.mangle_special_name(name)
if type is unspecified_type:
type = py_object_type
# Add an entry for a class attribute.
entry = Scope.declare_var(
self,
name,
... | https://github.com/cython/cython/issues/3548 | (bleeding) ✔ ~/source/other_source/pandas [master {pandas/master}|✚ 2]
jupiter@15:19 ➤ pip install -v .
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-zcmyaxf3
Created temporary directory: /tmp/pip-req-tracker-dfm6xgbp
Initialized build tracking at /tmp/p... | Cython.Compiler.Errors.CompileError |
def declare_var(
self, name, type, pos, cname=None, visibility="private", api=0, in_pxd=0, is_cdef=0
):
name = self.mangle_class_private_name(name)
if is_cdef:
# Add an entry for an attribute.
if self.defined:
error(
pos,
"C attributes cannot be ad... | def declare_var(
self, name, type, pos, cname=None, visibility="private", api=0, in_pxd=0, is_cdef=0
):
name = self.mangle_special_name(name)
if is_cdef:
# Add an entry for an attribute.
if self.defined:
error(
pos,
"C attributes cannot be added in... | https://github.com/cython/cython/issues/3548 | (bleeding) ✔ ~/source/other_source/pandas [master {pandas/master}|✚ 2]
jupiter@15:19 ➤ pip install -v .
Non-user install because user site-packages disabled
Created temporary directory: /tmp/pip-ephem-wheel-cache-zcmyaxf3
Created temporary directory: /tmp/pip-req-tracker-dfm6xgbp
Initialized build tracking at /tmp/p... | Cython.Compiler.Errors.CompileError |
def declare_from_annotation(self, env, as_target=False):
"""Implements PEP 526 annotation typing in a fairly relaxed way.
Annotations are ignored for global variables, Python class attributes and already declared variables.
String literals are allowed and ignored.
The ambiguous Python types 'int' and '... | def declare_from_annotation(self, env, as_target=False):
"""Implements PEP 526 annotation typing in a fairly relaxed way.
Annotations are ignored for global variables, Python class attributes and already declared variables.
String literals are allowed and ignored.
The ambiguous Python types 'int' and '... | https://github.com/cython/cython/issues/3142 | Compiling bug.py because it changed.
[1/1] Cythonizing bug.py
Error compiling Cython file:
------------------------------------------------------------
...
import numpy as np
def func(arg):
arr = np.empty_like(arg)
^
------------------------------------------------------------
bug.py:4:23: Cannot coerce to a type th... | Cython.Compiler.Errors.CompileError |
def analyse_type_annotation(self, env, assigned_value=None):
if self.untyped:
# Already applied as a fused type, not re-evaluating it here.
return None, None
annotation = self.expr
base_type = None
is_ambiguous = False
explicit_pytype = explicit_ctype = False
if annotation.is_dic... | def analyse_type_annotation(self, env, assigned_value=None):
annotation = self.expr
base_type = None
is_ambiguous = False
explicit_pytype = explicit_ctype = False
if annotation.is_dict_literal:
warning(
annotation.pos,
"Dicts should no longer be used as type annotatio... | https://github.com/cython/cython/issues/3142 | Compiling bug.py because it changed.
[1/1] Cythonizing bug.py
Error compiling Cython file:
------------------------------------------------------------
...
import numpy as np
def func(arg):
arr = np.empty_like(arg)
^
------------------------------------------------------------
bug.py:4:23: Cannot coerce to a type th... | Cython.Compiler.Errors.CompileError |
def _specialize_function_args(self, args, fused_to_specific):
for arg in args:
if arg.type.is_fused:
arg.type = arg.type.specialize(fused_to_specific)
if arg.type.is_memoryviewslice:
arg.type.validate_memslice_dtype(arg.pos)
if arg.annotation:
... | def _specialize_function_args(self, args, fused_to_specific):
for arg in args:
if arg.type.is_fused:
arg.type = arg.type.specialize(fused_to_specific)
if arg.type.is_memoryviewslice:
arg.type.validate_memslice_dtype(arg.pos)
| https://github.com/cython/cython/issues/3142 | Compiling bug.py because it changed.
[1/1] Cythonizing bug.py
Error compiling Cython file:
------------------------------------------------------------
...
import numpy as np
def func(arg):
arr = np.empty_like(arg)
^
------------------------------------------------------------
bug.py:4:23: Cannot coerce to a type th... | Cython.Compiler.Errors.CompileError |
def align_argument_type(self, env, arg):
# @cython.locals()
directive_locals = self.directive_locals
orig_type = arg.type
if arg.name in directive_locals:
type_node = directive_locals[arg.name]
other_type = type_node.analyse_as_type(env)
elif (
isinstance(arg, CArgDeclNode)
... | def align_argument_type(self, env, arg):
# @cython.locals()
directive_locals = self.directive_locals
orig_type = arg.type
if arg.name in directive_locals:
type_node = directive_locals[arg.name]
other_type = type_node.analyse_as_type(env)
elif (
isinstance(arg, CArgDeclNode)
... | https://github.com/cython/cython/issues/3142 | Compiling bug.py because it changed.
[1/1] Cythonizing bug.py
Error compiling Cython file:
------------------------------------------------------------
...
import numpy as np
def func(arg):
arr = np.empty_like(arg)
^
------------------------------------------------------------
bug.py:4:23: Cannot coerce to a type th... | Cython.Compiler.Errors.CompileError |
def visit_FuncDefNode(self, node):
"""
Analyse a function and its body, as that hasn't happened yet. Also
analyse the directive_locals set by @cython.locals().
Then, if we are a function with fused arguments, replace the function
(after it has declared itself in the symbol table!) with a
Fused... | def visit_FuncDefNode(self, node):
"""
Analyse a function and its body, as that hasn't happened yet. Also
analyse the directive_locals set by @cython.locals().
Then, if we are a function with fused arguments, replace the function
(after it has declared itself in the symbol table!) with a
Fused... | https://github.com/cython/cython/issues/3142 | Compiling bug.py because it changed.
[1/1] Cythonizing bug.py
Error compiling Cython file:
------------------------------------------------------------
...
import numpy as np
def func(arg):
arr = np.empty_like(arg)
^
------------------------------------------------------------
bug.py:4:23: Cannot coerce to a type th... | Cython.Compiler.Errors.CompileError |
def py_operation_function(self, code):
type1, type2 = self.operand1.type, self.operand2.type
if type1 is unicode_type or type2 is unicode_type:
if type1 in (unicode_type, str_type) and type2 in (unicode_type, str_type):
is_unicode_concat = True
elif isinstance(self.operand1, Formatt... | def py_operation_function(self, code):
is_unicode_concat = False
if isinstance(self.operand1, FormattedValueNode) or isinstance(
self.operand2, FormattedValueNode
):
is_unicode_concat = True
else:
type1, type2 = self.operand1.type, self.operand2.type
if type1 is unicode_t... | https://github.com/cython/cython/issues/3426 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "concat.py", line 11, in concat.appendinline
y += 'ab'
TypeError: must be str, not list | TypeError |
def unpack_source_tree(tree_file, workdir, cython_root):
programs = {
"PYTHON": [sys.executable],
"CYTHON": [sys.executable, os.path.join(cython_root, "cython.py")],
"CYTHONIZE": [sys.executable, os.path.join(cython_root, "cythonize.py")],
}
if workdir is None:
workdir = tem... | def unpack_source_tree(tree_file, dir=None):
if dir is None:
dir = tempfile.mkdtemp()
header = []
cur_file = None
f = open(tree_file)
try:
lines = f.readlines()
finally:
f.close()
del f
try:
for line in lines:
if line[:5] == "#####":
... | https://github.com/cython/cython/issues/3369 | runTest (__main__.EndToEndTest)
End-to-end fused_cmethods ... /home/user/Data/Projects/Code/Cython 20_2_18/Python2Venv/bin/python setup.py build_ext -i
/bin/sh: /home/user/Data/Projects/Code/Cython: No such file or directory
FAIL
======================================================================
FAIL: runTest (... | AssertionError |
def analyse_types(self, env):
if self.doc:
self.doc = self.doc.analyse_types(env)
self.doc = self.doc.coerce_to_pyobject(env)
env.use_utility_code(UtilityCode.load_cached("CreateClass", "ObjectHandling.c"))
return self
| def analyse_types(self, env):
self.bases = self.bases.analyse_types(env)
if self.doc:
self.doc = self.doc.analyse_types(env)
self.doc = self.doc.coerce_to_pyobject(env)
env.use_utility_code(UtilityCode.load_cached("CreateClass", "ObjectHandling.c"))
return self
| https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def generate_result_code(self, code):
class_def_node = self.class_def_node
cname = code.intern_identifier(self.name)
if self.doc:
code.put_error_if_neg(
self.pos,
"PyDict_SetItem(%s, %s, %s)"
% (
class_def_node.dict.py_result(),
co... | def generate_result_code(self, code):
cname = code.intern_identifier(self.name)
if self.doc:
code.put_error_if_neg(
self.pos,
"PyDict_SetItem(%s, %s, %s)"
% (
self.dict.py_result(),
code.intern_identifier(StringEncoding.EncodedString("... | https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def generate_result_code(self, code):
code.globalstate.use_utility_code(
UtilityCode.load_cached("Py3ClassCreate", "ObjectHandling.c")
)
cname = code.intern_identifier(self.name)
class_def_node = self.class_def_node
mkw = class_def_node.mkw.py_result() if class_def_node.mkw else "NULL"
i... | def generate_result_code(self, code):
code.globalstate.use_utility_code(
UtilityCode.load_cached("Py3ClassCreate", "ObjectHandling.c")
)
cname = code.intern_identifier(self.name)
if self.mkw:
mkw = self.mkw.py_result()
else:
mkw = "NULL"
if self.metaclass:
metacla... | https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def generate_result_code(self, code):
bases = self.class_def_node.bases
mkw = self.class_def_node.mkw
if mkw:
code.globalstate.use_utility_code(
UtilityCode.load_cached("Py3MetaclassGet", "ObjectHandling.c")
)
call = "__Pyx_Py3MetaclassGet(%s, %s)" % (bases.result(), mkw.... | def generate_result_code(self, code):
if self.mkw:
code.globalstate.use_utility_code(
UtilityCode.load_cached("Py3MetaclassGet", "ObjectHandling.c")
)
call = "__Pyx_Py3MetaclassGet(%s, %s)" % (
self.bases.result(),
self.mkw.result(),
)
else:
... | https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def analyse_types(self, env):
if self.doc:
self.doc = self.doc.analyse_types(env).coerce_to_pyobject(env)
self.type = py_object_type
self.is_temp = 1
return self
| def analyse_types(self, env):
if self.doc:
self.doc = self.doc.analyse_types(env)
self.doc = self.doc.coerce_to_pyobject(env)
self.type = py_object_type
self.is_temp = 1
return self
| https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def generate_result_code(self, code):
cname = code.intern_identifier(self.name)
py_mod_name = self.get_py_mod_name(code)
qualname = self.get_py_qualified_name(code)
class_def_node = self.class_def_node
null = "(PyObject *) NULL"
doc_code = self.doc.result() if self.doc else null
mkw = class_... | def generate_result_code(self, code):
cname = code.intern_identifier(self.name)
py_mod_name = self.get_py_mod_name(code)
qualname = self.get_py_qualified_name(code)
if self.doc:
doc_code = self.doc.result()
else:
doc_code = "(PyObject *) NULL"
if self.mkw:
mkw = self.mkw.... | https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def __init__(
self,
pos,
name,
bases,
doc,
body,
decorators=None,
keyword_args=None,
force_py3_semantics=False,
):
StatNode.__init__(self, pos)
self.name = name
self.doc = doc
self.body = body
self.decorators = decorators
self.bases = bases
from . import E... | def __init__(
self,
pos,
name,
bases,
doc,
body,
decorators=None,
keyword_args=None,
force_py3_semantics=False,
):
StatNode.__init__(self, pos)
self.name = name
self.doc = doc
self.body = body
self.decorators = decorators
self.bases = bases
from . import E... | https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def as_cclass(self):
"""
Return this node as if it were declared as an extension class
"""
if self.is_py3_style_class:
error(
self.classobj.pos, "Python3 style class could not be represented as C class"
)
return
from . import ExprNodes
return CClassDefNode(
... | def as_cclass(self):
"""
Return this node as if it were declared as an extension class
"""
if self.is_py3_style_class:
error(
self.classobj.pos, "Python3 style class could not be represented as C class"
)
return
from . import ExprNodes
return CClassDefNode(
... | https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def analyse_declarations(self, env):
class_result = self.classobj
if self.decorators:
from .ExprNodes import SimpleCallNode
for decorator in self.decorators[::-1]:
class_result = SimpleCallNode(
decorator.pos, function=decorator.decorator, args=[class_result]
... | def analyse_declarations(self, env):
class_result = self.classobj
if self.decorators:
from .ExprNodes import SimpleCallNode
for decorator in self.decorators[::-1]:
class_result = SimpleCallNode(
decorator.pos, function=decorator.decorator, args=[class_result]
... | https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def analyse_expressions(self, env):
if self.bases:
self.bases = self.bases.analyse_expressions(env)
if self.mkw:
self.mkw = self.mkw.analyse_expressions(env)
if self.metaclass:
self.metaclass = self.metaclass.analyse_expressions(env)
self.dict = self.dict.analyse_expressions(env)... | def analyse_expressions(self, env):
if self.bases:
self.bases = self.bases.analyse_expressions(env)
if self.metaclass:
self.metaclass = self.metaclass.analyse_expressions(env)
if self.mkw:
self.mkw = self.mkw.analyse_expressions(env)
self.dict = self.dict.analyse_expressions(env)... | https://github.com/cython/cython/issues/3338 | Compiling testfile.py because it changed.
[1/1] Cythonizing testfile.py
Traceback (most recent call last):
File "setup.py", line 12, in <module>
distutils.core.setup(ext_modules=Cython.Build.cythonize(packpaths, nthreads=buildthreads, compiler_directives={'language_level': 3, 'profile': True}, annotate=True))
File "...... | AttributeError |
def file_reporter(self, filename):
# TODO: let coverage.py handle .py files itself
# ext = os.path.splitext(filename)[1].lower()
# if ext == '.py':
# from coverage.python import PythonFileReporter
# return PythonFileReporter(filename)
filename = canonical_filename(os.path.abspath(filename... | def file_reporter(self, filename):
# TODO: let coverage.py handle .py files itself
# ext = os.path.splitext(filename)[1].lower()
# if ext == '.py':
# from coverage.python import PythonFileReporter
# return PythonFileReporter(filename)
filename = canonical_filename(os.path.abspath(filename... | https://github.com/cython/cython/issues/1985 | $ coveralls
...
Traceback (most recent call last):
File "/home/travis/miniconda/envs/dplenv/bin/coveralls", line 6, in <module>
sys.exit(coveralls.wear())
File "/home/travis/miniconda/envs/dplenv/lib/python3.5/site-packages/coveralls/__init__.py", line 94, in wear
source_files=coverage.coveralls(args.base_dir, ignore_e... | TypeError |
def generate_module_preamble(self, env, options, cimported_modules, metadata, code):
code.put_generated_by()
if metadata:
code.putln("/* BEGIN: Cython Metadata")
code.putln(json.dumps(metadata, indent=4, sort_keys=True))
code.putln("END: Cython Metadata */")
code.putln("")
co... | def generate_module_preamble(self, env, options, cimported_modules, metadata, code):
code.put_generated_by()
if metadata:
code.putln("/* BEGIN: Cython Metadata")
code.putln(json.dumps(metadata, indent=4, sort_keys=True))
code.putln("END: Cython Metadata */")
code.putln("")
co... | https://github.com/cython/cython/issues/2819 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "test.pyx", line 6, in test.test
File "stringsource", line 15, in string.from_py.__pyx_convert_string_from_py_std__in_string
TypeError: expected bytes, str found | TypeError |
def generate_module_preamble(self, env, options, cimported_modules, metadata, code):
code.put_generated_by()
if metadata:
code.putln("/* BEGIN: Cython Metadata")
code.putln(json.dumps(metadata, indent=4, sort_keys=True))
code.putln("END: Cython Metadata */")
code.putln("")
co... | def generate_module_preamble(self, env, options, cimported_modules, metadata, code):
code.put_generated_by()
if metadata:
code.putln("/* BEGIN: Cython Metadata")
code.putln(json.dumps(metadata, indent=4, sort_keys=True))
code.putln("END: Cython Metadata */")
code.putln("")
co... | https://github.com/cython/cython/issues/2819 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "test.pyx", line 6, in test.test
File "stringsource", line 15, in string.from_py.__pyx_convert_string_from_py_std__in_string
TypeError: expected bytes, str found | TypeError |
def privatize_temps(self, code, exclude_temps=()):
"""
Make any used temporaries private. Before the relevant code block
code.start_collecting_temps() should have been called.
"""
c = self.privatization_insertion_point
self.privatization_insertion_point = None
if self.is_parallel:
s... | def privatize_temps(self, code, exclude_temps=()):
"""
Make any used temporaries private. Before the relevant code block
code.start_collecting_temps() should have been called.
"""
if self.is_parallel:
c = self.privatization_insertion_point
self.temps = temps = code.funcstate.stop_co... | https://github.com/cython/cython/issues/2780 | %%cython
from contextlib import contextmanager
@contextmanager
def tag(name):
print("<%s>" % name)
yield
print("</%s>" % name)
from cython.parallel cimport prange
from libc.stdio cimport printf
def func():
cdef int i
with tag('aaa'):
for i in prange(5, nogil=True): # using "xrange" or "with nogil" works well
prin... | TypeError |
def end_parallel_block(self, code):
"""
To ensure all OpenMP threads have thread states, we ensure the GIL
in each thread (which creates a thread state if it doesn't exist),
after which we release the GIL.
On exit, reacquire the GIL and release the thread state.
If compiled without OpenMP suppo... | def end_parallel_block(self, code):
"""
To ensure all OpenMP threads have thread states, we ensure the GIL
in each thread (which creates a thread state if it doesn't exist),
after which we release the GIL.
On exit, reacquire the GIL and release the thread state.
If compiled without OpenMP suppo... | https://github.com/cython/cython/issues/2780 | %%cython
from contextlib import contextmanager
@contextmanager
def tag(name):
print("<%s>" % name)
yield
print("</%s>" % name)
from cython.parallel cimport prange
from libc.stdio cimport printf
def func():
cdef int i
with tag('aaa'):
for i in prange(5, nogil=True): # using "xrange" or "with nogil" works well
prin... | TypeError |
def end_parallel_control_flow_block(
self, code, break_=False, continue_=False, return_=False
):
"""
This ends the parallel control flow block and based on how the parallel
section was exited, takes the corresponding action. The break_ and
continue_ parameters indicate whether these should be propag... | def end_parallel_control_flow_block(
self, code, break_=False, continue_=False, return_=False
):
"""
This ends the parallel control flow block and based on how the parallel
section was exited, takes the corresponding action. The break_ and
continue_ parameters indicate whether these should be propag... | https://github.com/cython/cython/issues/2780 | %%cython
from contextlib import contextmanager
@contextmanager
def tag(name):
print("<%s>" % name)
yield
print("</%s>" % name)
from cython.parallel cimport prange
from libc.stdio cimport printf
def func():
cdef int i
with tag('aaa'):
for i in prange(5, nogil=True): # using "xrange" or "with nogil" works well
prin... | TypeError |
def generate_execution_code(self, code):
"""
Generate code in the following steps
1) copy any closure variables determined thread-private
into temporaries
2) allocate temps for start, stop and step
3) generate a loop that calculates the total number of steps,
... | def generate_execution_code(self, code):
"""
Generate code in the following steps
1) copy any closure variables determined thread-private
into temporaries
2) allocate temps for start, stop and step
3) generate a loop that calculates the total number of steps,
... | https://github.com/cython/cython/issues/2780 | %%cython
from contextlib import contextmanager
@contextmanager
def tag(name):
print("<%s>" % name)
yield
print("</%s>" % name)
from cython.parallel cimport prange
from libc.stdio cimport printf
def func():
cdef int i
with tag('aaa'):
for i in prange(5, nogil=True): # using "xrange" or "with nogil" works well
prin... | TypeError |
def generate_assignment_code(
self,
rhs,
code,
overloaded_assignment=False,
exception_check=None,
exception_value=None,
):
self.generate_subexpr_evaluation_code(code)
if self.type.is_pyobject:
self.generate_setitem_code(rhs.py_result(), code)
elif self.base.type is bytearray... | def generate_assignment_code(
self,
rhs,
code,
overloaded_assignment=False,
exception_check=None,
exception_value=None,
):
self.generate_subexpr_evaluation_code(code)
if self.type.is_pyobject:
self.generate_setitem_code(rhs.py_result(), code)
elif self.base.type is bytearray... | https://github.com/cython/cython/issues/2671 | python setup.py build_ext
Compiling cy_vec_wrapper.pyx because it changed.
[1/1] Cythonizing cy_vec_wrapper.pyx
/home/harding/.local/lib/python2.7/site-packages/Cython/Compiler/Main.py:367: FutureWarning: Cython directive 'language_level' not set, using 2 for now (Py2). This will change in a later release! File: /home/... | AttributeError |
def _handle_simple_method_dict_pop(self, node, function, args, is_unbound_method):
"""Replace dict.pop() by a call to _PyDict_Pop()."""
if len(args) == 2:
args.append(ExprNodes.NullNode(node.pos))
elif len(args) != 3:
self._error_wrong_arg_count("dict.pop", node, args, "2 or 3")
retu... | def _handle_simple_method_dict_pop(self, node, function, args, is_unbound_method):
"""Replace dict.pop() by a call to _PyDict_Pop()."""
if len(args) == 2:
args.append(ExprNodes.NullNode(node.pos))
elif len(args) != 3:
self._error_wrong_arg_count("dict.pop", node, args, "2 or 3")
retu... | https://github.com/cython/cython/issues/2152 | Traceback (most recent call last):
File "run_cython.py", line 2, in <module>
main()
File "cython_ext_type_none.pyx", line 12, in cython_ext_type_none.main
A = MyClass() # This doesn't work
File "cython_ext_type_none.pyx", line 7, in cython_ext_type_none.MyClass.__init__
self.attr = kwargs.pop('attr', None)
TypeError: ... | TypeError |
def generate_type_ready_code(self, env, entry, code):
# Generate a call to PyType_Ready for an extension
# type defined in this module.
type = entry.type
typeobj_cname = type.typeobj_cname
scope = type.scope
if scope: # could be None if there was an error
if entry.visibility != "extern"... | def generate_type_ready_code(self, env, entry, code):
# Generate a call to PyType_Ready for an extension
# type defined in this module.
type = entry.type
typeobj_cname = type.typeobj_cname
scope = type.scope
if scope: # could be None if there was an error
if entry.visibility != "extern"... | https://github.com/cython/cython/issues/2019 | [sagelib-8.1.rc2] [1/2] Cythonizing sage/libs/pynac/constant.pyx
[sagelib-8.1.rc2] [2/2] Cythonizing sage/libs/pynac/pynac.pyx
[sagelib-8.1.rc2] Traceback (most recent call last):
[sagelib-8.1.rc2] File "/home/ralf/sage/local/lib/python2.7/site-packages/Cython/Build/Dependencies.py", line 1179, in cythonize_one_helpe... | KeyError |
def create_extension_list(
patterns,
exclude=None,
ctx=None,
aliases=None,
quiet=False,
language=None,
exclude_failures=False,
):
if language is not None:
print(
'Please put "# distutils: language=%s" in your .pyx or .pxd file(s)'
% language
)
... | def create_extension_list(
patterns,
exclude=None,
ctx=None,
aliases=None,
quiet=False,
language=None,
exclude_failures=False,
):
if language is not None:
print(
'Please put "# distutils: language=%s" in your .pyx or .pxd file(s)'
% language
)
... | https://github.com/cython/cython/issues/1879 | running build_ext
Traceback (most recent call last):
File "setup.py", line 278, in <module>
**setup_args
File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.6/distuti... | ValueError |
def create_extension_list(
patterns,
exclude=None,
ctx=None,
aliases=None,
quiet=False,
language=None,
exclude_failures=False,
):
if language is not None:
print(
'Please put "# distutils: language=%s" in your .pyx or .pxd file(s)'
% language
)
... | def create_extension_list(
patterns,
exclude=None,
ctx=None,
aliases=None,
quiet=False,
language=None,
exclude_failures=False,
):
if language is not None:
print(
'Please put "# distutils: language=%s" in your .pyx or .pxd file(s)'
% language
)
... | https://github.com/cython/cython/issues/1879 | running build_ext
Traceback (most recent call last):
File "setup.py", line 278, in <module>
**setup_args
File "/usr/lib64/python2.6/distutils/core.py", line 152, in setup
dist.run_commands()
File "/usr/lib64/python2.6/distutils/dist.py", line 975, in run_commands
self.run_command(cmd)
File "/usr/lib64/python2.6/distuti... | ValueError |
def get_if_raw_addr(ifname):
"""Returns the IPv4 address configured on 'ifname', packed with inet_pton.""" # noqa: E501
ifname = network_name(ifname)
# Get ifconfig output
subproc = subprocess.Popen(
[conf.prog.ifconfig, ifname],
close_fds=True,
stdout=subprocess.PIPE,
... | def get_if_raw_addr(ifname):
"""Returns the IPv4 address configured on 'ifname', packed with inet_pton.""" # noqa: E501
ifname = network_name(ifname)
# Get ifconfig output
subproc = subprocess.Popen(
[conf.prog.ifconfig, ifname],
close_fds=True,
stdout=subprocess.PIPE,
... | https://github.com/secdev/scapy/issues/3051 | % scapy
scapy.__version__
'2.4.4.dev265'
conf.use_pcap
False
pkt = sr1(IP(dst="192.168.43.5")/UDP(sport=137, dport=137), timeout=2, verbose=0)
Traceback (most recent call last):
File "/Users/user/.pyenv/versions/3.8.1/lib/python3.8/site-packages/scapy/arch/bpf/supersocket.py", line 73, in __init__
fcntl.ioctl(self.ins,... | OSError |
def get_if_raw_hwaddr(ifname):
"""Returns the packed MAC address configured on 'ifname'."""
NULL_MAC_ADDRESS = b"\x00" * 6
ifname = network_name(ifname)
# Handle the loopback interface separately
if ifname == conf.loopback_name:
return (ARPHDR_LOOPBACK, NULL_MAC_ADDRESS)
# Get ifconfi... | def get_if_raw_hwaddr(ifname):
"""Returns the packed MAC address configured on 'ifname'."""
NULL_MAC_ADDRESS = b"\x00" * 6
ifname = network_name(ifname)
# Handle the loopback interface separately
if ifname == conf.loopback_name:
return (ARPHDR_LOOPBACK, NULL_MAC_ADDRESS)
# Get ifconfi... | https://github.com/secdev/scapy/issues/3051 | % scapy
scapy.__version__
'2.4.4.dev265'
conf.use_pcap
False
pkt = sr1(IP(dst="192.168.43.5")/UDP(sport=137, dport=137), timeout=2, verbose=0)
Traceback (most recent call last):
File "/Users/user/.pyenv/versions/3.8.1/lib/python3.8/site-packages/scapy/arch/bpf/supersocket.py", line 73, in __init__
fcntl.ioctl(self.ins,... | OSError |
def read_routes():
# type: () -> List[Tuple[int, int, str, str, str, int]]
"""Return a list of IPv4 routes than can be used by Scapy.
This function parses netstat.
"""
if SOLARIS:
f = os.popen("netstat -rvn -f inet")
elif FREEBSD:
f = os.popen("netstat -rnW -f inet") # -W to sh... | def read_routes():
# type: () -> List[Tuple[int, int, str, str, str, int]]
"""Return a list of IPv4 routes than can be used by Scapy.
This function parses netstat.
"""
if SOLARIS:
f = os.popen("netstat -rvn -f inet")
elif FREEBSD:
f = os.popen("netstat -rnW -f inet") # -W to sh... | https://github.com/secdev/scapy/issues/3051 | % scapy
scapy.__version__
'2.4.4.dev265'
conf.use_pcap
False
pkt = sr1(IP(dst="192.168.43.5")/UDP(sport=137, dport=137), timeout=2, verbose=0)
Traceback (most recent call last):
File "/Users/user/.pyenv/versions/3.8.1/lib/python3.8/site-packages/scapy/arch/bpf/supersocket.py", line 73, in __init__
fcntl.ioctl(self.ins,... | OSError |
def __init__(
self,
iface=None,
type=ETH_P_ALL,
promisc=None,
filter=None,
nofilter=0,
monitor=False,
):
self.fd_flags = None
self.assigned_interface = None
# SuperSocket mandatory variables
if promisc is None:
self.promisc = conf.sniff_promisc
else:
self... | def __init__(
self,
iface=None,
type=ETH_P_ALL,
promisc=None,
filter=None,
nofilter=0,
monitor=False,
):
self.fd_flags = None
self.assigned_interface = None
# SuperSocket mandatory variables
if promisc is None:
self.promisc = conf.sniff_promisc
else:
self... | https://github.com/secdev/scapy/issues/3065 | from scapy.config import conf
from scapy.sendrecv import AsyncSniffer
conf.L2socket()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/bdraco/Library/Python/3.8/lib/python/site-packages/scapy/arch/bpf/supersocket.py", line 242, in __init__
super(L2bpfListenSocket, self).__init__(*args... | AttributeError |
def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the client_random
along with the raw string representing this handshake message.
"""
super(TLSClientHello, self).tls_session_update(msg_str)
s = self.tls_session
s.advertised_tls_version = self.version
# ... | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the client_random
along with the raw string representing this handshake message.
"""
super(TLSClientHello, self).tls_session_update(msg_str)
s = self.tls_session
s.advertised_tls_version = self.version
# ... | https://github.com/secdev/scapy/issues/2778 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-4c9f13dcdcd8> in <module>
----> 1 r2 = TLS(pcap[1].load, tls_session=r1.tls_session.mirror())
~/scapy_venv/lib/python3.7/site-packages/scapy/base_clas... | TypeError |
def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the client_random
along with the raw string representing this handshake message.
"""
super(TLS13ClientHello, self).tls_session_update(msg_str)
s = self.tls_session
if self.sidlen and self.sidlen > 0:
... | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the client_random
along with the raw string representing this handshake message.
"""
super(TLS13ClientHello, self).tls_session_update(msg_str)
s = self.tls_session
if self.sidlen and self.sidlen > 0:
... | https://github.com/secdev/scapy/issues/2778 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-4c9f13dcdcd8> in <module>
----> 1 r2 = TLS(pcap[1].load, tls_session=r1.tls_session.mirror())
~/scapy_venv/lib/python3.7/site-packages/scapy/base_clas... | TypeError |
def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the server_random
along with the raw string representing this handshake message.
We also store the session_id, the cipher suite (if recognized),
the compression method, and finally we instantiate the pending write
... | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the server_random
along with the raw string representing this handshake message.
We also store the session_id, the cipher suite (if recognized),
the compression method, and finally we instantiate the pending write
... | https://github.com/secdev/scapy/issues/2778 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-4c9f13dcdcd8> in <module>
----> 1 r2 = TLS(pcap[1].load, tls_session=r1.tls_session.mirror())
~/scapy_venv/lib/python3.7/site-packages/scapy/base_clas... | TypeError |
def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the server_random along with
the raw string representing this handshake message. We also store the
cipher suite (if recognized), and finally we instantiate the write and
read connection states.
"""
s = self.t... | def tls_session_update(self, msg_str):
"""
Either for parsing or building, we store the server_random along with
the raw string representing this handshake message. We also store the
cipher suite (if recognized), and finally we instantiate the write and
read connection states.
"""
super(TLS1... | https://github.com/secdev/scapy/issues/2778 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-4c9f13dcdcd8> in <module>
----> 1 r2 = TLS(pcap[1].load, tls_session=r1.tls_session.mirror())
~/scapy_venv/lib/python3.7/site-packages/scapy/base_clas... | TypeError |
def m2i(self, pkt, m):
"""
Try to parse one of the TLS subprotocols (ccs, alert, handshake or
application_data). This is used inside a loop managed by .getfield().
"""
cls = Raw
if pkt.type == 22:
if len(m) >= 1:
msgtype = orb(m[0])
# If a version was agreed on by... | def m2i(self, pkt, m):
"""
Try to parse one of the TLS subprotocols (ccs, alert, handshake or
application_data). This is used inside a loop managed by .getfield().
"""
cls = Raw
if pkt.type == 22:
if len(m) >= 1:
msgtype = orb(m[0])
if (pkt.tls_session.advertised_... | https://github.com/secdev/scapy/issues/2778 | ---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-5-4c9f13dcdcd8> in <module>
----> 1 r2 = TLS(pcap[1].load, tls_session=r1.tls_session.mirror())
~/scapy_venv/lib/python3.7/site-packages/scapy/base_clas... | TypeError |
def addfield(self, pkt, s, i):
"""
There is a hack with the _ExtensionsField.i2len. It works only because
we expect _ExtensionsField.i2m to return a string of the same size (if
not of the same value) upon successive calls (e.g. through i2len here,
then i2m when directly building the _ExtensionsField... | def addfield(self, pkt, s, i):
"""
There is a hack with the _ExtensionsField.i2len. It works only because
we expect _ExtensionsField.i2m to return a string of the same size (if
not of the same value) upon successive calls (e.g. through i2len here,
then i2m when directly building the _ExtensionsField... | https://github.com/secdev/scapy/issues/2763 | Traceback (most recent call last):
File "utils/poc.py", line 51, in <module>
test_failed_fn()
File "utils/poc.py", line 47, in test_failed_fn
extract_tls_payloads(os.path.join(data_root, fn), 900)
File "utils/poc.py", line 19, in extract_tls_payloads
payload = bytes(p[TLS])
File "/data1/wangqian/venv_py3/lib/python3.7/... | TypeError |
def getfield(self, pkt, s):
tmp_len = self.length_from(pkt) or 0
if tmp_len <= 0:
return s, []
return s[tmp_len:], self.m2i(pkt, s[:tmp_len])
| def getfield(self, pkt, s):
tmp_len = self.length_from(pkt)
if tmp_len is None:
return s, []
return s[tmp_len:], self.m2i(pkt, s[:tmp_len])
| https://github.com/secdev/scapy/issues/2763 | Traceback (most recent call last):
File "utils/poc.py", line 51, in <module>
test_failed_fn()
File "utils/poc.py", line 47, in test_failed_fn
extract_tls_payloads(os.path.join(data_root, fn), 900)
File "utils/poc.py", line 19, in extract_tls_payloads
payload = bytes(p[TLS])
File "/data1/wangqian/venv_py3/lib/python3.7/... | TypeError |
def build(self, *args, **kargs):
r"""
We overload build() method in order to provide a valid default value
for params based on TLS session if not provided. This cannot be done by
overriding i2m() because the method is called on a copy of the packet.
The 'params' field is built according to key_exch... | def build(self, *args, **kargs):
r"""
We overload build() method in order to provide a valid default value
for params based on TLS session if not provided. This cannot be done by
overriding i2m() because the method is called on a copy of the packet.
The 'params' field is built according to key_exch... | https://github.com/secdev/scapy/issues/2763 | Traceback (most recent call last):
File "utils/poc.py", line 51, in <module>
test_failed_fn()
File "utils/poc.py", line 47, in test_failed_fn
extract_tls_payloads(os.path.join(data_root, fn), 900)
File "utils/poc.py", line 19, in extract_tls_payloads
payload = bytes(p[TLS])
File "/data1/wangqian/venv_py3/lib/python3.7/... | TypeError |
def m2i(self, pkt, m):
s = pkt.tls_session
tmp_len = self.length_from(pkt)
if s.prcs:
cls = s.prcs.key_exchange.server_kx_msg_cls(m)
if cls is None:
return Raw(m[:tmp_len]) / Padding(m[tmp_len:])
return cls(m, tls_session=s)
else:
try:
p = ServerDH... | def m2i(self, pkt, m):
s = pkt.tls_session
tmp_len = self.length_from(pkt)
if s.prcs:
cls = s.prcs.key_exchange.server_kx_msg_cls(m)
if cls is None:
return None, Raw(m[:tmp_len]) / Padding(m[tmp_len:])
return cls(m, tls_session=s)
else:
try:
p = Se... | https://github.com/secdev/scapy/issues/2763 | Traceback (most recent call last):
File "utils/poc.py", line 51, in <module>
test_failed_fn()
File "utils/poc.py", line 47, in test_failed_fn
extract_tls_payloads(os.path.join(data_root, fn), 900)
File "utils/poc.py", line 19, in extract_tls_payloads
payload = bytes(p[TLS])
File "/data1/wangqian/venv_py3/lib/python3.7/... | TypeError |
def _process_packet(self, pkt):
"""Process each packet: matches the TCP seq/ack numbers
to follow the TCP streams, and orders the fragments.
"""
if self.app:
# Special mode: Application layer. Use on top of TCP
pay_class = pkt.__class__
if not hasattr(pay_class, "tcp_reassemble")... | def _process_packet(self, pkt):
"""Process each packet: matches the TCP seq/ack numbers
to follow the TCP streams, and orders the fragments.
"""
if self.app:
# Special mode: Application layer. Use on top of TCP
pay_class = pkt.__class__
if not hasattr(pay_class, "tcp_reassemble")... | https://github.com/secdev/scapy/issues/2763 | Traceback (most recent call last):
File "utils/poc.py", line 51, in <module>
test_failed_fn()
File "utils/poc.py", line 47, in test_failed_fn
extract_tls_payloads(os.path.join(data_root, fn), 900)
File "utils/poc.py", line 19, in extract_tls_payloads
payload = bytes(p[TLS])
File "/data1/wangqian/venv_py3/lib/python3.7/... | TypeError |
def __init__(self, filename, fdesc, magic):
RawPcapReader.__init__(self, filename, fdesc, magic)
try:
self.LLcls = conf.l2types[self.linktype]
except KeyError:
warning(
"PcapReader: unknown LL type [%i]/[%#x]. Using Raw packets"
% (self.linktype, self.linktype)
... | def __init__(self, filename, fdesc, magic):
RawPcapReader.__init__(self, filename, fdesc, magic)
try:
self.LLcls = conf.l2types[self.linktype]
except KeyError:
warning(
"PcapReader: unknown LL type [%i]/[%#x]. Using Raw packets"
% (self.linktype, self.linktype)
... | https://github.com/secdev/scapy/issues/2742 | $ cat test.py
import sys
import scapy
import scapy.utils
scapy.utils.rdpcap(sys.argv[1])
$ python3 test.py sample.pcap
Traceback (most recent call last):
File "/home/user/ven/lib/python3.8/site-packages/scapy/utils.py", line 1139, in read_packet
p = self.LLcls(s)
TypeError: 'NoneType' object is not callable
During ha... | TypeError |
def read_packet(self, size=MTU):
rp = super(PcapReader, self).read_packet(size=size)
if rp is None:
raise EOFError
s, pkt_info = rp
try:
p = self.LLcls(s)
except KeyboardInterrupt:
raise
except Exception:
if conf.debug_dissector:
from scapy.sendrecv i... | def read_packet(self, size=MTU):
rp = super(PcapReader, self).read_packet(size=size)
if rp is None:
raise EOFError
s, pkt_info = rp
try:
p = self.LLcls(s)
except KeyboardInterrupt:
raise
except Exception:
if conf.debug_dissector:
from scapy.sendrecv i... | https://github.com/secdev/scapy/issues/2742 | $ cat test.py
import sys
import scapy
import scapy.utils
scapy.utils.rdpcap(sys.argv[1])
$ python3 test.py sample.pcap
Traceback (most recent call last):
File "/home/user/ven/lib/python3.8/site-packages/scapy/utils.py", line 1139, in read_packet
p = self.LLcls(s)
TypeError: 'NoneType' object is not callable
During ha... | TypeError |
def read_packet(self, size=MTU):
rp = super(PcapNgReader, self).read_packet(size=size)
if rp is None:
raise EOFError
s, (linktype, tsresol, tshigh, tslow, wirelen) = rp
try:
p = conf.l2types[linktype](s)
except KeyboardInterrupt:
raise
except Exception:
if conf.de... | def read_packet(self, size=MTU):
rp = super(PcapNgReader, self).read_packet(size=size)
if rp is None:
raise EOFError
s, (linktype, tsresol, tshigh, tslow, wirelen) = rp
try:
p = conf.l2types[linktype](s)
except KeyboardInterrupt:
raise
except Exception:
if conf.de... | https://github.com/secdev/scapy/issues/2742 | $ cat test.py
import sys
import scapy
import scapy.utils
scapy.utils.rdpcap(sys.argv[1])
$ python3 test.py sample.pcap
Traceback (most recent call last):
File "/home/user/ven/lib/python3.8/site-packages/scapy/utils.py", line 1139, in read_packet
p = self.LLcls(s)
TypeError: 'NoneType' object is not callable
During ha... | TypeError |
def m2i(self, pkt, val):
ret = []
for v in val:
byte = orb(v)
left = byte >> 4
right = byte & 0xF
if left == 0xF:
ret.append(TBCD_TO_ASCII[right : right + 1])
else:
ret += [TBCD_TO_ASCII[right : right + 1], TBCD_TO_ASCII[left : left + 1]]
retur... | def m2i(self, pkt, val):
ret = []
for v in val:
byte = orb(v)
left = byte >> 4
right = byte & 0xF
if left == 0xF:
ret.append(TBCD_TO_ASCII[right : right + 1])
else:
ret += [TBCD_TO_ASCII[right : right + 1], TBCD_TO_ASCII[left : left + 1]] # noqa: ... | https://github.com/secdev/scapy/issues/2485 | from scapy.contrib.gtp_v2 import IE_IMSI
ie = IE_IMSI(ietype='IMSI', length=8, IMSI='2080112345670000')
ie
<IE_IMSI ietype=IMSI length=8 IMSI='2080112345670000' |>
len(ie)
Traceback (most recent call last):
File "/usr/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "<console>", line 1, in <mod... | ValueError |
def i2m(self, pkt, val):
if not isinstance(val, bytes):
val = bytes_encode(val)
ret_string = b""
for i in range(0, len(val), 2):
tmp = val[i : i + 2]
if len(tmp) == 2:
ret_string += chb(int(tmp[::-1], 16))
else:
ret_string += chb(int(b"F" + tmp[:1], 16... | def i2m(self, pkt, val):
val = str(val)
ret_string = ""
for i in range(0, len(val), 2):
tmp = val[i : i + 2]
if len(tmp) == 2:
ret_string += chr(int(tmp[1] + tmp[0], 16))
else:
ret_string += chr(int("F" + tmp[0], 16))
return ret_string
| https://github.com/secdev/scapy/issues/2485 | from scapy.contrib.gtp_v2 import IE_IMSI
ie = IE_IMSI(ietype='IMSI', length=8, IMSI='2080112345670000')
ie
<IE_IMSI ietype=IMSI length=8 IMSI='2080112345670000' |>
len(ie)
Traceback (most recent call last):
File "/usr/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "<console>", line 1, in <mod... | ValueError |
def i2m(self, pkt, s):
if not isinstance(s, bytes):
s = bytes_encode(s)
s = b"".join(chb(len(x)) + x for x in s.split(b"."))
return s
| def i2m(self, pkt, s):
s = b"".join(chb(len(x)) + x for x in s.split("."))
return s
| https://github.com/secdev/scapy/issues/2485 | from scapy.contrib.gtp_v2 import IE_IMSI
ie = IE_IMSI(ietype='IMSI', length=8, IMSI='2080112345670000')
ie
<IE_IMSI ietype=IMSI length=8 IMSI='2080112345670000' |>
len(ie)
Traceback (most recent call last):
File "/usr/lib/python3.5/code.py", line 91, in runcode
exec(code, self.locals)
File "<console>", line 1, in <mod... | ValueError |
def __add__(self, other, **kwargs):
return EDecimal(Decimal.__add__(self, Decimal(other), **kwargs))
| def __add__(self, other, **kwargs):
return EDecimal(Decimal.__add__(self, other, **kwargs))
| https://github.com/secdev/scapy/issues/2433 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy-2.4.3.dev227-py2.7.egg/scapy/utils.py", line 67, in __mul__
return EDecimal(Decimal.__mul__(self, other, **kwargs))
File "/usr/lib/python2.7/decimal.py", line 657, in __new__
raise TypeError("Cannot... | TypeError |
def __sub__(self, other, **kwargs):
return EDecimal(Decimal.__sub__(self, Decimal(other), **kwargs))
| def __sub__(self, other, **kwargs):
return EDecimal(Decimal.__sub__(self, other, **kwargs))
| https://github.com/secdev/scapy/issues/2433 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy-2.4.3.dev227-py2.7.egg/scapy/utils.py", line 67, in __mul__
return EDecimal(Decimal.__mul__(self, other, **kwargs))
File "/usr/lib/python2.7/decimal.py", line 657, in __new__
raise TypeError("Cannot... | TypeError |
def __mul__(self, other, **kwargs):
return EDecimal(Decimal.__mul__(self, Decimal(other), **kwargs))
| def __mul__(self, other, **kwargs):
return EDecimal(Decimal.__mul__(self, other, **kwargs))
| https://github.com/secdev/scapy/issues/2433 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy-2.4.3.dev227-py2.7.egg/scapy/utils.py", line 67, in __mul__
return EDecimal(Decimal.__mul__(self, other, **kwargs))
File "/usr/lib/python2.7/decimal.py", line 657, in __new__
raise TypeError("Cannot... | TypeError |
def __truediv__(self, other, **kwargs):
return EDecimal(Decimal.__truediv__(self, Decimal(other), **kwargs))
| def __truediv__(self, other, **kwargs):
return EDecimal(Decimal.__truediv__(self, other, **kwargs))
| https://github.com/secdev/scapy/issues/2433 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy-2.4.3.dev227-py2.7.egg/scapy/utils.py", line 67, in __mul__
return EDecimal(Decimal.__mul__(self, other, **kwargs))
File "/usr/lib/python2.7/decimal.py", line 657, in __new__
raise TypeError("Cannot... | TypeError |
def __floordiv__(self, other, **kwargs):
return EDecimal(Decimal.__floordiv__(self, Decimal(other), **kwargs))
| def __floordiv__(self, other, **kwargs):
return EDecimal(Decimal.__floordiv__(self, other, **kwargs))
| https://github.com/secdev/scapy/issues/2433 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy-2.4.3.dev227-py2.7.egg/scapy/utils.py", line 67, in __mul__
return EDecimal(Decimal.__mul__(self, other, **kwargs))
File "/usr/lib/python2.7/decimal.py", line 657, in __new__
raise TypeError("Cannot... | TypeError |
def __div__(self, other, **kwargs):
return EDecimal(Decimal.__div__(self, Decimal(other), **kwargs))
| def __div__(self, other, **kwargs):
return EDecimal(Decimal.__div__(self, other, **kwargs))
| https://github.com/secdev/scapy/issues/2433 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy-2.4.3.dev227-py2.7.egg/scapy/utils.py", line 67, in __mul__
return EDecimal(Decimal.__mul__(self, other, **kwargs))
File "/usr/lib/python2.7/decimal.py", line 657, in __new__
raise TypeError("Cannot... | TypeError |
def __mod__(self, other, **kwargs):
return EDecimal(Decimal.__mod__(self, Decimal(other), **kwargs))
| def __mod__(self, other, **kwargs):
return EDecimal(Decimal.__mod__(self, other, **kwargs))
| https://github.com/secdev/scapy/issues/2433 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy-2.4.3.dev227-py2.7.egg/scapy/utils.py", line 67, in __mul__
return EDecimal(Decimal.__mul__(self, other, **kwargs))
File "/usr/lib/python2.7/decimal.py", line 657, in __new__
raise TypeError("Cannot... | TypeError |
def __divmod__(self, other, **kwargs):
return EDecimal(Decimal.__divmod__(self, Decimal(other), **kwargs))
| def __divmod__(self, other, **kwargs):
return EDecimal(Decimal.__divmod__(self, other, **kwargs))
| https://github.com/secdev/scapy/issues/2433 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy-2.4.3.dev227-py2.7.egg/scapy/utils.py", line 67, in __mul__
return EDecimal(Decimal.__mul__(self, other, **kwargs))
File "/usr/lib/python2.7/decimal.py", line 657, in __new__
raise TypeError("Cannot... | TypeError |
def __pow__(self, other, **kwargs):
return EDecimal(Decimal.__pow__(self, Decimal(other), **kwargs))
| def __pow__(self, other, **kwargs):
return EDecimal(Decimal.__pow__(self, other, **kwargs))
| https://github.com/secdev/scapy/issues/2433 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy-2.4.3.dev227-py2.7.egg/scapy/utils.py", line 67, in __mul__
return EDecimal(Decimal.__mul__(self, other, **kwargs))
File "/usr/lib/python2.7/decimal.py", line 657, in __new__
raise TypeError("Cannot... | TypeError |
def _check_len(self, pkt):
"""Check for odd packet length and pad according to Cisco spec.
This padding is only used for checksum computation. The original
packet should not be altered."""
if len(pkt) % 2:
last_chr = orb(pkt[-1])
if last_chr <= 0x80:
return pkt[:-1] + b"\x00... | def _check_len(self, pkt):
"""Check for odd packet length and pad according to Cisco spec.
This padding is only used for checksum computation. The original
packet should not be altered."""
if len(pkt) % 2:
last_chr = pkt[-1]
if last_chr <= b"\x80":
return pkt[:-1] + b"\x00" ... | https://github.com/secdev/scapy/issues/2413 | root@ubuntu:/workspace/_prototype/rtg-avatar# python
Python 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from scapy.all import *
from scapy.contrib import *
pkt=CDPv2_HDR(vers=2, ttl=180, msg='123')
len(pkt)
Traceback (most recent cal... | TypeError |
def post_build(self, p, pay):
vlannamelen = 4 * ((len(self.vlanname) + 3) // 4)
if self.len is None:
tmp_len = vlannamelen + 12
p = chb(tmp_len & 0xFF) + p[1:]
# Pad vlan name with zeros if vlannamelen > len(vlanname)
tmp_len = vlannamelen - len(self.vlanname)
if tmp_len != 0:
... | def post_build(self, p, pay):
vlannamelen = 4 * ((len(self.vlanname) + 3) // 4)
if self.len is None:
tmp_len = vlannamelen + 12
p = chr(tmp_len & 0xFF) + p[1:]
# Pad vlan name with zeros if vlannamelen > len(vlanname)
tmp_len = vlannamelen - len(self.vlanname)
if tmp_len != 0:
... | https://github.com/secdev/scapy/issues/2413 | root@ubuntu:/workspace/_prototype/rtg-avatar# python
Python 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from scapy.all import *
from scapy.contrib import *
pkt=CDPv2_HDR(vers=2, ttl=180, msg='123')
len(pkt)
Traceback (most recent cal... | TypeError |
def post_build(self, p, pay):
if self.domnamelen is None:
domnamelen = len(self.domname.strip(b"\x00"))
p = p[:3] + chb(domnamelen & 0xFF) + p[4:]
p += pay
return p
| def post_build(self, p, pay):
if self.domnamelen is None:
domnamelen = len(self.domname.strip(b"\x00"))
p = p[:3] + chr(domnamelen & 0xFF) + p[4:]
p += pay
return p
| https://github.com/secdev/scapy/issues/2413 | root@ubuntu:/workspace/_prototype/rtg-avatar# python
Python 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
from scapy.all import *
from scapy.contrib import *
pkt=CDPv2_HDR(vers=2, ttl=180, msg='123')
len(pkt)
Traceback (most recent cal... | TypeError |
def compile_filter(filter_exp, iface=None, linktype=None, promisc=False):
"""Asks libpcap to parse the filter, then build the matching
BPF bytecode.
:param iface: if provided, use the interface to compile
:param linktype: if provided, use the linktype to compile
"""
try:
from scapy.libs... | def compile_filter(filter_exp, iface=None, linktype=None, promisc=False):
"""Asks libpcap to parse the filter, then build the matching
BPF bytecode.
:param iface: if provided, use the interface to compile
:param linktype: if provided, use the linktype to compile
"""
try:
from scapy.libs... | https://github.com/secdev/scapy/issues/2393 | a = Ether(dst='64:A2:F9:A9:2E:A9')/ARP(pdst='192.168.178.0/24')
a.show()
AttributeError
Traceback (most recent call last)<ipython-input-18-97d3136b2c17> in <module>
----> 1 a.show()
/netdisk/home/gpotter/github/scapy/scapy/packet.py in show(self, dump, indent, lvl, label_lvl)
1251 :return: return a hierarchic... | AttributeError |
def __eq__(self, other):
if not other:
return False
if hasattr(other, "parsed"):
p2 = other.parsed
else:
p2, nm2 = self._parse_net(other)
return self.parsed == p2
| def __eq__(self, other):
if hasattr(other, "parsed"):
p2 = other.parsed
else:
p2, nm2 = self._parse_net(other)
return self.parsed == p2
| https://github.com/secdev/scapy/issues/2393 | a = Ether(dst='64:A2:F9:A9:2E:A9')/ARP(pdst='192.168.178.0/24')
a.show()
AttributeError
Traceback (most recent call last)<ipython-input-18-97d3136b2c17> in <module>
----> 1 a.show()
/netdisk/home/gpotter/github/scapy/scapy/packet.py in show(self, dump, indent, lvl, label_lvl)
1251 :return: return a hierarchic... | AttributeError |
def explore(layer=None):
"""Function used to discover the Scapy layers and protocols.
It helps to see which packets exists in contrib or layer files.
params:
- layer: If specified, the function will explore the layer. If not,
the GUI mode will be activated, to browse the available layers... | def explore(layer=None):
"""Function used to discover the Scapy layers and protocols.
It helps to see which packets exists in contrib or layer files.
params:
- layer: If specified, the function will explore the layer. If not,
the GUI mode will be activated, to browse the available layers... | https://github.com/secdev/scapy/issues/2241 | explore()
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/scapy/packet.py", line 1845, in explore
(six.text_type("Cancel"), "cancel")
File "/usr/local/lib/python2.7/dist-packages/prompt_toolkit/shortcuts/dialogs.py", line 60, in button_dialog
with_ba... | AssertionError |
def post_build(self, p, pay):
p += pay
dataofs = self.dataofs
if dataofs is None:
opt_len = len(self.get_field("options").i2m(self, self.options))
dataofs = 5 + ((opt_len + 3) // 4)
dataofs = (dataofs << 4) | orb(p[12]) & 0x0F
p = p[:12] + chb(dataofs & 0xFF) + p[13:]
if ... | def post_build(self, p, pay):
p += pay
dataofs = self.dataofs
if dataofs is None:
dataofs = 5 + (
(len(self.get_field("options").i2m(self, self.options)) + 3) // 4
) # noqa: E501
p = p[:12] + chb((dataofs << 4) | orb(p[12]) & 0x0F) + p[13:]
if self.chksum is None:
... | https://github.com/secdev/scapy/issues/2209 | Traceback (most recent call last):
File "../../test.py", line 6, in <module>
bytes(test)
File "/usr/local/lib/python3.6/site-packages/scapy/packet.py", line 487, in __bytes__
return self.build()
File "/usr/local/lib/python3.6/site-packages/scapy/packet.py", line 607, in build
p = self.do_build()
File "/usr/local/lib/py... | struct.error |
def send(self, x):
iff = x.route()[0]
if iff is None:
iff = conf.iface
sdto = (iff, self.type)
self.outs.bind(sdto)
sn = self.outs.getsockname()
ll = lambda x: x
if type(x) in conf.l3types:
sdto = (iff, conf.l3types[type(x)])
if sn[3] in conf.l2types:
ll = lambda ... | def send(self, x):
iff, a, gw = x.route()
if iff is None:
iff = conf.iface
sdto = (iff, self.type)
self.outs.bind(sdto)
sn = self.outs.getsockname()
ll = lambda x: x
if type(x) in conf.l3types:
sdto = (iff, conf.l3types[type(x)])
if sn[3] in conf.l2types:
ll = lam... | https://github.com/secdev/scapy/issues/2166 | faucet@faucet:~$ sudo bash
root@faucet:~# python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
from scapy.all import *
scapy.all.send(fuzz(ARP(pdst='127.0.0.1')))
Traceback (most ... | TypeError |
def _find_fld(self):
"""Returns the Field subclass to be used, depending on the Packet
instance, or the default subclass.
DEV: since the Packet instance is not provided, we have to use a hack
to guess it. It should only be used if you cannot provide the current
Packet instance (for example, because... | def _find_fld(self):
"""Returns the Field subclass to be used, depending on the Packet
instance, or the default subclass.
DEV: since the Packet instance is not provided, we have to use a hack
to guess it. It should only be used if you cannot provide the current
Packet instance (for example, because... | https://github.com/secdev/scapy/issues/2166 | faucet@faucet:~$ sudo bash
root@faucet:~# python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
from scapy.all import *
scapy.all.send(fuzz(ARP(pdst='127.0.0.1')))
Traceback (most ... | TypeError |
def addfield(self, pkt, s, val):
len_pkt = self.length_from(pkt)
if len_pkt is None:
return s + self.i2m(pkt, val)
return s + struct.pack("%is" % len_pkt, self.i2m(pkt, val))
| def addfield(self, pkt, s, val):
len_pkt = self.length_from(pkt)
return s + struct.pack("%is" % len_pkt, self.i2m(pkt, val))
| https://github.com/secdev/scapy/issues/2166 | faucet@faucet:~$ sudo bash
root@faucet:~# python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
from scapy.all import *
scapy.all.send(fuzz(ARP(pdst='127.0.0.1')))
Traceback (most ... | TypeError |
def route(self):
fld, dst = self.getfield_and_val("pdst")
fld, dst = fld._find_fld_pkt_val(self, dst)
if isinstance(dst, Gen):
dst = next(iter(dst))
if isinstance(fld, IP6Field):
return conf.route6.route(dst)
elif isinstance(fld, IPField):
return conf.route.route(dst)
els... | def route(self):
fld, dst = self.getfield_and_val("pdst")
fld, dst = fld._find_fld_pkt_val(self, dst)
if isinstance(dst, Gen):
dst = next(iter(dst))
if isinstance(fld, IP6Field):
return conf.route6.route(dst)
elif isinstance(fld, IPField):
return conf.route.route(dst)
els... | https://github.com/secdev/scapy/issues/2166 | faucet@faucet:~$ sudo bash
root@faucet:~# python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
from scapy.all import *
scapy.all.send(fuzz(ARP(pdst='127.0.0.1')))
Traceback (most ... | TypeError |
def fuzz(p, _inplace=0):
"""
Transform a layer into a fuzzy layer by replacing some default values
by random objects.
:param p: the Packet instance to fuzz
:returns: the fuzzed packet.
"""
if not _inplace:
p = p.copy()
q = p
while not isinstance(q, NoPayload):
new_de... | def fuzz(p, _inplace=0):
"""Transform a layer into a fuzzy layer by replacing some default values by random objects""" # noqa: E501
if not _inplace:
p = p.copy()
q = p
while not isinstance(q, NoPayload):
for f in q.fields_desc:
if isinstance(f, PacketListField):
... | https://github.com/secdev/scapy/issues/2166 | faucet@faucet:~$ sudo bash
root@faucet:~# python3
Python 3.6.8 (default, Jan 14 2019, 11:02:34)
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
from scapy.all import *
scapy.all.send(fuzz(ARP(pdst='127.0.0.1')))
Traceback (most ... | TypeError |
def read_routes():
if SOLARIS:
f = os.popen("netstat -rvn") # -f inet
elif FREEBSD:
f = os.popen("netstat -rnW") # -W to handle long interface names
else:
f = os.popen("netstat -rn") # -f inet
ok = 0
mtu_present = False
prio_present = False
refs_present = False
... | def read_routes():
if SOLARIS:
f = os.popen("netstat -rvn") # -f inet
elif FREEBSD:
f = os.popen("netstat -rnW") # -W to handle long interface names
else:
f = os.popen("netstat -rn") # -f inet
ok = 0
mtu_present = False
prio_present = False
routes = []
pending_... | https://github.com/secdev/scapy/issues/2134 | import scapy.all as scapy
p = scapy.sniff()
p.summary()
Result:
Traceback (most recent call last):
File "/Users/tom/PycharmProjects/sniffer/main.py", line 2, in <module>
import scapy.all as scapy
File "/Users/tom/PycharmProjects/sniffer/venv/lib/python3.7/site-packages/scapy/sendrecv.py", line 33, in <module>
import... | IndexError |
def sniff(
count=0,
store=True,
offline=None,
prn=None,
lfilter=None,
L2socket=None,
timeout=None,
opened_socket=None,
stop_filter=None,
iface=None,
started_callback=None,
session=None,
*arg,
**karg,
):
"""Sniff packets and return a list of packets.
Args:... | def sniff(
count=0,
store=True,
offline=None,
prn=None,
lfilter=None,
L2socket=None,
timeout=None,
opened_socket=None,
stop_filter=None,
iface=None,
started_callback=None,
session=None,
*arg,
**karg,
):
"""Sniff packets and return a list of packets.
Args:... | https://github.com/secdev/scapy/issues/2052 | $ ipython3
In [1]: from scapy.utils import strxor
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-90b66f0baa84> in <module>
----> 1 from scapy.utils import strxor
~/src/scapy/scapy/utils.py in <mod... | ImportError |
def tcpdump(
pktlist,
dump=False,
getfd=False,
args=None,
prog=None,
getproc=False,
quiet=False,
use_tempfile=None,
read_stdin_opts=None,
linktype=None,
wait=True,
):
"""Run tcpdump or tshark on a list of packets.
When using ``tcpdump`` on OSX (``prog == conf.pro... | def tcpdump(
pktlist,
dump=False,
getfd=False,
args=None,
prog=None,
getproc=False,
quiet=False,
use_tempfile=None,
read_stdin_opts=None,
linktype=None,
wait=True,
):
"""Run tcpdump or tshark on a list of packets.
When using ``tcpdump`` on OSX (``prog == conf.pro... | https://github.com/secdev/scapy/issues/2052 | $ ipython3
In [1]: from scapy.utils import strxor
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-90b66f0baa84> in <module>
----> 1 from scapy.utils import strxor
~/src/scapy/scapy/utils.py in <mod... | ImportError |
def network_stats(self):
"""Return a dictionary containing a summary of the Dot11
elements fields
"""
summary = {}
crypto = set()
p = self.payload
while isinstance(p, Dot11Elt):
if p.ID == 0:
summary["ssid"] = plain_str(p.info)
elif p.ID == 3:
summary[... | def network_stats(self):
"""Return a dictionary containing a summary of the Dot11
elements fields
"""
summary = {}
crypto = set()
p = self.payload
while isinstance(p, Dot11Elt):
if p.ID == 0:
summary["ssid"] = plain_str(p.info)
elif p.ID == 3:
summary[... | https://github.com/secdev/scapy/issues/1872 | Traceback (most recent call last):
File "min_script.py", line 25, in <module>
sniff(iface="mon0", lfilter=filter_beacon, prn=print_ap)
File "/usr/lib/python3.7/site-packages/scapy/sendrecv.py", line 886, in sniff
r = prn(p)
File "min_script.py", line 12, in print_ap
netstats = p[Dot11Beacon].network_stats()
File "/usr/... | TypeError |
def _set_conf_sockets():
"""Populate the conf.L2Socket and conf.L3Socket
according to the various use_* parameters
"""
if conf.use_bpf and not BSD:
Interceptor.set_from_hook(conf, "use_bpf", False)
raise ScapyInvalidPlatformException("BSD-like (OSX, *BSD...) only !")
if conf.use_winp... | def _set_conf_sockets():
"""Populate the conf.L2Socket and conf.L3Socket
according to the various use_* parameters
"""
if conf.use_bpf and not DARWIN:
Interceptor.set_from_hook(conf, "use_bpf", False)
raise ScapyInvalidPlatformException("Darwin (OSX) only !")
if conf.use_winpcapy and... | https://github.com/secdev/scapy/issues/1793 | Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/user/venv/lib/python3.6/site-packages/scapy/all.py", line 18, in <module>
from scapy.arch import *
File "/home/user/venv/lib/python3.6/site-packages/scapy/arch/__init__.py", line 63, in <module>
conf.use_bpf = True
File "/home/user/venv/... | scapy.error.ScapyInvalidPlatformException |
def get_ip_from_name(ifname, v6=False):
"""Backward compatibility: indirectly calls get_ips
Deprecated."""
return get_ips(v6=v6).get(ifname, [""])[0]
| def get_ip_from_name(ifname, v6=False):
"""Backward compatibility: indirectly calls get_ips
Deprecated."""
return get_ips(v6=v6).get(ifname, "")[0]
| https://github.com/secdev/scapy/issues/1727 | from scapy.all import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "scapy\all.py", line 18, in <module>
from scapy.arch import *
File "scapy\arch\__init__.py", line 73, in <module>
from scapy.arch.windows import * # noqa F403
File "scapy\arch\windows\__init__.py", line 953, in <module>... | IndexError |
def load_from_powershell(self):
if not conf.prog.os_access:
return
ifaces_ips = None
for i in get_windows_if_list():
try:
interface = NetworkInterface(i)
self.data[interface.guid] = interface
# If no IP address was detected using winpcap and if
... | def load_from_powershell(self):
if not conf.prog.os_access:
return
ifaces_ips = None
for i in get_windows_if_list():
try:
interface = NetworkInterface(i)
self.data[interface.guid] = interface
# If no IP address was detected using winpcap and if
... | https://github.com/secdev/scapy/issues/1727 | from scapy.all import *
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "scapy\all.py", line 18, in <module>
from scapy.arch import *
File "scapy\arch\__init__.py", line 73, in <module>
from scapy.arch.windows import * # noqa F403
File "scapy\arch\windows\__init__.py", line 953, in <module>... | IndexError |
def _exec_query_ps(cmd, fields):
"""Execute a PowerShell query, using the cmd command,
and select and parse the provided fields.
"""
if not conf.prog.powershell:
raise OSError("Scapy could not detect powershell !")
# Build query
query_cmd = cmd + [
"|",
"select %s" % ", "... | def _exec_query_ps(cmd, fields):
"""Execute a PowerShell query, using the cmd command,
and select and parse the provided fields.
"""
if not conf.prog.powershell:
raise OSError("Scapy could not detect powershell !")
# Build query
query_cmd = cmd + [
"|",
"select %s" % ", "... | https://github.com/secdev/scapy/issues/1718 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "scapy\all.py", line 18, in <module>
from scapy.arch import *
File "scapy\arch\__init__.py", line 73, in <module>
from scapy.arch.windows import * # noqa F403
File "scapy\arch\windows\__init__.py", line 946, in <module>
IFACES.load_from_power... | IndexError |
def get_ips(v6=False):
"""Returns all available IPs matching to interfaces, using the windows system.
Should only be used as a WinPcapy fallback."""
res = {}
for descr, ipaddr in exec_query(
["Get-WmiObject", "Win32_NetworkAdapterConfiguration"],
["Description", "IPAddress"],
):
... | def get_ips(v6=False):
"""Returns all available IPs matching to interfaces, using the windows system.
Should only be used as a WinPcapy fallback."""
res = {}
for descr, ipaddr in exec_query(
["Get-WmiObject", "Win32_NetworkAdapterConfiguration"],
["Description", "IPAddress"],
):
... | https://github.com/secdev/scapy/issues/1718 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "scapy\all.py", line 18, in <module>
from scapy.arch import *
File "scapy\arch\__init__.py", line 73, in <module>
from scapy.arch.windows import * # noqa F403
File "scapy\arch\windows\__init__.py", line 946, in <module>
IFACES.load_from_power... | IndexError |
def get_ip_from_name(ifname, v6=False):
"""Backward compatibility: indirectly calls get_ips
Deprecated."""
return get_ips(v6=v6).get(ifname, "")[0]
| def get_ip_from_name(ifname, v6=False):
"""Backward compatibility: indirectly calls get_ips
Deprecated."""
return get_ips(v6=v6).get(ifname, "")
| https://github.com/secdev/scapy/issues/1718 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "scapy\all.py", line 18, in <module>
from scapy.arch import *
File "scapy\arch\__init__.py", line 73, in <module>
from scapy.arch.windows import * # noqa F403
File "scapy\arch\windows\__init__.py", line 946, in <module>
IFACES.load_from_power... | IndexError |
def load_from_powershell(self):
if not conf.prog.os_access:
return
ifaces_ips = None
for i in get_windows_if_list():
try:
interface = NetworkInterface(i)
self.data[interface.guid] = interface
# If no IP address was detected using winpcap and if
... | def load_from_powershell(self):
if not conf.prog.os_access:
return
ifaces_ips = None
for i in get_windows_if_list():
try:
interface = NetworkInterface(i)
self.data[interface.guid] = interface
# If no IP address was detected using winpcap and if
... | https://github.com/secdev/scapy/issues/1718 | Traceback (most recent call last):
File "<string>", line 1, in <module>
File "scapy\all.py", line 18, in <module>
from scapy.arch import *
File "scapy\arch\__init__.py", line 73, in <module>
from scapy.arch.windows import * # noqa F403
File "scapy\arch\windows\__init__.py", line 946, in <module>
IFACES.load_from_power... | IndexError |
def i2h(self, pkt, x):
if isinstance(x, VolatileValue):
return super(FlagsField, self).i2h(pkt, x)
return self._fixup_val(super(FlagsField, self).i2h(pkt, x))
| def i2h(self, pkt, x):
return self._fixup_val(super(FlagsField, self).i2h(pkt, x))
| https://github.com/secdev/scapy/issues/1576 | ubuntu:/$ scapy
... (welcome info omitted)
p = IP()/TCP()
p = fuzz(p)
p["IP"].show()
###[ IP ]###
version= <RandNum>
ihl= None
tos= 98
len= None
id= <RandShort>
flags= DF+evil
frag= 0
ttl= <RandByte>
proto= tcp
chksum= None
src= 127.0.0.1
dst= 127.0.0.1
\options\
###[ TCP ]###
sport= <RandShort>
dport= <RandShort>
seq=... | ValueError |
def cpu_freq():
"""Alternate implementation using /proc/cpuinfo.
min and max frequencies are not available and are set to None.
"""
ret = []
with open_binary("%s/cpuinfo" % get_procfs_path()) as f:
for line in f:
if line.lower().startswith(b"cpu mhz"):
key, value ... | def cpu_freq():
"""Alternate implementation using /proc/cpuinfo.
min and max frequencies are not available and are set to None.
"""
ret = []
with open_binary("%s/cpuinfo" % get_procfs_path()) as f:
for line in f:
if line.lower().startswith(b"cpu mhz"):
key, value ... | https://github.com/giampaolo/psutil/issues/1456 | $ s-tui
Traceback (most recent call last):
File "/home/user/venv/bin/s-tui", line 11, in <module>
sys.exit(main())
File "/home/user/venv/lib/python3.6/site-packages/s_tui/s_tui.py", line 927, in main
graph_controller = GraphController(args)
File "/home/user/venv/lib/python3.6/site-packages/s_tui/s_tui.py", line 728, in... | TypeError |
def _proc_cred(self):
return cext.proc_cred(self.pid, self._procfs_path)
| def _proc_cred(self):
@wrap_exceptions
def proc_cred(self):
return cext.proc_cred(self.pid, self._procfs_path)
return proc_cred(self)
| https://github.com/giampaolo/psutil/issues/1447 | Traceback (most recent call last):
File "/data/jon/h2oai/h2oaicore/systemutils.py", line 3100, in find_procs_by_name
for p in psutil.process_iter(attrs=['name']):
File "/home/jon/.pyenv/versions/3.6.4/lib/python3.6/site-packages/psutil/__init__.py", line 1440, in process_iter
if proc.is_running():
File "/home/jon/.pyen... | FileNotFoundError |
def main():
ad_pids = []
procs = []
for p in psutil.process_iter():
with p.oneshot():
try:
mem = p.memory_full_info()
info = p.as_dict(["cmdline", "username"])
except psutil.AccessDenied:
ad_pids.append(p.pid)
except... | def main():
ad_pids = []
procs = []
for p in psutil.process_iter():
with p.oneshot():
try:
mem = p.memory_full_info()
info = p.as_dict(["cmdline", "username"])
except psutil.AccessDenied:
ad_pids.append(p.pid)
except... | https://github.com/giampaolo/psutil/issues/1877 | Traceback (most recent call last):
File ".\teste.py", line 6, in <module>
for proc in psutil.process_iter():
File "C:\Users\user10\AppData\Roaming\Python\Python38\site-packages\psutil\__init__.py", line 1457, in process_iter
yield add(pid)
File "C:\Users\user10\AppData\Roaming\Python\Python38\site-packages\psutil\__ini... | OSError |
def wrapper(self, *args, **kwargs):
delay = 0.0001
times = 33
for x in range(times): # retries for roughly 1 second
try:
return fun(self, *args, **kwargs)
except WindowsError as _:
err = _
if err.winerror == ERROR_PARTIAL_COPY:
time.sleep(... | def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
except OSError as err:
raise convert_oserror(err, pid=self.pid, name=self._name)
| https://github.com/giampaolo/psutil/issues/875 | ======================================================================
ERROR: test_proc_environ (test_process.TestNonUnicode)
----------------------------------------------------------------------
Traceback (most recent call last):
File "C:\projects\psutil\psutil\tests\test_process.py", line 2054, in test_proc_environ
... | WindowsError |
def wrap_exceptions(fun):
"""Call callable into a try/except clause and translate ENOENT,
EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
"""
@functools.wraps(fun)
def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
except Environment... | def wrap_exceptions(fun):
"""Call callable into a try/except clause and translate ENOENT,
EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
"""
def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
except EnvironmentError as err:
... | https://github.com/giampaolo/psutil/issues/1486 | Traceback (most recent call last):
File "/opt/freeware/lib64/python3.7/site-packages/psutil/__init__.py", line 593, in oneshot
self._proc.oneshot_enter()
File "/opt/freeware/lib64/python3.7/site-packages/psutil/_psaix.py", line 369, in oneshot_enter
self._proc_name_and_args.cache_activate(self)
AttributeError: 'functio... | AttributeError |
def wrap_exceptions(fun):
"""Call callable into a try/except clause and translate ENOENT,
EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
"""
@functools.wraps(fun)
def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
except Environment... | def wrap_exceptions(fun):
"""Call callable into a try/except clause and translate ENOENT,
EACCES and EPERM in NoSuchProcess or AccessDenied exceptions.
"""
def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
except EnvironmentError as err:
... | https://github.com/giampaolo/psutil/issues/1486 | Traceback (most recent call last):
File "/opt/freeware/lib64/python3.7/site-packages/psutil/__init__.py", line 593, in oneshot
self._proc.oneshot_enter()
File "/opt/freeware/lib64/python3.7/site-packages/psutil/_psaix.py", line 369, in oneshot_enter
self._proc_name_and_args.cache_activate(self)
AttributeError: 'functio... | AttributeError |
def wrap_exceptions(fun):
"""Decorator which translates bare OSError exceptions into
NoSuchProcess and AccessDenied.
"""
@functools.wraps(fun)
def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
except OSError as err:
if err.errno == er... | def wrap_exceptions(fun):
"""Decorator which translates bare OSError exceptions into
NoSuchProcess and AccessDenied.
"""
@functools.wraps(fun)
def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
except OSError as err:
if err.errno == er... | https://github.com/giampaolo/psutil/issues/1209 | ======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_zombie_process
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/travis/build/giampaolo/psutil/psutil/tests/test_process.py", line... | OSError |
def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
except OSError as err:
if err.errno == errno.ESRCH:
raise NoSuchProcess(self.pid, self._name)
if err.errno in (errno.EPERM, errno.EACCES):
raise AccessDenied(self.pid, self._name)
r... | def wrapper(self, *args, **kwargs):
try:
return fun(self, *args, **kwargs)
except OSError as err:
if err.errno == errno.ESRCH:
raise NoSuchProcess(self.pid, self._name)
if err.errno in (errno.EPERM, errno.EACCES):
raise AccessDenied(self.pid, self._name)
r... | https://github.com/giampaolo/psutil/issues/1209 | ======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_zombie_process
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/travis/build/giampaolo/psutil/psutil/tests/test_process.py", line... | OSError |
def threads(self):
rawlist = cext.proc_threads(self.pid)
retlist = []
for thread_id, utime, stime in rawlist:
ntuple = _common.pthread(thread_id, utime, stime)
retlist.append(ntuple)
return retlist
| def threads(self):
with catch_zombie(self):
rawlist = cext.proc_threads(self.pid)
retlist = []
for thread_id, utime, stime in rawlist:
ntuple = _common.pthread(thread_id, utime, stime)
retlist.append(ntuple)
return retlist
| https://github.com/giampaolo/psutil/issues/1209 | ======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_zombie_process
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/travis/build/giampaolo/psutil/psutil/tests/test_process.py", line... | OSError |
def memory_maps(self):
return cext.proc_memory_maps(self.pid)
| def memory_maps(self):
with catch_zombie(self):
return cext.proc_memory_maps(self.pid)
| https://github.com/giampaolo/psutil/issues/1209 | ======================================================================
ERROR: psutil.tests.test_process.TestProcess.test_zombie_process
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/travis/build/giampaolo/psutil/psutil/tests/test_process.py", line... | OSError |
def exe(self):
# Dual implementation, see:
# https://github.com/giampaolo/psutil/pull/1413
if not IS_WIN_XP:
exe = cext.proc_exe(self.pid)
else:
if self.pid in (0, 4):
# https://github.com/giampaolo/psutil/issues/414
# https://github.com/giampaolo/psutil/issues/52... | def exe(self):
# Note: os.path.exists(path) may return False even if the file
# is there, see:
# http://stackoverflow.com/questions/3112546/os-path-exists-lies
# see https://github.com/giampaolo/psutil/issues/414
# see https://github.com/giampaolo/psutil/issues/528
if self.pid in (0, 4):
... | https://github.com/giampaolo/psutil/issues/1394 | Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import psutil
[p for p in psutil.process_iter()]
[psutil.Process(pid=0, name='System Idle Process', started='2018-11-06 04:18:12'), psutil.Process(pid=4... | WindowsError |
def exe(self):
# Note: os.path.exists(path) may return False even if the file
# is there, see:
# http://stackoverflow.com/questions/3112546/os-path-exists-lies
# see https://github.com/giampaolo/psutil/issues/414
# see https://github.com/giampaolo/psutil/issues/528
if self.pid in (0, 4):
... | def exe(self):
# Note: os.path.exists(path) may return False even if the file
# is there, see:
# http://stackoverflow.com/questions/3112546/os-path-exists-lies
# see https://github.com/giampaolo/psutil/issues/414
# see https://github.com/giampaolo/psutil/issues/528
if self.pid in (0, 4):
... | https://github.com/giampaolo/psutil/issues/1394 | Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:53:40) [MSC v.1500 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import psutil
[p for p in psutil.process_iter()]
[psutil.Process(pid=0, name='System Idle Process', started='2018-11-06 04:18:12'), psutil.Process(pid=4... | WindowsError |
def disk_io_counters(perdisk=False):
"""Return disk I/O statistics for every disk installed on the
system as a dict of raw tuples.
"""
def read_procfs():
# OK, this is a bit confusing. The format of /proc/diskstats can
# have 3 variations.
# On Linux 2.4 each line has always 15 ... | def disk_io_counters(perdisk=False):
"""Return disk I/O statistics for every disk installed on the
system as a dict of raw tuples.
"""
def read_procfs():
# OK, this is a bit confusing. The format of /proc/diskstats can
# have 3 variations.
# On Linux 2.4 each line has always 15 ... | https://github.com/giampaolo/psutil/issues/1354 | (psutil_venv) -bash-4.2$ python
Python 3.6.2 (default, Apr 24 2018, 04:27:15)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import psutil
psutil.__version__
'5.4.7'
psutil.disk_io_counters()
Traceback (most recent call last):
File "<stdin>", line... | ValueError |
def read_procfs():
# OK, this is a bit confusing. The format of /proc/diskstats can
# have 3 variations.
# On Linux 2.4 each line has always 15 fields, e.g.:
# "3 0 8 hda 8 8 8 8 8 8 8 8 8 8 8"
# On Linux 2.6+ each line *usually* has 14 fields, and the disk
# name is in another position, l... | def read_procfs():
# OK, this is a bit confusing. The format of /proc/diskstats can
# have 3 variations.
# On Linux 2.4 each line has always 15 fields, e.g.:
# "3 0 8 hda 8 8 8 8 8 8 8 8 8 8 8"
# On Linux 2.6+ each line *usually* has 14 fields, and the disk
# name is in another position, l... | https://github.com/giampaolo/psutil/issues/1354 | (psutil_venv) -bash-4.2$ python
Python 3.6.2 (default, Apr 24 2018, 04:27:15)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-16)] on linux
Type "help", "copyright", "credits" or "license" for more information.
import psutil
psutil.__version__
'5.4.7'
psutil.disk_io_counters()
Traceback (most recent call last):
File "<stdin>", line... | ValueError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.