Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
First_git
Project
Project
Details
Activity
Releases
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
rawan.salameh
First_git
Commits
f0d4ec10
Commit
f0d4ec10
authored
Nov 04, 2025
by
rawan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
step3
parent
007c03db
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
3 deletions
+7
-3
DescendingHackerThread.java
src/hacker/DescendingHackerThread.java
+7
-3
No files found.
src/hacker/DescendingHackerThread.java
View file @
f0d4ec10
...
...
@@ -2,12 +2,13 @@ package hacker;
public
class
DescendingHackerThread
extends
Thread
{
private
Vault
vault
;
private
int
attempts
=
0
;
public
static
final
int
MAX_PASSWORD
=
9999
;
public
DescendingHackerThread
(
Vault
vault
)
{
this
.
vault
=
vault
;
//A function that changes the name of the thread only to make it easier to track it while running
this
.
setName
(
this
.
getClass
().
getSimpleName
());
}
...
...
@@ -16,9 +17,12 @@ public class DescendingHackerThread extends Thread {
for
(
int
x
=
MAX_PASSWORD
;
x
>=
0
;
x
--)
{
attempts
++;
System
.
out
.
print
(
"\r"
+
this
.
getName
()
+
" try: "
+
attempts
+
" "
);
System
.
out
.
println
();
if
(
vault
.
isCorrectPassword
(
x
))
{
System
.
out
.
println
(
"success "
+
this
.
getName
()
+
"the correct password "
+
x
);
System
.
out
.
println
();
System
.
out
.
println
(
"success "
+
this
.
getName
()
+
"the password is: "
+
x
+
" after "
+
attempts
+
" attemps"
);
System
.
exit
(
0
);
}
}
...
...
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