Пример #1
0
        for x in node.orelse:
            self.visit(x)

        # conservative tainting for now
        origscope.merge(bodyscope)
        origscope.merge(elsescope)

        # restore the scope
        self.scope = self.taint = origscope

    def visit_Dict(self, node):
        self.generic_visit(node)

        node.taint = DictionaryTaint(node.keys, node.values)

    def visit_Subscript(self, node):
        self.generic_visit(node)

        node.taint = node.value.taint.lookup(node.slice)
        print 'subscript', node.slice.value, node.taint


def parse(fname):
    node = ast.parse(open(fname, 'rb').read())
    return node


if __name__ == '__main__':
    import sys
    print dump(parse(sys.argv[1]))
Пример #2
0
        self.scope = self.taint = elsescope
        for x in node.orelse:
            self.visit(x)

        # conservative tainting for now
        origscope.merge(bodyscope)
        origscope.merge(elsescope)

        # restore the scope
        self.scope = self.taint = origscope

    def visit_Dict(self, node):
        self.generic_visit(node)

        node.taint = DictionaryTaint(node.keys, node.values)

    def visit_Subscript(self, node):
        self.generic_visit(node)

        node.taint = node.value.taint.lookup(node.slice)
        print 'subscript', node.slice.value, node.taint


def parse(fname):
    node = ast.parse(open(fname, 'rb').read())
    return node

if __name__ == '__main__':
    import sys
    print dump(parse(sys.argv[1]))
Пример #3
0
import ast
from utils import astpp
import sys

if __name__ == '__main__':
    fd = open(sys.argv[1], 'rb') if len(sys.argv) != 1 else sys.stdin
    print astpp.dump(ast.parse(fd.read()))
Пример #4
0
from core.parse import parse, Identifier
from utils.astpp import dump
import sys

if __name__ == '__main__':
    if len(sys.argv) != 2:
        print 'Usage: python %s <website.py>' % sys.argv[0]
        exit(1)

    root = parse(sys.argv[1])
    x = Identifier()
    x.visit(root)
    print x.errors, x.taint, x.handlers
    print dump(root)