Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zerfiXOR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ruben Anthony Gonzalez
zerfiXOR
Commits
e424f575
Commit
e424f575
authored
5 years ago
by
Ruben Anthony Gonzalez
Browse files
Options
Downloads
Patches
Plain Diff
minor refactoring
parent
88625195
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
changeme.py
+9
-1
9 additions, 1 deletion
changeme.py
config.py
+0
-5
0 additions, 5 deletions
config.py
main.py
+5
-5
5 additions, 5 deletions
main.py
runner.py
+3
-3
3 additions, 3 deletions
runner.py
with
17 additions
and
14 deletions
changeme.py
+
9
−
1
View file @
e424f575
...
...
@@ -15,8 +15,16 @@ RES_FILE_PATH = "results.txt"
RES_FILE
=
None
# TODO: Make list of team ids
# TODO: Change these values
# list of team ids
all_teams
=
[
i
for
i
in
range
(
16
)]
# Has to be byte string since wre looking through byte output (STDOUT)
flag_regex
=
b
"
flag{[A-Za-z0-9_.]+}
"
exploit_dir
=
"
exploits
"
wait_between_runs
=
30
# Number of exploit workers
proc_num
=
4
def
team_id_to_ip
(
team_id
):
...
...
This diff is collapsed.
Click to expand it.
config.py
deleted
100644 → 0
+
0
−
5
View file @
88625195
# Has to be byte string since wre looking through byte output (STDOUT)
flag_regex
=
b
"
flag{[A-Za-z0-9_.]+}
"
exploit_dir
=
"
exploits
"
wait_between_runs
=
30
proc_num
=
4
This diff is collapsed.
Click to expand it.
main.py
+
5
−
5
View file @
e424f575
import
multiprocessing
as
mp
import
logging
as
log
import
os
import
c
onfig
import
c
hangeme
import
time
from
runner
import
runner
...
...
@@ -9,7 +9,7 @@ from submitter import do_submissions
from
changeme
import
submit_flag
,
all_teams
REMAINING_FILE
=
"
remaining_flags.json
"
EXPLOIT_DIR
=
c
onfig
.
exploit_dir
EXPLOIT_DIR
=
c
hangeme
.
exploit_dir
runners
=
[]
submitter
=
None
...
...
@@ -52,12 +52,12 @@ def do_scheduling(work_queue, flag_queue):
"
team_id
"
:
team_id
,
"
exploit
"
:
exploit
})
if
c
onfig
.
wait_between_runs
:
time
.
sleep
(
c
onfig
.
wait_between_runs
)
if
c
hangeme
.
wait_between_runs
:
time
.
sleep
(
c
hangeme
.
wait_between_runs
)
def
main
():
submit_remaining
()
procs
=
c
onfig
.
proc_num
procs
=
c
hangeme
.
proc_num
flag_queue
=
mp
.
Queue
()
work_queue
=
mp
.
Queue
()
...
...
This diff is collapsed.
Click to expand it.
runner.py
+
3
−
3
View file @
e424f575
...
...
@@ -2,7 +2,7 @@ import os
import
logging
as
log
from
changeme
import
team_id_to_ip
import
subprocess
as
sp
import
c
onfig
import
c
hangeme
import
re
import
logging
as
log
...
...
@@ -16,7 +16,7 @@ def flags_iter(s, flag_regex):
def
runner
(
runner_id
,
work_queue
,
flag_queue
):
log
.
info
(
"
[RUNNER %d] started
"
,
runner_id
)
os
.
chdir
(
c
onfig
.
exploit_dir
)
os
.
chdir
(
c
hangeme
.
exploit_dir
)
while
True
:
job
=
work_queue
.
get
()
...
...
@@ -25,7 +25,7 @@ def runner(runner_id, work_queue, flag_queue):
log
.
info
(
"
[RUNNER %d] launching %s against %d
"
,
runner_id
,
exploit
,
team_id
)
try
:
result
=
sp
.
check_output
([
"
./
"
+
exploit
,
team_id_to_ip
(
team_id
),
str
(
team_id
)],
stderr
=
sp
.
STDOUT
)
for
flag
in
flags_iter
(
result
,
c
onfig
.
flag_regex
):
for
flag
in
flags_iter
(
result
,
c
hangeme
.
flag_regex
):
log
.
info
(
"
[RUNNER %d] found flag %s for team %d
"
,
runner_id
,
flag
,
team_id
)
flag_queue
.
put
({
'
team_id
'
:
team_id
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment