def find_by_name(self, match): for file in glob.glob("/tmp/pullit/git/%s/%s" % (self.repo.full_name, match), recursive=True): information = "Repo: %s contains: %s" % (self.repo.full_name, file) print(information) Events.emit(Events, 'filename-found', information)
def found(self, metadata, event): information = "%s" % metadata['content'] payload = { 'name': metadata['name'], 'match': metadata['match'], 'credentials': json.dumps(metadata['content']), 'repo': self.repo } print(information) Events.emit(Events, event, payload)
def find_by_content(self, pattern): for file in glob.glob("/tmp/pullit/git/%s/**/*.*" % self.repo.full_name, recursive=True): try: with open(file) as f: try: for line in f: for found in re.finditer(pattern, line): information = "File: %s contains: %s" % (file, found.string) print(information) Events.emit(Events, 'regex-found', information) except UnicodeDecodeError: return except IsADirectoryError: return
def __init__(self): self.repo_id = '' self.github = Repositories() self.connection = Database().get() Events.listen(Events, 'checked-repo', self.checked) Events.listen(Events, 'regex-found', self.notify) Events.listen(Events, 'extension-found', self.notify) Events.listen(Events, 'filename-found', self.notify)
def __init__(self): Events.listen(Events, 'regex-found', self.slack) Events.listen(Events, 'extension-found', self.slack) Events.listen(Events, 'filename-found', self.slack)
def __init__(self, repo): self.repo = repo Events.emit(Events, 'checked-repo', {'name': repo})