Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
CTF
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Grzegorz
CTF
Commits
8b42688e
Commit
8b42688e
authored
Mar 21, 2016
by
Grzegorz Pietrusza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move salt to configuration
parent
880e48e2
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
2 deletions
+13
-2
configuration.yml
service/configuration.yml
+1
-0
ApplicationConfiguration.java
...honers/krakyournet/ctf/core/ApplicationConfiguration.java
+11
-0
TasksRepository.java
...phoners/krakyournet/ctf/repositories/TasksRepository.java
+1
-2
No files found.
service/configuration.yml
View file @
8b42688e
...
@@ -10,6 +10,7 @@ dbPort: 27017
...
@@ -10,6 +10,7 @@ dbPort: 27017
dbName
:
db
dbName
:
db
flagHashMethod
:
"
MD5"
flagHashMethod
:
"
MD5"
salt
:
"
SECURE_SALT"
admins
:
admins
:
-
name
:
"
gpietrus_admin"
-
name
:
"
gpietrus_admin"
...
...
service/src/main/java/com/telephoners/krakyournet/ctf/core/ApplicationConfiguration.java
View file @
8b42688e
...
@@ -18,6 +18,7 @@ public class ApplicationConfiguration extends Configuration
...
@@ -18,6 +18,7 @@ public class ApplicationConfiguration extends Configuration
private
List
<
TextTask
>
textTasks
;
private
List
<
TextTask
>
textTasks
;
private
List
<
WebTask
>
webTasks
;
private
List
<
WebTask
>
webTasks
;
private
List
<
User
>
admins
;
private
List
<
User
>
admins
;
private
String
salt
;
public
List
<
User
>
getAdmins
()
public
List
<
User
>
getAdmins
()
{
{
...
@@ -98,4 +99,14 @@ public class ApplicationConfiguration extends Configuration
...
@@ -98,4 +99,14 @@ public class ApplicationConfiguration extends Configuration
{
{
this
.
webTasks
=
webTasks
;
this
.
webTasks
=
webTasks
;
}
}
public
String
getSalt
()
{
return
salt
;
}
public
void
setSalt
(
String
salt
)
{
this
.
salt
=
salt
;
}
}
}
service/src/main/java/com/telephoners/krakyournet/ctf/repositories/TasksRepository.java
View file @
8b42688e
...
@@ -27,7 +27,6 @@ public class TasksRepository implements Repository
...
@@ -27,7 +27,6 @@ public class TasksRepository implements Repository
private
Datastore
datastore
;
private
Datastore
datastore
;
private
TeamsRepository
teamsRepository
;
private
TeamsRepository
teamsRepository
;
private
SolutionsRepository
solutionsRepository
;
private
SolutionsRepository
solutionsRepository
;
private
String
salt
=
"SECURE_SALT"
;
//todo: move to configuration!
@Inject
@Inject
public
TasksRepository
(
ApplicationConfiguration
applicationConfiguration
,
Datastore
datastore
,
public
TasksRepository
(
ApplicationConfiguration
applicationConfiguration
,
Datastore
datastore
,
...
@@ -93,7 +92,7 @@ public class TasksRepository implements Repository
...
@@ -93,7 +92,7 @@ public class TasksRepository implements Repository
public
String
calculateHashValue
(
String
username
,
String
flagValue
)
public
String
calculateHashValue
(
String
username
,
String
flagValue
)
{
//todo
{
//todo
String
combinedStrings
=
salt
+
username
+
flagValue
;
//todo
String
combinedStrings
=
applicationConfiguration
.
getSalt
()
+
username
+
flagValue
;
//todo
MessageDigest
md5
=
null
;
//todo: discuss
MessageDigest
md5
=
null
;
//todo: discuss
try
{
try
{
md5
=
MessageDigest
.
getInstance
(
applicationConfiguration
.
getFlagHashMethod
());
md5
=
MessageDigest
.
getInstance
(
applicationConfiguration
.
getFlagHashMethod
());
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment