-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.py
More file actions
65 lines (51 loc) · 1.69 KB
/
Copy pathcore.py
File metadata and controls
65 lines (51 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
from time import sleep
from github.AuthenticatedUser import AuthenticatedUser
from github.Issue import Issue
from github.IssueComment import IssueComment
from github.Repository import Repository
REACTIONS_LIST = [
"laugh",
"rocket",
"-1",
"heart",
"eyes",
"+1",
"hooray",
"confused"
]
def waitForSync(sync_comment: IssueComment, content: str, covert_github_user: AuthenticatedUser):
print(f"[X] Waiting for {content} flag ", end="")
while True:
print(".", end="")
sleep(2)
covert_sync_reaction = [reaction for reaction in sync_comment.get_reactions() if
reaction.user == covert_github_user and reaction.content == content]
if len(covert_sync_reaction) == 1:
covert_sync_reaction[0].delete()
print("")
return
def translateMessageToBinary(reactions: list):
"""
:param reactions: ["laugh", "hooray", "confused"]
:return: binary_message : "10000011"
"""
message = ""
for reaction in REACTIONS_LIST:
if reaction in reactions:
message = message + "1"
else:
message = message + "0"
return message
def translateBinaryToGithubReactions(message: str):
parsed_reactions = []
for reaction, message_bit in zip(REACTIONS_LIST, message):
if message_bit == "1":
parsed_reactions.append(reaction)
return parsed_reactions
def getBufferWideIssue(repo: Repository, buffer_length: int):
for issue in repo.get_issues():
if int(issue.comments) > buffer_length:
return issue
def chunk_list(lst: list, n: int):
for i in range(0, len(lst), n):
yield lst[i:i + n]