Skip to content

Commit

Permalink
Source v1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
SanderGi authored Feb 14, 2022
1 parent c2bcb53 commit a4d7fa9
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 13 deletions.
3 changes: 3 additions & 0 deletions Source/README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ pip install PyInstaller

# Compile to exe:
python -m eel app.py web --onefile --noconsole

# Compile to folder:
python -m eel app.py web --noconsole
2 changes: 1 addition & 1 deletion Source/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ def collectWifiData(times, waittime):
eel.sleep(waittime)
eel.displayWifiData(i, str(get_BSSI()))

eel.start('index.html', size=(1024, 768), position=(0,0))
eel.start('index.html', port=8080, size=(1024, 768), position=(0,0))
44 changes: 44 additions & 0 deletions Source/app.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# -*- mode: python ; coding: utf-8 -*-


block_cipher = None


a = Analysis(['app.py'],
pathex=[],
binaries=[],
datas=[('C:\\Users\\alexa\\Desktop\\Project Scioly\\WiFi\\WiFiStrengthTester\\env\\lib\\site-packages\\eel\\eel.js', 'eel'), ('web', 'web')],
hiddenimports=['bottle_websocket'],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)

exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='app',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=False,
disable_windowed_traceback=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='app')
11 changes: 7 additions & 4 deletions Source/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,22 @@
<h2>Control Panel</h2>
<div>
<label>Trial Count: </label>
<input type="text" id="trialcount" value="10">
<input type="text" id="trialcount" value="15" placeholder="How many scans">
</div>
<div>
<label>Time (sec): </label>
<input type="text" id="interval" value="10">
<input type="text" id="interval" value="10" placeholder="How long to scan">
</div>
<div>
<label>SSID: </label>
<input type="text" id="ssid" value="master-control">
<input type="text" id="ssid" value="dd-wrt" list="ssids" placeholder="Network Name">
<datalist id="ssids">
<option value="*all*">
</datalist>
</div>
<br>
<button id="measure" onclick="collectData()">COLLECT DATA!</button>

<div style="height: 15px;"></div>
<p id="average">Mean RSS: not calculated</p>
<p id="range">RSS range: not calculated</p>
<p id="successes">Complete Scans: not calculated</p>
Expand Down
25 changes: 21 additions & 4 deletions Source/web/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@ function displayWifiData(trial, string) {
}

// format data in table
document.getElementById('ssids').innerHTML = '<option value="*all*">';
$('table tr:last').css("border-bottom","2px solid black");
for (const [ssid, rss] of Object.entries(ssids)) {
// const average = (array) => array.reduce((a, b) => a + b) / array.length;
document.getElementById('ssids').innerHTML += '<option value="'+ssid+'">';
if (ssid != id && id != '*all*') continue;
let tr = tbody.insertRow();
let td = tr.insertCell();
td.appendChild(document.createTextNode(`${trial}`));
Expand All @@ -42,12 +45,17 @@ function displayWifiData(trial, string) {
totalRSS += rssReading;
minRSS = Math.min(rssReading, minRSS);
maxRSS = Math.max(rssReading, maxRSS);
let average = totalRSS / count;
let average = Math.round(totalRSS / count);
document.getElementById("average").innerHTML = `Mean RSS: ${average} dBm`;
document.getElementById("range").innerHTML = `RSS range: ${minRSS} to ${maxRSS} dBm`;
document.getElementById("successes").innerHTML = "Complete Scans: " + count;
}
}

// reenable button if all trials are complete
if (trial == trialcount - 1) {
document.getElementById("measure").disabled = false;
}
}

let tbl = document.createElement('table');
Expand Down Expand Up @@ -76,21 +84,30 @@ function createTable() {
}

createTable();
let id;
let id = "alor873uw:#(*ug";
let minRSS = Infinity;
let maxRSS = -Infinity;
let totalRSS = 0;
let count = 0;
let trialcount = 0;
eel.collectWifiData(2, 2) // initial trial to find networks
function collectData() {
document.getElementById("measure").disabled = true;
document.getElementById("trials").innerHTML = "<h2>Data Table</h2>";
tbl = document.createElement('table');
createTable();
let trialcount = parseInt(document.getElementById("trialcount").value);
trialcount = parseInt(document.getElementById("trialcount").value);
let interval = parseInt(document.getElementById("interval").value);
id = document.getElementById("ssid").value;
minRSS = Infinity;
maxRSS = -Infinity;
totalRSS = 0;
count = 0;
eel.collectWifiData(trialcount, interval / trialcount);
}
}

let savedVal;
$('#ssid').on('click', function() {
savedVal = $(this).val();
$(this).val('');
});
19 changes: 15 additions & 4 deletions Source/web/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ body {
}

#control > div {
margin-bottom: 10px;
margin-bottom: 5px;
width: 90%;
text-align: right;
}
Expand All @@ -39,13 +39,20 @@ body {
border-radius: 15px;
box-shadow: 0 9px #999;
margin: auto;
}
}

#measure:active {
#measure:active {
background-color: #3e8e41;
box-shadow: 0 5px #666;
transform: translateY(4px);
}
}

#measure:disabled {
color: rgba(255, 255, 255, 0.705);
background-color: rgba(76, 175, 79, 0.705);
box-shadow: 0 9px rgba(153, 153, 153, 0.705);
cursor: wait;
}

table {
margin: 20px;
Expand Down Expand Up @@ -92,4 +99,8 @@ td {
bottom: 40%;
width: 40%;
text-align: left;
}

input::-webkit-calendar-picker-indicator {
opacity: 100;
}

0 comments on commit a4d7fa9

Please sign in to comment.