Exemplo n.º 1
0
    def __init__(self, modhandler, url, password):

        self.cwd_vector = None
        self.path = None
        self.proxy = None

        self.modhandler = modhandler

        self.post_data = {}

        self.current_mode = None

        self.use_current_path = True

        self.available_modes = self.params.get_parameter_choices('mode')

        mode = self.params.get_parameter_value('mode')
        if mode:
            self.modes = [mode]
        else:
            self.modes = self.available_modes

        proxy = self.params.get_parameter_value('proxy')

        if proxy:
            self.mprint(
                '[!] Proxies can break weevely requests, if possibile use proxychains'
            )
            self.proxy = {'http': proxy}

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 2
0
 def __init__(self, **kwargs):
     self._name = 'Stacked_'+kwargs['ae_type']
     kwargs['dvc'] =  torch.device('cpu')
     Module.__init__(self, **kwargs)
     self._feature, self._output = self.Sequential(out_number = 2)
     self.opt()
     self.Stacked()
Exemplo n.º 3
0
    def __init__(self, modhandler, url, password):
        
        self.cwd_vector = None
        self.path = None
        self.proxy = None

        self.modhandler = modhandler        
        
        self.post_data = {}
        
        self.current_mode = None
                    
        self.use_current_path = True
                    
        self.available_modes = self.params.get_parameter_choices('mode')
                    
        mode = self.params.get_parameter_value('mode')
        if mode:
            self.modes = [ mode ]
        else:
            self.modes = self.available_modes

        proxy = self.params.get_parameter_value('proxy')
        
        if proxy:
            self.mprint('[!] Proxies can break weevely requests, if possibile use proxychains')
            self.proxy = { 'http' : proxy }

        
        Module.__init__(self, modhandler, url, password)
    def __init__(self, **kwargs):
        if 'name' in kwargs.keys():
            kwargs['_name'] = kwargs['name']
            del kwargs['name']
        if '_name' not in kwargs.keys(): kwargs['_name'] = 'DBN'

        # 检测是否设置单元类型 - 用于预训练
        if 'v_type' not in kwargs.keys():
            kwargs['v_type'] = ['Gaussian']
        if 'h_type' not in kwargs.keys():
            kwargs['h_type'] = ['Gaussian']

        Module.__init__(self, **kwargs)

        if type(self.h_type) != list:
            self.h_type = [self.h_type]

        # 如果未定义 hidden_func 则按单元类型给定 - 用于微调
        if hasattr(self, 'hidden_func') == False:
            self.hidden_func = []
            for tp in self.h_type:
                if tp in ['Gaussian', 'g']: self.hidden_func.append('a')
                elif tp in ['Binary', 'b']: self.hidden_func.append('s')
                else: raise Exception("Unknown h_type!")

        self._feature, self._output = self.Sequential(out_number=2)
        self.opt()
        self.Stacked()
Exemplo n.º 5
0
    def __init__(self, modhandler, url, password):

        self.rand_post_addr = ''.join([choice('abcdefghijklmnopqrstuvwxyz') for i in xrange(4)])
        self.rand_post_port = ''.join([choice('abcdefghijklmnopqrstuvwxyz') for i in xrange(4)])
        
        
        Module.__init__(self, modhandler, url, password)    
Exemplo n.º 6
0
    def __init__(self, modhandler, url, password):
        Module.__init__(self, modhandler, url, password)

        self.file_content = None

        self.rand_post_name = ''.join(
            [choice('abcdefghijklmnopqrstuvwxyz') for i in xrange(4)])
Exemplo n.º 7
0
    def __init__(self, **kwargs):
        self._name = 'CNN'

        Module.__init__(self, **kwargs)
        Conv_Module.__init__(self, **kwargs)
        self.layers = self.Convolutional()
        self.fc = self.Sequential()
        self.opt()
Exemplo n.º 8
0
    def __init__( self, modhandler , url, password):
        
        self.probe_filename = ''.join(choice(letters) for i in xrange(4)) + '.html'

        self.found_url = None
        self.found_dir = None

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 9
0
    def __init__( self, modhandler , url, password):

        self.probe_filename = ''.join(choice(letters) for i in xrange(4)) + '.html'

        self.found_url = None
        self.found_dir = None

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 10
0
    def __init__(self, modhandler, url, password):

        self.rand_post_addr = ''.join(
            [choice('abcdefghijklmnopqrstuvwxyz') for i in xrange(4)])
        self.rand_post_port = ''.join(
            [choice('abcdefghijklmnopqrstuvwxyz') for i in xrange(4)])

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 11
0
    def __init__(self,
                 cfg=None,
                 batch_norm=True,
                 use_bias=False,
                 load_pre=None,
                 init_weights=True,
                 **kwargs):

        if type(cfg) == str: arch = cfgs[cfg]
        else: arch = cfg
        default = {
            'img_size': [3, 224, 224],
            'conv_struct': arch,
            'conv_func': 'ReLU(True)',
            'res_func': 'ReLU(True)',
            'struct': [-1, 1000],
            'dropout': 0,
            'hidden_func': 'ReLU(True)'
        }

        for key in default.keys():
            if key not in kwargs.keys():
                kwargs[key] = default[key]

        self.batch_norm = batch_norm
        self.use_bias = use_bias
        if type(cfg) == str:
            self._name = cfg.upper()
        else:
            self._name = 'ResNet'
        Module.__init__(self, **kwargs)
        Conv_Module.__init__(self, **kwargs)

        if type(cfg) == str:
            blocks = self.Convolutional()
            index = block_id[cfg]
            self.conv1, self.bn1, self.relu, self.maxpool = \
            blocks[0].conv_layers[0], blocks[0].conv_layers[1], blocks[0].act_layer, blocks[0].pool_layer

            self.layer1 = nn.Sequential(*blocks[index[0]:index[1]])
            self.layer2 = nn.Sequential(*blocks[index[1]:index[2]])
            self.layer3 = nn.Sequential(*blocks[index[2]:index[3]])
            self.layer4 = nn.Sequential(*blocks[index[3]:index[4]])

            self.layers = blocks.children()

        elif type(cfg) == list:
            self.conv_struct = cfg
            self.layers = self.Convolutional()

        self.fc = self.Sequential()
        self.opt()

        if init_weights:
            self._initialize_weights()
        if load_pre == True or type(load_pre) == str:
            self.load_pre(cfg, batch_norm, load_pre)
Exemplo n.º 12
0
 def __init__(self, **kwargs):
     if 'name' in kwargs.keys(): 
         kwargs['_name'] = kwargs['name']
         del kwargs['name']
     if '_name' not in kwargs.keys(): kwargs['_name'] = 'Stacked_'+kwargs['ae_type']
     
     if 'decoder_func' not in kwargs.keys(): kwargs['decoder_func'] = 'a'
         
     Module.__init__(self, **kwargs)
     
     self._feature, self._output = self.Sequential(out_number = 2)
     self.opt()
     self.Stacked()
Exemplo n.º 13
0
    def __init__(self, modhandler, url, password):

        self.encoder_callable = False
        self.md5_callable = False

        self.payload = None
        self.vector = None
        self.interpreter = None
        self.transfer_dir = None
        self.transfer_url_dir = None

        self.lastreadfile = ''

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 14
0
    def __init__(self, modhandler, url, password):

        self.encoder_callable = False
        self.md5_callable = False


        self.payload = None
        self.vector = None
        self.interpreter = None
        self.transfer_dir = None
        self.transfer_url_dir = None

        self.lastreadfile = ''


        Module.__init__(self, modhandler, url, password)
Exemplo n.º 15
0
    def __init__(self, **kwargs):
        default = {
            'struct2': None,  # 解码部分的结构,默认为编码部分反向
            'hidden_func2': None,
            'n_category': None,
            'dropout': 0.0,
            'exec_dropout': [False, True],
            'lr': 1e-3
        }

        for key in default.keys():
            if key not in kwargs:
                kwargs[key] = default[key]
        kwargs['dvc'] = torch.device('cpu')

        self._name = 'MMDGM_VAE'
        Module.__init__(self, **kwargs)

        # q(z|x)
        self.qx = self.Sequential(struct=self.struct[:2],
                                  hidden_func=self.hidden_func)
        self.qy = self.Sequential(struct=[self.n_category, self.struct[1]],
                                  hidden_func=self.hidden_func)
        self.Q = self.Sequential(struct=self.struct[1:-1],
                                 hidden_func=self.hidden_func[1:])
        self.z_mu = self.Sequential(struct=self.struct[-2:], hidden_func='a')
        self.z_logvar = self.Sequential(struct=self.struct[-2:],
                                        hidden_func='a')

        # p(x|z)
        if self.struct2 is None:
            self.struct2 = self.struct.copy()
            self.struct2.reverse()
        if self.hidden_func2 is None:
            if type(self.hidden_func) == str:
                self.hidden_func = [self.hidden_func]
            self.hidden_func2 = self.hidden_func.copy()
            self.hidden_func2.reverse()

        self.pz = self.Sequential(struct=self.struct2[:2],
                                  hidden_func=self.hidden_func2)
        self.py = self.Sequential(struct=[self.n_category, self.struct2[1]],
                                  hidden_func=self.hidden_func2)
        self.P = self.Sequential(struct=self.struct2[1:],
                                 hidden_func=self.hidden_func2[1:])
        self.opt()
Exemplo n.º 16
0
    def __init__(self, module_list, **kwargs):
        ''' 
            _loss: 附加损失
            loss: 全部损失
        '''
        name = ''
        for i in range(len(module_list)):
            if hasattr(module_list[i], 'name'):
                name += module_list[i].name
            if i < len(module_list) - 1:
                name += '-'
        self.name = name

        Module.__init__(self, **kwargs)

        self.modules = nn.Sequential(*module_list)
        self.module_list = module_list

        self.opt(False)
Exemplo n.º 17
0
    def __init__(self, cfg = None, 
                 batch_norm = False, use_bias = True, 
                 load_pre = None, init_weights=True, **kwargs): 

        if type(cfg) == str: arch = cfgs[cfg]
        else: arch = cfg
        
        default = {'img_size': [3, 224, 224],
                   'conv_struct': arch,
                   'conv_func': 'ReLU(True)',
                   'struct': [-1, 4096, 4096, 1000],
                   'dropout': [0, 0.5, 0.5],
                   'hidden_func': 'ReLU(True)'
                   }
        
        for key in default.keys():
            if key not in kwargs.keys():
                kwargs[key] = default[key]
        
        self.batch_norm = batch_norm
        self.use_bias = use_bias
        if type(cfg) == str:
            self._name = cfg.upper()         
        elif type(cfg) == list:
            self._name = 'VGG'
            self.conv_struct = cfg
            
        Module.__init__(self,**kwargs)
        Conv_Module.__init__(self,**kwargs)
            
        self.features = self.Convolutional('layers', auto_name = False)
        self.classifier = self.Sequential()
        self.opt()
        
        if init_weights:
            self._initialize_weights()
        if load_pre == True or type(load_pre) == str:
            self.load_pre(cfg, batch_norm, load_pre)
Exemplo n.º 18
0
    def __init__(self, modhandler, url, password):

        self.structure = {}

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 19
0
    def __init__(self, modhandler, url, password):

        self.chunksize = 5000
        self.substitutive_wl = []
        Module.__init__(self, modhandler, url, password)
Exemplo n.º 20
0
 def __init__( self, modhandler , url, password):
     
     self.chunksize = 5000
     self.substitutive_wl = []
     Module.__init__(self, modhandler, url, password)
Exemplo n.º 21
0
    def __init__(self, modhandler, url, password):
        self.ifaces = {}

        Module.__init__(self, modhandler, url, password)
 def __init__(self, modhandler, url, password):
     Module.__init__(self, modhandler, url, password)    
     
     self.file_content = None
     
     self.rand_post_name = ''.join([choice('abcdefghijklmnopqrstuvwxyz') for i in xrange(4)])
Exemplo n.º 23
0
    def __init__(self, modhandler, url, password):

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 24
0
    def __init__(self, modhandler, url, password):

        Module.__init__(self, modhandler, url, password)

        self.usersinfo = {}
Exemplo n.º 25
0
    def __init__(self, modhandler, url, password):
        self.pathdict = {}

        Module.__init__(self, modhandler, url, password)
    def __init__( self, modhandler , url, password):

        Module.__init__(self, modhandler, url, password)
        
        self.usersfiles = {}    
Exemplo n.º 27
0
    def __init__(self, modhandler, url, password):
        self.list = []

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 28
0
 def __init__(self, modhandler, url, password):
     self.reqlist = RequestList(modhandler)
     
     Module.__init__(self, modhandler, url, password)    
Exemplo n.º 29
0
 def __init__(self, modhandler, url, password):
     self.list = []
     
     Module.__init__(self, modhandler, url, password)
Exemplo n.º 30
0
    def __init__(self, modhandler, url, password):

        self.last_vector = None
        self.done = False

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 31
0
 def __init__(self, modhandler, url, password):
     self.pathdict = {}
     
     Module.__init__(self, modhandler, url, password)
Exemplo n.º 32
0
    def __init__( self, modhandler , url, password):
            
        self.structure = {}

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 33
0
    def __init__( self, modhandler , url, password):

        self.last_vector = None
        self.done = False

        Module.__init__(self, modhandler, url, password)
Exemplo n.º 34
0
                    P(arg='cmd', help='Shell command', required=True, pos=0),
                    P(arg='stderr', help='Print standard error', default=True, type=bool)
                    )


    def __init__( self, modhandler , url, password):

        self.payload  = None
        self.cwd_vector = None

        try: 
            modhandler.load('shell.php')
        except ModuleException, e:
            raise
        else:
            Module.__init__(self, modhandler, url, password)
        
        
        
    def __execute_probe(self, vector):
        
        
        try:
            rand     = random.randint( 11111, 99999 )
            response = self.run_module( "echo %d" % rand, True, vector.payloads[0] )
            if response == str(rand):
                self.params.set_and_check_parameters({'vector' : vector.name})
                return True

        except:
            #pass
Exemplo n.º 35
0
 def __init__(self, **kwargs):
     self._name = 'DNN'
     Module.__init__(self, **kwargs)
     self._feature, self._output = self.Sequential(out_number = 2)
     self.opt()