コード例 #1
0
ファイル: Board.py プロジェクト: SeniorProject20/Checkers
 def set_pieces_to_default(self):
     b, r = 0, 0
     for row in range(self.NUM_ROWS):
         for column in range(self.NUM_COLUMNS):
             if (row == 3 or row == 4) and not (self.board[row][column]
                                                == self.INVALID_SPACE):
                 name = self.FREE_SPACE
             else:
                 if row < 3 and b < self.NUM_BLACK and not (
                         self.board[row][column] == self.INVALID_SPACE):
                     if b < 10:
                         name = 'B' + str(b) + ' '
                     else:
                         name = 'B' + str(b)
                     ref = Checker('black', name)
                     self.CHECKERS[name] = ref
                     b += 1
                 elif row > 4 and r < self.NUM_RED and not (
                         self.board[row][column] == self.INVALID_SPACE):
                     if r < 10:
                         name = 'R' + str(r) + ' '
                     else:
                         name = 'R' + str(r)
                     ref = Checker('red', name)
                     self.CHECKERS[name] = ref
                     r += 1
             if name != None:
                 self.board[row][column] = name
             name = None
コード例 #2
0
def find_and_fix():

    url = request.args.get('url')

    checker = Checker()
    fixer = Fixer()

    # get the errors
    # TODO: THIS IS JUST FOR TESTING
    errors = checker.check_with_save(url)

    id = errors[0]['site_id']
    filename = 'data/%d.html' % id
    with open(filename, 'r', encoding='utf-8') as fo:
        html = fo.read()

    # END TESTING
    # START PRODUCTION
    # errors = checker.check(url)
    # html = requests.get(url)
    # END PRODUCTION

    # fix as many errors as possible
    better_html = fixer.fix_all(errors, html)

    return better_html
コード例 #3
0
ファイル: test.py プロジェクト: Ariken12/glina-mess
def main():
    desk = Checker()
    desk.board = [[0, 1, 0, 1, 0, 1, 0, 1], [1, 0, 1, 0, 1, 0, 1, 0],
                  [0, 1, 0, 1, 0, 1, 0, 1], [0, 0, 0, 0, 0, 0, 0, 0],
                  [0, 1, 0, 0, 0, 0, 0, 0], [2, 0, 2, 0, 2, 0, 2, 0],
                  [0, 2, 0, 2, 0, 2, 0, 2], [2, 0, 2, 0, 2, 0, 2, 0]]
    err = desk.move(5, 6, 6, 5, 2)
    print(err)
    for i in desk.board:
        print(i)
コード例 #4
0
 def write_append_variables_data(self, variables):
     checker = Checker(self.data)
     checker.check_position_time(self.dimensions.dimensionsList, variables,
                                 self.ncFile)
     checker.check_same_file(self.dimensions.dimensionsList, variables,
                             self.ncFile)
     variables = variables.variablesList
     for variable in variables:
         if 'value' in variables[
                 variable] and variables[variable]['value'] != "":
             continue
         dimension = Checker().check_dimensions(variables[variable])
         if dimension != "":
             dimension = variables[variable][dimension]
         appendPosition = checker.get_append_dictionary_element(dimension)
         appendMiddlePosition = checker.get_append_middle_dictionary_element(
             dimension)
         if appendPosition == 0 and appendMiddlePosition == 0:
             self.data.append_data(variables[variable],
                                   self.ncFile.variables[variable],
                                   self.dimensions)
         elif appendMiddlePosition > 0:
             self.data.append_data_in_the_middle(
                 variables[variable], self.ncFile.variables[variable],
                 appendMiddlePosition, self.dimensions)
             continue
         else:
             self.data.append_data_to_file_with_old_data(
                 variables[variable], self.ncFile.variables[variable],
                 appendPosition, self.dimensions)
コード例 #5
0
 def schedule_checker(self, cycle=CHECK_CYCLE):
     '''
     定时测试代理
     :param cycle: 定时周期
     :return: None
     '''
     checker = Checker()
     while True:
         log_action('代理测试器开始运行')
         checker.run()
         time.sleep(cycle)
コード例 #6
0
    def __init__(self, name="my_board"):
        self.checkers = []
        self.name = name

        # build the two lineups
        self.X_team = [Checker('X', id) for id in range(12)]
        self.O_team = [Checker('O', id) for id in range(12)]

        # add the checkers to the board
        # regular d_board is for display and h_board is for hidden memory
        # _ for blank
        self.d_board = [['_' for _ in range(8)] for _ in range(8)]
        self.h_board = [[None for _ in range(8)] for _ in range(8)]
コード例 #7
0
ファイル: Board.py プロジェクト: SeniorProject20/Checkers
 def CreateNewBoardFromInterface(self, list_in):
     b, r = 0, 0
     name = None
     for each in list_in:
         row = each[1][0]
         column = each[1][1]
         if each[0] == 'blue' and not (self.board[row][column]
                                       == self.INVALID_SPACE):
             if b < 10:
                 name = 'B' + str(b) + ' '
             else:
                 name = 'B' + str(b)
             ref = Checker('black', name)
             self.CHECKERS[name] = ref
             b += 1
         elif each[0] == 'red' and not (self.board[row][column]
                                        == self.INVALID_SPACE):
             if r < 10:
                 name = 'R' + str(r) + ' '
             else:
                 name = 'R' + str(r)
             ref = Checker('red', name)
             self.CHECKERS[name] = ref
             r += 1
         elif each[0] == 'pink' and not (self.board[row][column]
                                         == self.INVALID_SPACE):
             if r < 10:
                 name = 'R' + str(r) + ' '
             else:
                 name = 'R' + str(r)
             ref = Checker('red', name)
             self.CHECKERS[name] = ref
             ref.KingMe()
             r += 1
         elif each[0] == 'green' and not (self.board[row][column]
                                          == self.INVALID_SPACE):
             if b < 10:
                 name = 'B' + str(b) + ' '
             else:
                 name = 'B' + str(b)
             ref = Checker('black', name)
             self.CHECKERS[name] = ref
             ref.KingMe()
             b += 1
         if name != None:
             self.board[row][column] = name
             name = None
     print('# on board: ' + str(r + b))
     return self
コード例 #8
0
 def create_variables_for_netCDF(self, ncFile, variable, data):
     fillVal = variable[
         '_FillValue'] if '_FillValue' in variable and variable[
             '_FillValue'] != "" else False
     dimension = Checker().check_dimensions(variable)
     if dimension != "":
         print "No dimension"
         if self.first:
             columns = data.get_column()
             row = data.get_row()
             ncFile.createDimension("columns", columns)
             ncFile.createDimension("row", row)
             self.first = False
         ncVariable = ncFile.createVariable(variable['variable_name'],
                                            variable['typeof'],
                                            dimensions=("columns", "row"),
                                            fill_value=float(fillVal),
                                            zlib=True,
                                            complevel=9)
     else:
         print "Si dimension"
         ncVariable = ncFile.createVariable(variable['variable_name'],
                                            variable['typeof'],
                                            fill_value=float(fillVal),
                                            zlib=True,
                                            complevel=9)
     return ncVariable
コード例 #9
0
    def check_zombies(self):
        self.Zombies.clear()
        self.all.clear()
        checked = []
        tokens = []

        with open('./Data/Zombies.json', 'r+') as database:
            db = json.load(database)

            for Zombie in db['Zombies']:
                token = db['Zombies'][Zombie]['Token']
                token_info = Checker(token).get_informations()

                if token not in tokens and token_info != 'invalid':
                    self.Zombies.append(token[:20])
                    checked.append(token_info)
                    self.all.append(token)

                tokens.append(token)

        self.database.drop_table('Zombies')
        TinyDB.table(self.database, 'Zombies')

        if self.database.table('Zombies') != None:
            for zombie in checked:
                self.database.table('Zombies').insert(zombie)
コード例 #10
0
    def add_zombie(self, token):
        if self.database.table('Zombies') != None:
            token_info = Checker(token).get_informations()

            if token[:20] not in self.Zombies and token_info != 'invalid':
                self.database.table('Zombies').insert(token_info)
                self.Zombies.append(token[:20])
                self.Toats.post(token_info, token_info['Avatar'])
コード例 #11
0
ファイル: hma.py プロジェクト: mower/mower-apps
def main(argv):
	global root
	global TIMER

	app = QtCore.QCoreApplication(argv)
	dbPath = os.path.join(root, 'hma.db')
	if not os.path.exists(dbPath):
		initDb(dbPath)
		print 'Initialized db'
	db = DatabaseHandler(u'qt_sql_default_connection', dbPath)
	authDb = DatabaseHandler('tmp')
	createAuthDb(authDb)
	getAuth(authDb)
	processServers(db)
	initIp(authDb)
	checker = Checker(db, authDb)
	checker.startTimer(TIMER)
	return app.exec_()
コード例 #12
0
ファイル: GameField.py プロジェクト: Kanol/Checkers
    def fill_checkers_field(self):
        white_checkers = self.checkers_count
        black_checkers = self.checkers_count
        for x in range(self.width):
            for y in range(self.height):
                if black_checkers == 0:
                    break
                if not (x + y) % 2 == 0:
                    self.checkers_field.append(Checker(y, x, "blue"))
                    black_checkers -= 1

        for x in range(self.width - 1, -1, -1):
            for y in range(self.height - 1, -1, -1):
                if white_checkers == 0:
                    break
                if not (x + y) % 2 == 0:
                    self.checkers_field.append(Checker(y, x, "green"))
                    white_checkers -= 1
コード例 #13
0
 def _setup(self, url):
     if Checker.contain_illegal_char(url):
         raise Exception("illegal characters in urls")
     self.meta = {
         'url': url,
         'code': -1,  # http code
         'size': -1,
         'duration': 0,
     }
コード例 #14
0
 def query(self, hostname):
     self._setup()
     self.meta['hostname'] = hostname
     if Checker.contain_illegal_char(hostname):
         return self.meta
     else:
         self._query_ip_api(hostname, self.meta)
         Logger.debug("IPInfo.query() with %s" % hostname)
         Logger.debug(repr(self.meta))
         return self.meta
コード例 #15
0
 def move(self, c, newpos):
     self.__msg_send = "mov %d,%d,%d,%d" % (c.get_pos().getx(),
                                            c.get_pos().gety(),
                                            newpos.getx(), newpos.gety())
     cell = self.__board.get_cell(p=c.get_pos())
     newcell = self.__board.get_cell(p=newpos)
     cell.set_checker(None)
     newcell.set_checker(Checker(newcell, 'm'))
     self.update_cell_arrays()
     self.checkdooz(newpos)
コード例 #16
0
ファイル: Writer.py プロジェクト: plocan/netCDF-Generator
 def write_variables_data(self, variables, variablesList, version):
     variablesNames = ['_FillValue', 'variable_name', 'typeof', 'dim', 'value', 'csvcolumn']
     for variable in variables:
         dimension = Checker().check_dimensions(variable)
         if dimension != "":
             variablesNames[3] = dimension
         variableCreated = variablesList.write_variables(self.ncFile, variable, version)
         self.data.write_data(variable, variableCreated)
         variablesList.delete_attributes(variablesNames, variable)
         variablesList.add_attribute_to_variable(variableCreated, variable)
コード例 #17
0
ファイル: bot.py プロジェクト: Its-Vichy/Pegasus-Grabber
        async def check_token(ctx, token):
            self.Cache.add_zombie(token)

            token_info = Checker(token).get_informations()

            if token_info != 'invalid':
                await ctx.send(
                    embed=EmbedGenerator().generate_embed(token_info))
            else:
                await ctx.send(embed=EmbedGenerator().generate_embed(
                    fields={'Oops..': 'The token was invalid'}))
コード例 #18
0
    def __set_transition_threads(self, executed):
        #sets a threads for each possible transition
        i = 0
        execution_threads = []

        for transition in self.states_transitions[self.current_state]:
            #		time.sleep(1)
            execution_threads.append(Checker(executed, self, transition))
            execution_threads[i].start()
            i += 1
        return execution_threads
コード例 #19
0
class TestChecker(unittest.TestCase):
    def setUp(self):
        self.temp = Checker()

    def test_checker_before_17(self):
        file = 'File'
        self.temp.play.get_time = Mock(name='get_time')
        self.temp.play.get_time.return_value = 16
        self.temp.play.wav_was_played = Mock(name='wav_was_played')
        self.temp.play.wav_was_played.return_value = False
        result = self.temp.was_played(file)
        self.assertEqual(result, False)

    def test_checker_after_17(self):
        file = 'File'
        self.temp.play.get_time = Mock(name='get_time')
        self.temp.play.get_time.return_value = 19
        self.temp.play.wav_was_played = Mock(name='wav_was_played')
        self.temp.play.wav_was_played.return_value = True
        result = self.temp.was_played(file)
        self.assertEqual(result, True)
コード例 #20
0
ファイル: Board.py プロジェクト: nehaakram12/Checkers
def addChecker(x, y):
    if y == 3 or y == 4:
        return
    checker = Checker()
    checker.id = (x, y)
    if y < 4:
        checker.black = True
    checker.x = x
    checker.y = y
    board[x, y].checker = checker
    checkers.append(checker)
コード例 #21
0
 def __init__(self, editor):
     Signal.__init__(self)
     from Feedback import Feedback
     Feedback(self, editor)
     from LineJumper import Jumper
     Jumper(self, editor)
     from Checker import Checker
     Checker(self, editor)
     from ProcessCommunicator import Communicator
     Communicator(self, editor)
     from ExternalProcessStarter import Starter
     Starter(self, editor)
     from DatabaseReader import Reader
     Reader(self, editor)
     from DatabaseWriter import Writer
     Writer(self, editor)
     from DatabaseMonitor import Monitor
     Monitor(self, editor)
コード例 #22
0
ファイル: Variables.py プロジェクト: plocan/netCDF-Generator
 def create_variables_for_netCDF(self, ncFile, variable):
     fillVal = variable[
         '_FillValue'] if '_FillValue' in variable and variable[
             '_FillValue'] != "" else False
     dimension = Checker().check_dimensions(variable)
     if dimension != "":
         ncVariable = ncFile.createVariable(variable['variable_name'],
                                            variable['typeof'],
                                            (variable[dimension]),
                                            fill_value=float(fillVal),
                                            zlib=True,
                                            complevel=9)
     else:
         ncVariable = ncFile.createVariable(variable['variable_name'],
                                            variable['typeof'],
                                            fill_value=float(fillVal),
                                            zlib=True,
                                            complevel=9)
     return ncVariable
コード例 #23
0
 def update(self, s):
     self.__myCells.clear()
     self.__oppCells.clear()
     self.__emptyCells.clear()
     for i in range(0, 8):
         for j in range(0, 3):
             cell = self.__cells[(i, j)]
             cell.set_checker(None)
             if s[0] != 'e':
                 # if self.__cells[(i,j)].get_checker() != None:
                 #     del self.__cells([i,j]).get_checker()
                 cell.set_checker(Checker(cell, s[0]))
                 if s[0] == 'm':
                     self.__myCells[(i, j)] = cell
                 else:
                     self.__oppCells[(i, j)] = cell
             else:
                 self.__emptyCells[(i, j)] = cell
             if len(s) > 2:
                 s = s[2:]
コード例 #24
0
    def init_elements(self, metadataFile, csvFile, ncOutput):
        self.ncOutput = ncOutput
        self.ncOutput = Checker().check_source(metadataFile, csvFile, ncOutput)
        self.metadata = Metadata(metadataFile)
        self.metadataData = self.metadata.get_metadata()
        self.data = Data(csvFile)
        self.ncOutput = self.ncOutput + self.metadata.get_global_attributes(
        ).get_id() + ".nc"
        self.version = self.metadata.get_global_attributes(
        ).get_netcdf_version()
        self.temporalAppendPosition = {}
        self.globalAttributes = Metadata(metadataFile).get_global_attributes()
        self.dimensions = self.metadata.get_dimensions()
        self.naming_authority = self.globalAttributes.attributesList[
            'naming_authority']

        if self.naming_authority == 'EGO':
            self.data_ego = Data_ego(csvFile)
            self.ego_standard_metadata = EgoReaderStandardMetadata()
            self.dimensionsEgo = self.ego_standard_metadata.get_dimensions()
            self.metadata.change_variable()
コード例 #25
0
ファイル: main.py プロジェクト: drgold99/2020Finals
def addPass():
    #this placed variable was a debug thing i did but decided to keep because it works
    placed=False
    #telling the user the requirements
    print('New password must have:\n\t1 capital letter\n\t1 number\n\t1 special symbol: !,@,#,$,%,^,&,(,)\n\tLength of 8 or more')
    newPass=input('New password: '******'New password does not meet the requirements!')
        newPass=input('New password: '******'Please select a catagory to add your password to.\n(use "ls" to list catagories and passwords.)')
    while placed==False:
        #wasn't sure if i should keep this but i did
        uI=input('> ')
        if uI=="ls":
            listFunc()
            uI=input('> ')
        #makes sure that the catagory the user chose was an actual catagory
        if uI in catDictionary.keys():
            catDictionary[uI].append(newPass)
            placed=True
        else:
            print('Invalid catagory, try again.')
コード例 #26
0
        "-ports",
        dest="ports",
        help=
        "Please, specify the target port(s) separated by comma[80,8080 by default]",
        default="80,8080")
    parser.add_argument("-proxy",
                        dest="proxy",
                        help="Proxy[IP:PORT]",
                        required=None)

    parsed_args = parser.parse_args()

    # shodanSearch = ShodanSearch()
    dnsResolver = UtilDNS()
    sshConnection = SSHConnection()
    checker = Checker()
    scraping = Scraping()
    scanningNMAP = ScanningNMAP()
    infoLocation = InfoLocation()
    httpScan = HTTPScan()
    checkOpenSslVulnerable = CheckOpenSslVulnerable()
    checkFtpVulnerable = CheckFTPVulnerable()
    extractMails = ExtractMails()
    checkVuln_SQL_XSS_LFI = CheckVuln_SQL_XSS_LFI()
    scannerScapy = ScannerScapy()

    #default port list

    ip = ""
    hostname = "-"
    option = ""
コード例 #27
0
ファイル: Crawler.py プロジェクト: St3v3nsS/CVE_crawler
class Crawler(object):
    def __init__(self, urls):
        self.db = mongodb.get_db()
        self.collection = self.db["cves"]
        self.domains = {}
        self.myQueuer = Queuer(urls)
        self.exploits = {}
        self.myRedis = Redis()
        self.myCheckers = {}
        self.myChecker = None
        self.logger = logger.myLogger("Crawler")
        self.logger.info("Initializing Crawler...")
        self.logger.info(f"Redis at {self.myRedis.get_rj()}")
        ping = False
        self.logger.info('Waiting for Redis...')
        while ping == False:
            try:
                ping = self.myRedis.get_rj().ping()
            except:
                pass
            time.sleep(0.5)

    def get_index_page(self, domain):
        try:
            resp = requests.get(
                url='http://' + domain,
                headers={
                    'User-Agent':
                    'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36'
                })
            if resp.status_code == 200:
                return resp.headers, resp.text
        except Exception:
            extensions = ['html', 'htm', 'php', 'asp', 'aspx']
            for ext in extensions:
                resp = requests.get(
                    url='http://' + domain + f'/index.{ext}',
                    headers={
                        'User-Agent':
                        'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36'
                    })
                if resp.status_code == 200:
                    return resp.headers, resp.text
        return None, None

    def get_checker(self, domain):
        if domain not in self.myCheckers.keys():
            self.myChecker = Checker(domain, self.collection)
            self.myCheckers[domain] = self.myChecker
        else:
            self.myChecker = self.myCheckers[domain]

    def crawl(self):
        while not self.myQueuer.empty():
            url = self.myQueuer.pop()
            self.logger.info(f'Url to check: {url}')

            domain = urlparse(url).netloc
            if domain not in self.myQueuer.parsed_domains:
                self.myQueuer.current_domain = domain
                self.get_checker(domain)
            elif domain != self.myQueuer.current_domain:
                continue

            if not domain or domain == '':
                domain = 'Paths'
            if domain not in self.exploits:
                self.exploits[domain] = {
                    "true_vulns": [],
                    "almost_true": [],
                    "probable_vulns": [],
                    "possible_vulns": [],
                    "malware": []
                }
            if domain not in self.domains.keys():
                self.domains[domain] = {"data": {}, "is_parsed": False}
            if not url.startswith('http'):
                myurl = "http://" + url
            else:
                myurl = url
            try:
                malw_or_not = check_file.get_prediction_from_single_pe(myurl)
            except Exception as e:
                self.logger.error(e)

            if malw_or_not is not None:
                if isinstance(malw_or_not, tuple):
                    self.exploits[domain]["malware"].append(malw_or_not[1])
                    self.logger.info(
                        f'Found a \033[91mMalware\033[0m file in {myurl}!')
                else:
                    self.logger.info(
                        f'Found a \033[32mLegit\033[0m file in {myurl}!')
                continue

            data_about_domain = {}
            to_url = False
            domain = self.myQueuer.current_domain

            try:
                resp = requests.get(
                    myurl,
                    headers={
                        'User-Agent':
                        'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.75 Safari/537.36'
                    })
                response = extract(resp.content)
                if '/tag/' in myurl or '/feed' in myurl:
                    self.myQueuer.parsed_url.append(myurl)
                    continue

                self.myQueuer.push(response)

                if not self.domains.get(domain)["is_parsed"]:
                    if domain not in self.domains or not self.domains.get(
                            domain)["data"]:
                        headers, data = self.get_index_page(domain)
                        if headers is None:
                            headers = resp.headers
                            data = resp.text
                        data_about_domain = extract_infos(headers, data)
                        self.domains[domain]["data"] = data_about_domain
                    else:
                        data_about_domain = self.domains.get(domain)["data"]
                    if data_about_domain['cms'] == 'Default':
                        to_url = True

                    if not to_url:
                        self.myChecker.set_data(data_about_domain)
                        full = self.myRedis.get_redis_full(data_about_domain)
                        if full is not None and full:
                            self.myChecker.update_vulns_from_redis(full)
                        else:
                            just_cms = self.myRedis.get_redis_just_cms(
                                data_about_domain)
                            if just_cms is not None and just_cms:
                                self.myChecker.update_vulns_just_cms(just_cms)
                            else:
                                self.myChecker.check_details()
                        self.extract_vulns(data_about_domain=data_about_domain)

            except Exception as e:
                self.logger.error(e)
                traceback.print_tb(e.__traceback__)

            if to_url:
                self.extract_vulns(url=url, data_about_domain=None)

            self.myQueuer.parsed_url.append(url)

        self.exploits[domain]["possible_vulns"] = [
            item for item in self.exploits[domain]["possible_vulns"]
            if item not in
            ['true_vulns', 'almost_true', "probable_vulns", "possible_vulns"]
        ]
        for domain in self.exploits.keys():
            self.logger.info(domain)
            self.logger.info("True Vulns")
            self.logger.info(list(set(self.exploits[domain]["true_vulns"])))
            self.logger.info("Almost true Vulns")
            self.logger.info(list(set(self.exploits[domain]["almost_true"])))
            self.logger.info("Probable Vulns")
            self.logger.info(list(set(
                self.exploits[domain]["probable_vulns"])))
            self.logger.info("Possible Vulns")
            self.logger.info(
                str(list(set(self.exploits[domain]["possible_vulns"]))))
            self.logger.info("Malware found")
            self.logger.info(list(set(self.exploits[domain]["malware"])))
        self.logger.info(self.domains)

    def extract_vulns(self, data_about_domain=None, url=None):
        if url is not None:
            self.myChecker.check_path(urlparse(url).path)
        vulns = self.myChecker.get_all_vulns()
        self.exploits[domain]["true_vulns"].extend(vulns["true_vulns"])
        self.exploits[domain]["almost_true"].extend(vulns["almost_true"])
        self.exploits[domain]["probable_vulns"].extend(vulns["probable_vulns"])
        self.exploits[domain]["possible_vulns"].extend(vulns["possible_vulns"])
        self.domains[domain]["is_parsed"] = True

        self.update_redis(data_about_domain)

    def update_redis(self, data_about_domain):
        exploits_full = self.myChecker.get_vulns_by_cms_and_plug()
        self.myRedis.update_redis_full(data_about_domain, exploits_full)
        exploits_just_cms = self.myChecker.get_vulns_by_cms()
        self.myRedis.update_redis_just_cms(data_about_domain,
                                           exploits_just_cms)
コード例 #28
0
ファイル: Crawler.py プロジェクト: St3v3nsS/CVE_crawler
 def get_checker(self, domain):
     if domain not in self.myCheckers.keys():
         self.myChecker = Checker(domain, self.collection)
         self.myCheckers[domain] = self.myChecker
     else:
         self.myChecker = self.myCheckers[domain]
コード例 #29
0
ファイル: Lace.py プロジェクト: yanxueqing621/Lace
    args = parser.parse_args()

    #Make output directory if it currently doesnt exist
    if (args.outputDir):
        if (os.path.exists(args.outputDir)):
            print("Output directory exists")
        else:
            print("Creating output directory")
            os.mkdir(args.outputDir)

    Split(args.GenomeFile, args.ClusterFile, args.cores, args.maxTran,
          args.outputDir)

    if (args.alternate):
        cwd = os.getcwd()

        #Change to output directory
        os.chdir(args.outputDir)
        print("Making Alternate Annotation and checks")
        Checker('SuperDuper.fasta', args.cores)

        #Change back
        os.chdir(cwd)
        print('Done')

    if (args.tidy):
        print("Storing all extraneous files in SuperFiles")
        Clean(args.ClusterFile, args.outputDir)
        print("Done")
コード例 #30
0
    print(author())
    
    parser = argparse.ArgumentParser(description='Pentesting-tool')
    
    # Main arguments
    parser.add_argument("-target", dest="target", help="target IP / domain", required=None)
    parser.add_argument("-ports", dest="ports", help="Please, specify the target port(s) separated by comma[80,8080 by default]", default = "80,8080")
    parser.add_argument("-proxy", dest="proxy", help="Proxy[IP:PORT]", required=None)

    parsed_args = parser.parse_args()    
    
    shodanSearch = ShodanSearch()
    dnsResolver = UtilDNS()
    sshConnection = SSHConnection()
    checker = Checker()
    scraping = Scraping()
    scanningNMAP = ScanningNMAP()
    infoLocation = InfoLocation()
    httpScan = HTTPScan()
    checkOpenSslVulnerable = CheckOpenSslVulnerable()
    checkFtpVulnerable = CheckFTPVulnerable()
    extractMails = ExtractMails()
    checkVuln_SQL_XSS_LFI = CheckVuln_SQL_XSS_LFI()
    #scannerScapy = ScannerScapy()
    
    #default port list

    ip = ""
    hostname = ""
    option = ""
コード例 #31
0
ファイル: Form.py プロジェクト: shengc/StatusCheckerGUI
    def __init__(self, app, title):
        self.checker = Checker()
        self.plotter= Plotter()
        self.app = app
        
        wx.Frame.__init__(self, None, title=title, size=(400,400))
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        
        panel = wx.Panel(self)
        panel.SetBackgroundColour('#ededed')
        
        box = wx.BoxSizer(wx.VERTICAL)
        
        m_text = wx.StaticText(panel, -1, "Immigration Status Checker")
        m_text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
        m_text.SetSize(m_text.GetBestSize())
        box.Add(m_text, 0, wx.ALL, 10)
        
        id_box = wx.GridSizer(1, 2)
        m_id_text = wx.StaticText(panel, -1, "petition no.")
        id_box.Add(m_id_text, 0, wx.ALL, 10)
        
        self.m_id_textbox = wx.TextCtrl(panel)
        id_box.Add(self.m_id_textbox, 0, wx.ALL, 10)
        box.AddSizer(id_box)
        
        range_box = wx.GridSizer(1, 2)
        
        m_range_text = wx.StaticText(panel, -1, "range")
        m_range_text.SetSize(m_range_text.GetBestVirtualSize())
        range_box.Add(m_range_text, 0, wx.ALL, 10)
        
        self.m_range_textbox = wx.TextCtrl(panel, value="10")
        range_box.Add(self.m_range_textbox, 0, wx.ALL, 10)

        box.AddSizer(range_box)
        
        type_box = wx.BoxSizer(wx.HORIZONTAL)
        self.m_I140_checkbox = wx.CheckBox(panel, -1, 'I140')
        type_box.Add(self.m_I140_checkbox, 0, wx.ALL, 10)
        self.m_I485_checkbox = wx.CheckBox(panel, -1, 'I485')
        type_box.Add(self.m_I485_checkbox, 0, wx.ALL, 10)
        
        box.AddSizer(type_box)

        decision_box = wx.BoxSizer(wx.HORIZONTAL)
        self.m_submit = wx.Button(panel, wx.ID_APPLY, 'Submit')
        self.m_submit.Bind(wx.EVT_BUTTON, self.OnSubmit)
        decision_box.Add(self.m_submit, 0, wx.ALL, 20)

        m_close = wx.Button(panel, wx.ID_CLOSE, "Close")
        m_close.Bind(wx.EVT_BUTTON, self.OnClose)
        decision_box.Add(m_close, 0, wx.ALL, 20)
        
        self.m_clear = wx.Button(panel, wx.ID_CLEAR, 'Clear')
        self.m_clear.Bind(wx.EVT_BUTTON, self.OnClear)
        decision_box.Add(self.m_clear, 0, wx.ALL, 20)
        
        box.AddSizer(decision_box)
        
        self.m_report_to_file = wx.CheckBox(panel, -1, 'save to file?')
        box.Add(self.m_report_to_file, 0, wx.RIGHT | wx.ALIGN_RIGHT, 10)
                
        self.log = wx.TextCtrl(panel, wx.ID_ANY, size=(300,100), style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
        box.Add(self.log, 0, wx.EXPAND|wx.ALL, 10)
        
        self.logr = logging.getLogger('')
        self.logr.setLevel(logging.INFO)
        hdlr = WxLog(self.log)
        hdlr.setFormatter(logging.Formatter(Frame.log_format))
        self.logr.addHandler(hdlr)

        sys.stdout = Frame.RedirectText(self.log)
        sys.stderr = Frame.RedirectText(self.log)
        
        panel.SetSizer(box)
        panel.Layout()
コード例 #32
0
ファイル: Form.py プロジェクト: shengc/StatusCheckerGUI
class Frame(wx.Frame):
    log_format = '%(asctime)-15s [%(levelname)s] -  %(message)s'
    
    class RedirectText(object):
        def __init__(self,aWxTextCtrl):
            self.out=aWxTextCtrl
     
        def write(self,string):
            self.out.WriteText(string)
    
    def __init__(self, app, title):
        self.checker = Checker()
        self.plotter= Plotter()
        self.app = app
        
        wx.Frame.__init__(self, None, title=title, size=(400,400))
        self.Bind(wx.EVT_CLOSE, self.OnClose)
        
        panel = wx.Panel(self)
        panel.SetBackgroundColour('#ededed')
        
        box = wx.BoxSizer(wx.VERTICAL)
        
        m_text = wx.StaticText(panel, -1, "Immigration Status Checker")
        m_text.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD))
        m_text.SetSize(m_text.GetBestSize())
        box.Add(m_text, 0, wx.ALL, 10)
        
        id_box = wx.GridSizer(1, 2)
        m_id_text = wx.StaticText(panel, -1, "petition no.")
        id_box.Add(m_id_text, 0, wx.ALL, 10)
        
        self.m_id_textbox = wx.TextCtrl(panel)
        id_box.Add(self.m_id_textbox, 0, wx.ALL, 10)
        box.AddSizer(id_box)
        
        range_box = wx.GridSizer(1, 2)
        
        m_range_text = wx.StaticText(panel, -1, "range")
        m_range_text.SetSize(m_range_text.GetBestVirtualSize())
        range_box.Add(m_range_text, 0, wx.ALL, 10)
        
        self.m_range_textbox = wx.TextCtrl(panel, value="10")
        range_box.Add(self.m_range_textbox, 0, wx.ALL, 10)

        box.AddSizer(range_box)
        
        type_box = wx.BoxSizer(wx.HORIZONTAL)
        self.m_I140_checkbox = wx.CheckBox(panel, -1, 'I140')
        type_box.Add(self.m_I140_checkbox, 0, wx.ALL, 10)
        self.m_I485_checkbox = wx.CheckBox(panel, -1, 'I485')
        type_box.Add(self.m_I485_checkbox, 0, wx.ALL, 10)
        
        box.AddSizer(type_box)

        decision_box = wx.BoxSizer(wx.HORIZONTAL)
        self.m_submit = wx.Button(panel, wx.ID_APPLY, 'Submit')
        self.m_submit.Bind(wx.EVT_BUTTON, self.OnSubmit)
        decision_box.Add(self.m_submit, 0, wx.ALL, 20)

        m_close = wx.Button(panel, wx.ID_CLOSE, "Close")
        m_close.Bind(wx.EVT_BUTTON, self.OnClose)
        decision_box.Add(m_close, 0, wx.ALL, 20)
        
        self.m_clear = wx.Button(panel, wx.ID_CLEAR, 'Clear')
        self.m_clear.Bind(wx.EVT_BUTTON, self.OnClear)
        decision_box.Add(self.m_clear, 0, wx.ALL, 20)
        
        box.AddSizer(decision_box)
        
        self.m_report_to_file = wx.CheckBox(panel, -1, 'save to file?')
        box.Add(self.m_report_to_file, 0, wx.RIGHT | wx.ALIGN_RIGHT, 10)
                
        self.log = wx.TextCtrl(panel, wx.ID_ANY, size=(300,100), style = wx.TE_MULTILINE|wx.TE_READONLY|wx.HSCROLL)
        box.Add(self.log, 0, wx.EXPAND|wx.ALL, 10)
        
        self.logr = logging.getLogger('')
        self.logr.setLevel(logging.INFO)
        hdlr = WxLog(self.log)
        hdlr.setFormatter(logging.Formatter(Frame.log_format))
        self.logr.addHandler(hdlr)

        sys.stdout = Frame.RedirectText(self.log)
        sys.stderr = Frame.RedirectText(self.log)
        
        panel.SetSizer(box)
        panel.Layout()

    def OnClear(self, event):
        self.m_id_textbox.Clear()
        self.m_range_textbox.Clear()
        self.m_I140_checkbox.SetValue(False)
        self.m_I485_checkbox.SetValue(False)
        self.m_report_to_file.SetValue(False)
        self.log.Clear()

    def _validateFields(self):
        if not self.m_range_textbox.Value.isdigit() or int(self.m_range_textbox.Value) <= 0 or int(self.m_range_textbox.Value) > 100:
            dlg = wx.MessageDialog(self, "range needs to be an integer in (0, 100]", "Field Error", wx.OK|wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return False
        elif not self.m_I140_checkbox.GetValue() and not self.m_I485_checkbox.GetValue():
            dlg = wx.MessageDialog(self, "needs to select at least from I140 and I485", "Field Error", wx.OK|wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return False
        elif not self.checker.validateCase(self.m_id_textbox.GetValue()):
            dlg = wx.MessageDialog(self, "invalid status id", "Field Error", wx.OK|wx.ICON_ERROR)
            dlg.ShowModal()
            dlg.Destroy()
            return False
        else:
            return True

    def OnSubmit(self, event):
        try:
            self.m_submit.Disable()
            self.m_range_textbox.Disable()
            self.m_I140_checkbox.Disable()
            self.m_I485_checkbox.Disable()
            self.m_id_textbox.Disable()
            
            if not self._validateFields(): return
            else:
                t = []
                if self.m_I140_checkbox.GetValue(): t.append('I140')
                if self.m_I485_checkbox.GetValue(): t.append('I485')
                
                dialog = wx.ProgressDialog('progress bar', 'working...', int(self.m_range_textbox.GetValue()) * 2, self.m_range_textbox)
                stats = self.checker.taskManager(self.m_id_textbox.GetValue(), 
                                         int(self.m_range_textbox.GetValue()), 
                                         t, 
                                         self.logr,
                                         dialog,
                                         self.m_report_to_file.GetValue())
                self.plotter.plot(stats, t)
                dialog.Destroy()
        finally:
            wx.App.Yield(self.app)
            self.m_id_textbox.Enable()
            self.m_I485_checkbox.Enable()
            self.m_I140_checkbox.Enable()
            self.m_range_textbox.Enable()
            self.m_submit.Enable()

    def OnClose(self, event):
        self.Destroy()
コード例 #33
0
        "-aa",
        help=
        "Create alternate annotations and create metrics on success of SuperTranscript Building",
        action='store_true')
    parser.add_argument("--clear",
                        "-c",
                        help="Clear intermediate files after processing",
                        action='store_true')
    parser.add_argument(
        "--maxTran",
        help=
        "Set a maximum for the number of transcripts from a cluster to be included for building the SuperTranscript (default=50).",
        default=20,
        type=int)

    args = parser.parse_args()

    Split(args.GenomeFile, args.ClusterFile, args.cores, args.maxTran)

    if (args.alternate):
        dir = os.path.dirname(args.ClusterFile)
        if (dir == ''): dir = '.'
        print("Making Alternate Annotation and checks")
        Checker(dir + '/SuperDuper.fasta', args.cores)
        print('Done')

    if (args.clear):
        print("Clearing all extraneous files")
        Clean(args.ClusterFile)
        print("Done")
コード例 #34
0
 def check(asttree, lst):
     ex = Checker()
     return str(ex.visit(asttree)) == str(lst)