Coder Social home page Coder Social logo

attackersimulator's Introduction

AttackerSimulator

攻击模拟

说明

很喜欢下面这段代码,让PoC编写变得很自由。

if lst_pocpy and lst_pocpy[0]==pocbase_py:
    local_pocbase={}
    code=self.readFile(pocbase_py)
    exec(code, local_pocbase)
    
    for path in lst_pocpy[1:]:
        local_vars={}
        local_vars.update(local_pocbase)
        code=self.readFile(path)
        exec(code, local_vars)  #每个PoC文件都是独立的,不受重名影响,且PoC封装类都继承了PocBase,方便定义一些共用操作
        
        try:
            PocBase=local_vars["PocBase"]
            for key in local_vars:
                cls=local_vars[key]
                if PocBase in getattr(cls, "__mro__", []):   # local_vars["SqlTest1"].__mro__是(<class 'SqlTest1'>, <class 'PocBase'>, <class 'object'>)  类对象的__mro__是指方法解析顺序(Method Resolution Order)
                    if PocBase!=cls and cls.enable==True:
                        if cls not in self.hub:
                            self.hub.append(cls)     #把poc类放到hub里,方便调用,且不同.py文件的poc互不影响,即同名也没有关系
        except:
            pass

attackersimulator's People

Contributors

wstone0011 avatar

Stargazers

 avatar

Watchers

 avatar

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.