Skip to content

Commit

Permalink
access dashboard and hackerlab via localhost
Browse files Browse the repository at this point in the history
  • Loading branch information
HappyStoic committed Aug 30, 2024
1 parent ff7c359 commit fd53fb8
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ To start the lab, use already prepared [docker-compose.yml](./docker-compose.yml
docker compose up
```

After the lab bootstraps, navigate in your browser to [http://172.20.0.3/](http://172.20.0.3/) to access a lab's dashboard. The dashboard contains:
After the lab bootstraps, navigate in your browser to [http://127.0.0.1/](http://127.0.0.1/) to access a lab's dashboard. The dashboard contains:
* Predefined environments for each weekly class of [Introduction to Security class](https://cybersecurity.bsy.fel.cvut.cz/) for remote students
* List of standalone hacking challenges
* Challenges are divided by difficulty into 3 categories `EASY`, `MEDIUM`, `HARD`
Expand All @@ -37,7 +37,7 @@ After the lab bootstraps, navigate in your browser to [http://172.20.0.3/](http:
* Built-in SSH web shell to interact with deployed services in the lab
* The SSH connection is made to a `hackerlab` container.
* If preferred, you can connect directly using SSH from your terminal to the `hackerlab` container with command
`ssh root@172.20.0.2` and password `ByteThem123`
`ssh root@127.0.0.1 -p 2222` and password `ByteThem123`


### Troubleshooting
Expand Down
2 changes: 1 addition & 1 deletion dashboard/client/src/Introduction.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<li>Built-in terminal to your <b>hackerlab</b> machine
<ul class="text-start mb-4" style="list-style-type: disc; padding-left: 20px;">
<li>Click the button at the bottom of the page to open the terminal</li>
<li>Or connect to the hackerlab directly using command <code>ssh root@172.20.0.2</code> and a password <code>ByteThem123</code></li>
<li>Or connect to the hackerlab directly using command <code>ssh root@127.0.0.1 -p 2222</code> and a password <code>ByteThem123</code></li>
</ul>
</li>

Expand Down
4 changes: 2 additions & 2 deletions dashboard/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async def startup():
___) | |_| | | (_| | || (_) | |__| |_| | |_) | __/ | | |__| (_| | |_) |
|____/ \\__|_| \\__,_|\\__\\___/ \\____\\__, |_.__/ \\___|_| |_____\\__,_|_.__/
|___/
| RUNNING, NAVIGATE TO http://172.20.0.3/ IN YOUR BROWSER |
| RUNNING, NAVIGATE TO http://127.0.0.1/ IN YOUR BROWSER |
+----------------------------------------------------------+
"""
eprint(banner)
Expand Down Expand Up @@ -391,4 +391,4 @@ async def llm_chat():

if __name__ == '__main__':
init()
app.run(debug=True, host='172.20.0.3', port=80)
app.run(debug=True, host='0.0.0.0', port=80)
4 changes: 2 additions & 2 deletions dashboard/server/ws_ssh.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def eprint(*args, **kwargs):


app = Flask(__name__)
socketio = SocketIO(app, async_mode='eventlet', cors_allowed_origins='http://172.20.0.3')
socketio = SocketIO(app, async_mode='eventlet', cors_allowed_origins='http://127.0.0.1')

clients = {} # Store SSH clients and channels by session ID

Expand Down Expand Up @@ -87,4 +87,4 @@ def handle_disconnect():


if __name__ == '__main__':
socketio.run(app, debug=True, host='172.20.0.3', port=8080)
socketio.run(app, debug=True, host='0.0.0.0', port=8080)
5 changes: 5 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ services:
container_name: hackerlab
hostname: hackerlab
restart: always
ports:
- "2222:22"
networks:
playground-net:
ipv4_address: 172.20.0.2
Expand All @@ -15,6 +17,9 @@ services:
container_name: dashboard
hostname: dashboard
restart: always
ports:
- "80:80"
- "8080:8080"
networks:
playground-net:
ipv4_address: 172.20.0.3
Expand Down

0 comments on commit fd53fb8

Please sign in to comment.