Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new tick method #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions attackers/threads_attacker.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@
from string import ascii_uppercase, digits
import random
from time import sleep
from time import time as get_sec

_service = "service_name"
_author = "ocean"
_submitter_url = 'http://submitter.local/submit'

_flg_re = r"FLG\w{13}"

# This is needed for the alternative tick method
# _tick_duration = 15*60

q = Queue.Queue()

Expand Down Expand Up @@ -75,6 +78,11 @@ def submit_flags(self, flags, target):
def attack(self):

while(1):
# if ictf is not supported you can use this method
# get the current time before and after the attack, compute the
# time before the next tick and then sleep
# init_time = int(get_sec())

threads = []
team = ic.login("***EMAIL***", "***TOKEN***")
targets = team.get_targets(_service)
Expand All @@ -99,6 +107,11 @@ def attack(self):
while(team.get_tick_info()['tick_id'] <= t_info['tick_id']):
sleep(1)

# Use this for the alternative tick method
# after_time = int(get_sec())
# sleep_time = TICK_DURATION - (after_time - init_time)
# print("Waiting for the next tick (%d seconds)" % sleep_time)
# sleep(sleep_time)

if __name__ == "__main__":
a = Attacker()
Expand Down