safeweb 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ include README.md
2
+ include WORKFLOW_GUIDE.md
3
+ include requirements.txt
4
+ include config.py
5
+ include safeweb_run.sh
6
+ include test_install.sh
7
+ include validate_data.py
8
+ recursive-include src *.py
9
+ recursive-include results .gitkeep
10
+ global-exclude __pycache__
11
+ global-exclude *.pyc
12
+ global-exclude *.db
13
+ global-exclude *.csv
14
+ global-exclude *.json
15
+ global-exclude *.xlsx
16
+ global-exclude .DS_Store
17
+ prune venv
18
+ prune safeweb.egg-info
safeweb-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,299 @@
1
+ Metadata-Version: 2.4
2
+ Name: safeweb
3
+ Version: 1.0.0
4
+ Summary: Browser safety and sustainability testing tool
5
+ Author: SafeWeb Project
6
+ Classifier: Programming Language :: Python :: 3
7
+ Classifier: Operating System :: MacOS
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
10
+ Requires-Dist: selenium>=4.15.2
11
+ Requires-Dist: webdriver-manager>=4.0.1
12
+ Requires-Dist: psutil>=5.9.6
13
+ Requires-Dist: pandas>=2.1.4
14
+ Requires-Dist: numpy>=1.25.2
15
+ Requires-Dist: matplotlib>=3.8.2
16
+ Requires-Dist: seaborn>=0.13.0
17
+ Requires-Dist: pyyaml>=6.0.1
18
+ Requires-Dist: requests>=2.31.0
19
+ Dynamic: author
20
+ Dynamic: classifier
21
+ Dynamic: description
22
+ Dynamic: description-content-type
23
+ Dynamic: requires-dist
24
+ Dynamic: requires-python
25
+ Dynamic: summary
26
+
27
+ # SafeWeb CLI
28
+
29
+ Browser Safety and Sustainability Testing Tool
30
+
31
+ Test and compare web browsers on your Mac to determine which is most energy-efficient and safest. Collects 35+ real-time metrics including CPU, memory, energy consumption, privacy, security, and AI impact.
32
+
33
+ ---
34
+
35
+ ## Quick Start
36
+
37
+ ### Option A: Zip (recommended for most users)
38
+
39
+ New users -- just run:
40
+
41
+ cd safeweb-cli
42
+ ./safeweb_run.sh list
43
+
44
+ The script automatically sets up a virtual environment, installs all dependencies, and detects your installed browsers. No manual setup needed.
45
+
46
+ All subsequent commands:
47
+
48
+ ./safeweb_run.sh run-tests -b chrome -t 1
49
+ ./safeweb_run.sh analyze
50
+ ./safeweb_run.sh recommend
51
+ ./safeweb_run.sh export -f csv
52
+
53
+ ### Option B: pip install
54
+
55
+ pip install safeweb-1.0.0.tar.gz
56
+ cd ~/your-project-folder
57
+ safeweb list
58
+
59
+ All commands work the same way -- just replace `./safeweb_run.sh` with `safeweb`. Results are saved in a `results/` folder created in whatever directory you run the commands from. Run all commands from the same folder so they share the same data.
60
+
61
+ safeweb run-tests -b chrome -t 1
62
+ safeweb analyze
63
+ safeweb recommend
64
+ safeweb export -f csv
65
+
66
+ Need help? Run `safeweb --help` or `safeweb <command> --help`
67
+
68
+ ---
69
+
70
+ ## Commands
71
+
72
+ ### list -- Show installed browsers
73
+
74
+ ./safeweb_run.sh list
75
+
76
+ Detects which browsers are installed in /Applications/ on your Mac.
77
+
78
+ ---
79
+
80
+ ### run-tests -- Run browser tests
81
+
82
+ ./safeweb_run.sh run-tests [options]
83
+
84
+ Options:
85
+
86
+ -b Browsers to test: chrome firefox safari edge opera brave tor (default: all installed)
87
+ -e Search engines: google bing duckduckgo yahoo (default: all)
88
+ -t Trials per combination (default: 5)
89
+ -q Custom search query (default: predefined queries)
90
+ --dry-run Preview test plan without running
91
+
92
+ Examples:
93
+
94
+ # Quick test (1 trial = ~1 minute)
95
+ ./safeweb_run.sh run-tests -b chrome -t 1
96
+
97
+ # Two browsers, custom query
98
+ ./safeweb_run.sh run-tests -b chrome firefox -q "climate change" -t 3
99
+
100
+ # Full research study (25 trials)
101
+ ./safeweb_run.sh run-tests -t 25
102
+
103
+ # Preview what would run
104
+ ./safeweb_run.sh run-tests --dry-run
105
+
106
+ How long does it take?
107
+
108
+ 1 trial = ~1 minute
109
+ 5 trials = ~5 minutes (default)
110
+ 25 trials = ~25 minutes (research)
111
+
112
+ Each test runs for 30 seconds to collect quality metrics.
113
+
114
+ ---
115
+
116
+ ### analyze -- View results
117
+
118
+ ./safeweb_run.sh analyze
119
+ ./safeweb_run.sh analyze -b chrome # Single browser
120
+ ./safeweb_run.sh analyze --ai-comparison # AI vs non-AI energy
121
+
122
+ Shows a comparison table with energy (Wh), CPU%, memory (MB), privacy score, and security score per browser. Also shows CO2 estimates and best-per-category winners.
123
+
124
+ ---
125
+
126
+ ### recommend -- Best browser for your machine
127
+
128
+ ./safeweb_run.sh recommend
129
+
130
+ Ranks all tested browser+engine combinations using weighted scoring:
131
+
132
+ Energy 40% -- primary sustainability metric
133
+ Performance 30% -- CPU, memory, duration
134
+ Privacy 20% -- cookies, trackers, HTTPS
135
+ Security 10% -- HTTPS, mixed content, secure cookies
136
+
137
+ Results are specific to your hardware -- scores are not comparable across different machines.
138
+
139
+ ---
140
+
141
+ ### compare -- Head-to-head comparison
142
+
143
+ ./safeweb_run.sh compare chrome:google firefox:duckduckgo
144
+
145
+ Compares two browser:engine configurations with detailed per-metric breakdown and weighted scores.
146
+
147
+ ---
148
+
149
+ ### export -- Export data
150
+
151
+ ./safeweb_run.sh export -f csv # CSV (default)
152
+ ./safeweb_run.sh export -f json
153
+ ./safeweb_run.sh export -f excel
154
+ ./safeweb_run.sh export -f csv -o my_data.csv
155
+
156
+ Exports to results/exports/. Includes all 35+ metrics per test.
157
+
158
+ ---
159
+
160
+ ### report -- Generate markdown report
161
+
162
+ ./safeweb_run.sh report
163
+ ./safeweb_run.sh report --charts # Include PNG charts
164
+ ./safeweb_run.sh report -o my_report.md
165
+
166
+ Saves to results/reports/.
167
+
168
+ ---
169
+
170
+ ### explain -- Understand the scoring methodology
171
+
172
+ ./safeweb_run.sh explain
173
+
174
+ Explains how privacy, security, and sustainability scores are calculated with research citations.
175
+
176
+ ---
177
+
178
+ ## Metrics Collected (35+)
179
+
180
+ Category Metrics
181
+ -------- -------
182
+ CPU mean, max, min (%)
183
+ Memory mean MB, max MB, mean %, max %
184
+ Network bytes sent, bytes received
185
+ Disk read bytes, write bytes
186
+ Energy local Wh (CPU + memory + base + display), remote Wh (server + PUE), total Wh
187
+ Privacy third-party cookies, tracker count, HTTPS, score /10
188
+ Security mixed content, secure cookies, HTTPS, score /10
189
+ AI features detected, confidence score
190
+ Test Info browser, version, engine, query, duration, timestamp, hardware
191
+
192
+ ---
193
+
194
+ ## Energy Calculation Methodology
195
+
196
+ Local energy (measured per test):
197
+
198
+ CPU: usage% x 0.3W x duration
199
+ Memory: GB used x 0.02W x duration (Ghose et al., SIGMETRICS 2018)
200
+ Base system: 15W x duration (ACM PACS 2005)
201
+ Display: 10W x duration
202
+
203
+ Remote energy (research-based per query):
204
+
205
+ Traditional search: 0.3 Wh x PUE (Google Official Blog, 2009)
206
+ AI search: 0.24 Wh x PUE (Google Cloud, 2025)
207
+ PUE: Google 1.12, others 1.30
208
+
209
+ CO2: (total Wh / 1000) x 400g (IEA global average grid intensity)
210
+
211
+ ---
212
+
213
+ ## Where Data Is Stored
214
+
215
+ results/
216
+ +-- database/safe_web.db All test data (SQLite)
217
+ +-- exports/ CSV / JSON / Excel files
218
+ +-- reports/ Generated markdown reports
219
+ +-- logs/ Run logs
220
+
221
+ To reset all data:
222
+
223
+ rm results/database/safe_web.db
224
+
225
+ ---
226
+
227
+ ## System Requirements
228
+
229
+ OS: macOS
230
+ Python: 3.8 or higher
231
+ Browsers: At least one installed (Chrome, Firefox, Safari, Edge, Opera, Brave, or Tor)
232
+
233
+ ---
234
+
235
+ ## Sharing This Tool
236
+
237
+ Option 1 -- Zip (easiest):
238
+
239
+ cd ~/Desktop
240
+ zip -r safeweb-cli.zip safeweb-cli
241
+
242
+ Recipient runs:
243
+
244
+ unzip safeweb-cli.zip
245
+ cd safeweb-cli
246
+ ./safeweb_run.sh list
247
+
248
+ Option 2 -- pip package:
249
+
250
+ cd ~/Desktop/safeweb-cli
251
+ python3 setup.py sdist
252
+ # share: dist/safeweb-1.0.0.tar.gz
253
+
254
+ Recipient runs:
255
+
256
+ pip install safeweb-1.0.0.tar.gz
257
+ cd ~/any-folder
258
+ safeweb list
259
+
260
+ ---
261
+
262
+ ## Troubleshooting
263
+
264
+ Problem Fix
265
+ ------- ---
266
+ No browsers detected Install Chrome or Firefox; check /Applications/
267
+ Permission denied chmod +x safeweb_run.sh
268
+ Tests timing out Use -t 1; check internet connection
269
+ Opera popup Accept the data separation popup when it appears
270
+ Module errors Delete venv/ folder and re-run ./safeweb_run.sh list
271
+
272
+ ---
273
+
274
+ ## Example: Full Workflow
275
+
276
+ # 1. See what browsers are available
277
+ ./safeweb_run.sh list
278
+
279
+ # 2. Quick test with a custom query
280
+ ./safeweb_run.sh run-tests -b chrome firefox -q "renewable energy" -t 3
281
+
282
+ # 3. View comparison
283
+ ./safeweb_run.sh analyze
284
+
285
+ # 4. See AI energy impact
286
+ ./safeweb_run.sh analyze --ai-comparison
287
+
288
+ # 5. Get a recommendation
289
+ ./safeweb_run.sh recommend
290
+
291
+ # 6. Export for Excel/report
292
+ ./safeweb_run.sh export -f excel
293
+ ./safeweb_run.sh report --charts
294
+
295
+ ---
296
+
297
+ ## License
298
+
299
+ Educational and research use -- Capstone Project 2026
@@ -0,0 +1,273 @@
1
+ # SafeWeb CLI
2
+
3
+ Browser Safety and Sustainability Testing Tool
4
+
5
+ Test and compare web browsers on your Mac to determine which is most energy-efficient and safest. Collects 35+ real-time metrics including CPU, memory, energy consumption, privacy, security, and AI impact.
6
+
7
+ ---
8
+
9
+ ## Quick Start
10
+
11
+ ### Option A: Zip (recommended for most users)
12
+
13
+ New users -- just run:
14
+
15
+ cd safeweb-cli
16
+ ./safeweb_run.sh list
17
+
18
+ The script automatically sets up a virtual environment, installs all dependencies, and detects your installed browsers. No manual setup needed.
19
+
20
+ All subsequent commands:
21
+
22
+ ./safeweb_run.sh run-tests -b chrome -t 1
23
+ ./safeweb_run.sh analyze
24
+ ./safeweb_run.sh recommend
25
+ ./safeweb_run.sh export -f csv
26
+
27
+ ### Option B: pip install
28
+
29
+ pip install safeweb-1.0.0.tar.gz
30
+ cd ~/your-project-folder
31
+ safeweb list
32
+
33
+ All commands work the same way -- just replace `./safeweb_run.sh` with `safeweb`. Results are saved in a `results/` folder created in whatever directory you run the commands from. Run all commands from the same folder so they share the same data.
34
+
35
+ safeweb run-tests -b chrome -t 1
36
+ safeweb analyze
37
+ safeweb recommend
38
+ safeweb export -f csv
39
+
40
+ Need help? Run `safeweb --help` or `safeweb <command> --help`
41
+
42
+ ---
43
+
44
+ ## Commands
45
+
46
+ ### list -- Show installed browsers
47
+
48
+ ./safeweb_run.sh list
49
+
50
+ Detects which browsers are installed in /Applications/ on your Mac.
51
+
52
+ ---
53
+
54
+ ### run-tests -- Run browser tests
55
+
56
+ ./safeweb_run.sh run-tests [options]
57
+
58
+ Options:
59
+
60
+ -b Browsers to test: chrome firefox safari edge opera brave tor (default: all installed)
61
+ -e Search engines: google bing duckduckgo yahoo (default: all)
62
+ -t Trials per combination (default: 5)
63
+ -q Custom search query (default: predefined queries)
64
+ --dry-run Preview test plan without running
65
+
66
+ Examples:
67
+
68
+ # Quick test (1 trial = ~1 minute)
69
+ ./safeweb_run.sh run-tests -b chrome -t 1
70
+
71
+ # Two browsers, custom query
72
+ ./safeweb_run.sh run-tests -b chrome firefox -q "climate change" -t 3
73
+
74
+ # Full research study (25 trials)
75
+ ./safeweb_run.sh run-tests -t 25
76
+
77
+ # Preview what would run
78
+ ./safeweb_run.sh run-tests --dry-run
79
+
80
+ How long does it take?
81
+
82
+ 1 trial = ~1 minute
83
+ 5 trials = ~5 minutes (default)
84
+ 25 trials = ~25 minutes (research)
85
+
86
+ Each test runs for 30 seconds to collect quality metrics.
87
+
88
+ ---
89
+
90
+ ### analyze -- View results
91
+
92
+ ./safeweb_run.sh analyze
93
+ ./safeweb_run.sh analyze -b chrome # Single browser
94
+ ./safeweb_run.sh analyze --ai-comparison # AI vs non-AI energy
95
+
96
+ Shows a comparison table with energy (Wh), CPU%, memory (MB), privacy score, and security score per browser. Also shows CO2 estimates and best-per-category winners.
97
+
98
+ ---
99
+
100
+ ### recommend -- Best browser for your machine
101
+
102
+ ./safeweb_run.sh recommend
103
+
104
+ Ranks all tested browser+engine combinations using weighted scoring:
105
+
106
+ Energy 40% -- primary sustainability metric
107
+ Performance 30% -- CPU, memory, duration
108
+ Privacy 20% -- cookies, trackers, HTTPS
109
+ Security 10% -- HTTPS, mixed content, secure cookies
110
+
111
+ Results are specific to your hardware -- scores are not comparable across different machines.
112
+
113
+ ---
114
+
115
+ ### compare -- Head-to-head comparison
116
+
117
+ ./safeweb_run.sh compare chrome:google firefox:duckduckgo
118
+
119
+ Compares two browser:engine configurations with detailed per-metric breakdown and weighted scores.
120
+
121
+ ---
122
+
123
+ ### export -- Export data
124
+
125
+ ./safeweb_run.sh export -f csv # CSV (default)
126
+ ./safeweb_run.sh export -f json
127
+ ./safeweb_run.sh export -f excel
128
+ ./safeweb_run.sh export -f csv -o my_data.csv
129
+
130
+ Exports to results/exports/. Includes all 35+ metrics per test.
131
+
132
+ ---
133
+
134
+ ### report -- Generate markdown report
135
+
136
+ ./safeweb_run.sh report
137
+ ./safeweb_run.sh report --charts # Include PNG charts
138
+ ./safeweb_run.sh report -o my_report.md
139
+
140
+ Saves to results/reports/.
141
+
142
+ ---
143
+
144
+ ### explain -- Understand the scoring methodology
145
+
146
+ ./safeweb_run.sh explain
147
+
148
+ Explains how privacy, security, and sustainability scores are calculated with research citations.
149
+
150
+ ---
151
+
152
+ ## Metrics Collected (35+)
153
+
154
+ Category Metrics
155
+ -------- -------
156
+ CPU mean, max, min (%)
157
+ Memory mean MB, max MB, mean %, max %
158
+ Network bytes sent, bytes received
159
+ Disk read bytes, write bytes
160
+ Energy local Wh (CPU + memory + base + display), remote Wh (server + PUE), total Wh
161
+ Privacy third-party cookies, tracker count, HTTPS, score /10
162
+ Security mixed content, secure cookies, HTTPS, score /10
163
+ AI features detected, confidence score
164
+ Test Info browser, version, engine, query, duration, timestamp, hardware
165
+
166
+ ---
167
+
168
+ ## Energy Calculation Methodology
169
+
170
+ Local energy (measured per test):
171
+
172
+ CPU: usage% x 0.3W x duration
173
+ Memory: GB used x 0.02W x duration (Ghose et al., SIGMETRICS 2018)
174
+ Base system: 15W x duration (ACM PACS 2005)
175
+ Display: 10W x duration
176
+
177
+ Remote energy (research-based per query):
178
+
179
+ Traditional search: 0.3 Wh x PUE (Google Official Blog, 2009)
180
+ AI search: 0.24 Wh x PUE (Google Cloud, 2025)
181
+ PUE: Google 1.12, others 1.30
182
+
183
+ CO2: (total Wh / 1000) x 400g (IEA global average grid intensity)
184
+
185
+ ---
186
+
187
+ ## Where Data Is Stored
188
+
189
+ results/
190
+ +-- database/safe_web.db All test data (SQLite)
191
+ +-- exports/ CSV / JSON / Excel files
192
+ +-- reports/ Generated markdown reports
193
+ +-- logs/ Run logs
194
+
195
+ To reset all data:
196
+
197
+ rm results/database/safe_web.db
198
+
199
+ ---
200
+
201
+ ## System Requirements
202
+
203
+ OS: macOS
204
+ Python: 3.8 or higher
205
+ Browsers: At least one installed (Chrome, Firefox, Safari, Edge, Opera, Brave, or Tor)
206
+
207
+ ---
208
+
209
+ ## Sharing This Tool
210
+
211
+ Option 1 -- Zip (easiest):
212
+
213
+ cd ~/Desktop
214
+ zip -r safeweb-cli.zip safeweb-cli
215
+
216
+ Recipient runs:
217
+
218
+ unzip safeweb-cli.zip
219
+ cd safeweb-cli
220
+ ./safeweb_run.sh list
221
+
222
+ Option 2 -- pip package:
223
+
224
+ cd ~/Desktop/safeweb-cli
225
+ python3 setup.py sdist
226
+ # share: dist/safeweb-1.0.0.tar.gz
227
+
228
+ Recipient runs:
229
+
230
+ pip install safeweb-1.0.0.tar.gz
231
+ cd ~/any-folder
232
+ safeweb list
233
+
234
+ ---
235
+
236
+ ## Troubleshooting
237
+
238
+ Problem Fix
239
+ ------- ---
240
+ No browsers detected Install Chrome or Firefox; check /Applications/
241
+ Permission denied chmod +x safeweb_run.sh
242
+ Tests timing out Use -t 1; check internet connection
243
+ Opera popup Accept the data separation popup when it appears
244
+ Module errors Delete venv/ folder and re-run ./safeweb_run.sh list
245
+
246
+ ---
247
+
248
+ ## Example: Full Workflow
249
+
250
+ # 1. See what browsers are available
251
+ ./safeweb_run.sh list
252
+
253
+ # 2. Quick test with a custom query
254
+ ./safeweb_run.sh run-tests -b chrome firefox -q "renewable energy" -t 3
255
+
256
+ # 3. View comparison
257
+ ./safeweb_run.sh analyze
258
+
259
+ # 4. See AI energy impact
260
+ ./safeweb_run.sh analyze --ai-comparison
261
+
262
+ # 5. Get a recommendation
263
+ ./safeweb_run.sh recommend
264
+
265
+ # 6. Export for Excel/report
266
+ ./safeweb_run.sh export -f excel
267
+ ./safeweb_run.sh report --charts
268
+
269
+ ---
270
+
271
+ ## License
272
+
273
+ Educational and research use -- Capstone Project 2026