Coder Social home page Coder Social logo

Comments (8)

phaethon avatar phaethon commented on May 18, 2024

Thanks for noticing. Will check the code for __getattr__ usage.

from kamene.

phaethon avatar phaethon commented on May 18, 2024

This was tricky, but I fixed __getattr__ usage in volatile module for cases when __int__, __str__, __repr__, __index__ could be called. Comments on other special methods to be included are welcome. Also, please, comment on other places in the code that expect __getattr__ to catch special methods. This is not trivial to identify.

__cmp__ is not ported, but I am not sure if the code uses it.

Please, check latest git version. RandIP and RandString work now.

from kamene.

ppietikainen avatar ppietikainen commented on May 18, 2024

My code started working just fine :-) For other uses, yes, it's tricky to find out. E.g. Automaton looks like it could be a candidate:

{'BEGIN': <function ATMT.state.<locals>.deco.<locals>.state_wrapper at 0x7f4bcaf2b158>, 'END': <function ATMT.state.<locals>.deco.<locals>.state_wrapper at 0x7f4bcaf2b378>}
<session[HelloWorld]: TCP:0 UDP:0 ICMP:0 Other:0>

vs. the previous 

{'BEGIN': <function BEGIN_wrapper at 0x7f48efeaa848>, 'END': <function END_wrapper at 0x7f48efeaaa28>}
[]

(printing "states" and "packets" from the HelloWorld example at https://bitbucket.org/secdev/scapy/wiki/doc/Automata ).

X509Cert() ! (or probably the ASN1 stuff within).

Actually, a nice test seems to be:

from scapy.all import *
s = dir()
import inspect
import sys

for f in s:
  o = getattr(sys.modules[__name__], f)
  if inspect.isclass(o):
    try:
      o()
    except TypeError:
      pass
    except Exception as e:
      print ((f, e))

which probably finds problems unrelated to this bug as well :-)

from kamene.

phaethon avatar phaethon commented on May 18, 2024

Please, check X509Cert. It should be working now.
I will have a look at Automaton later.

from kamene.

ppietikainen avatar ppietikainen commented on May 18, 2024

Seems to work. https://github.com/ppietikainen/scapy has some random fixes-in-progress/testing you may want to check out, will test a bit before sending a proper pull request but feel free to merge.

Left to figure out (maybe not problems :-)):

('DHCPv6_am', TypeError('ord() expected string of length 1, but int found',))
('MetaVolatile', TypeError('type() takes 1 or 3 arguments',))
('RandDHCPOptions', AttributeError("'dict_values' object has no attribute 'remove'",))
('TermSink', FileNotFoundError(2, "No such file or directory: 'xterm'"))

from kamene.

phaethon avatar phaethon commented on May 18, 2024

I checked Automaton. It is not the same story. It was not about getattr, but assigning __name__ for wrapped functions. I fixed it by changing assignment to __qualname__, but it still looks differently than on python 2.x because of differences in built-in __repr__ for functions. It adds module name in front of the function name, but I am fine with that and don't see necessity for change.
At least all regression tests work, so I assume no big issues there. I, also, fixed graph for automaton.

I looked at your changes, and all of them seem fine. If you are going to create a pull request I will wait for that.

Now I am going to check the list of 4 in your last comment.

from kamene.

phaethon avatar phaethon commented on May 18, 2024
  • DHCPv6_am - fixed ord issue
  • MetaVolatile - is supposed to be private, so I renamed it to _MetaVolatile; in any case it takes as it says 1 or 3 arguments as a descendant of type
  • RandDHCPOptions - fixed
  • TermSink - you need to have xterm installed on path. Command name is hardwired into code. Could be made into configurable value if needed, but did not do that yet.

Thanks for identifying issues!

from kamene.

phaethon avatar phaethon commented on May 18, 2024

Closing this for now, as specific identified issues have been fixed

from kamene.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.