-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_bb84_menu.bat
More file actions
100 lines (88 loc) · 2.39 KB
/
run_bb84_menu.bat
File metadata and controls
100 lines (88 loc) · 2.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
@echo off
setlocal EnableExtensions
REM ==============================================================
REM BB84 QKD Demo Menu (Windows)
REM
REM Put this BAT file in your BB84 project folder (same level as:
REM venv\, alice.py, bob.py, run_bb84_full.py, run_bb84_eve_demo.py, channel\
REM ===============================================================
set "PROJ=%~dp0"
set "PY=%PROJ%venv\Scripts\python.exe"
if not exist "%PY%" (
echo ERROR: venv python not found at:
echo %PY%
echo.
echo Fix: create the venv in this folder:
echo python -m venv venv
echo venv\Scripts\activate
echo pip install amazon-braket-sdk numpy
echo.
pause
exit /b 1
)
if not exist "%PROJ%channel" mkdir "%PROJ%channel"
:menu
cls
echo ==========================================
echo BB84 QKD Demo (Braket Local Simulation)
echo Project: %PROJ%
echo ==========================================
echo.
echo 1^) Two-window demo (Alice + Bob)
echo 2^) Full pipeline (QBER + Golay + Privacy Amplification)
echo 3^) Clean (channel outputs + caches)
echo 4^) Eve demo (intercept-resend attack)
echo 0^) Exit
echo.
set /p CHOICE=Choose an option [0-4] :
if "%CHOICE%"=="1" goto run_two
if "%CHOICE%"=="2" goto run_full
if "%CHOICE%"=="3" goto clean
if "%CHOICE%"=="4" goto eve
if "%CHOICE%"=="0" goto end
echo Invalid choice. Press any key...
pause >nul
goto menu
:run_two
cls
echo Starting two windows...
start "BB84 - Alice" cmd /k ""%PY%" "%PROJ%alice.py""
start "BB84 - Bob" cmd /k ^
"echo Waiting for Alice channel files... & ^
:loop & ^
if not exist ""%PROJ%channel\alice_states.npy"" (timeout /t 1 >nul & goto loop) & ^
if not exist ""%PROJ%channel\encoding_basis.npy"" (timeout /t 1 >nul & goto loop) & ^
echo Running Bob... & ^
""%PY%"" ""%PROJ%bob.py"" & ^
echo. & echo Bob finished. Press any key to close. & pause >nul"
echo.
echo Windows opened. Press any key to return to menu...
pause >nul
goto menu
:run_full
cls
echo Running full pipeline...
"%PY%" "%PROJ%run_bb84_full.py"
echo.
pause
goto menu
:eve
cls
echo Running Eve intercept-resend demo...
"%PY%" "%PROJ%run_bb84_eve_demo.py"
echo.
pause
goto menu
:clean
cls
echo Cleaning channel outputs and caches...
if exist "%PROJ%channel\*.npy" del /q "%PROJ%channel\*.npy"
if exist "%PROJ%__pycache__" rmdir /s /q "%PROJ%__pycache__"
if exist "%PROJ%utils\__pycache__" rmdir /s /q "%PROJ%utils\__pycache__"
echo Done.
pause
goto menu
:end
echo Bye!
endlocal
exit /b 0