{"id":49549229,"url":"https://github.com/adityajhakumar/-tarangwifi","last_synced_at":"2026-05-02T21:05:35.428Z","repository":{"id":283993299,"uuid":"953501414","full_name":"adityajhakumar/-TarangWifi","owner":"adityajhakumar","description":"TarangWifi is a real-time Wi-Fi signal tracker and optimizer built with Streamlit. Move around your environment and find the best Wi-Fi spots by tracking signal strength, latency, and speed metrics in an intuitive interface. You can visualize your data, generate reports, and make informed decisions to optimize your connectivity.","archived":false,"fork":false,"pushed_at":"2025-03-23T14:25:12.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-23T15:26:21.130Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/adityajhakumar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-23T14:16:31.000Z","updated_at":"2025-03-23T14:25:15.000Z","dependencies_parsed_at":"2025-03-23T15:26:29.697Z","dependency_job_id":"76251516-7868-4005-aff7-aa7ef507711a","html_url":"https://github.com/adityajhakumar/-TarangWifi","commit_stats":null,"previous_names":["adityajhakumar/-tarangwifi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/adityajhakumar/-TarangWifi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2F-TarangWifi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2F-TarangWifi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2F-TarangWifi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2F-TarangWifi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/adityajhakumar","download_url":"https://codeload.github.com/adityajhakumar/-TarangWifi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/adityajhakumar%2F-TarangWifi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32549417,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T19:18:06.202Z","status":"ssl_error","status_checked_at":"2026-05-02T19:16:21.335Z","response_time":132,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-02T21:05:34.397Z","updated_at":"2026-05-02T21:05:35.418Z","avatar_url":"https://github.com/adityajhakumar.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# 📡 TarangWifi\n\n**TarangWifi** is a real-time Wi-Fi signal tracker and optimizer built with **Streamlit**. Move around your environment and find the best Wi-Fi spots by tracking **signal strength**, **latency**, and **internet speed** metrics—all displayed with intuitive charts and reports.\n\n---\n\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)\n[![Streamlit App](https://img.shields.io/badge/Streamlit-Ready-orange)](https://github.com/adityajhakumar/-TarangWifi)\n\n---\n\n## 🌐 Live Demo  \n🚀 [GitHub Repository](https://github.com/adityajhakumar/-TarangWifi)\n\n---\n\n## 🚀 Features\n\n✅ **Real-Time Wi-Fi Signal Tracking**  \n✅ **Latency \u0026 Speed Tests (Optional)**  \n✅ **Location Tagging for Spot Analysis**  \n✅ **Interactive Graphs (Signal, Latency, Speed)**  \n✅ **Summary Report of Best/Worst Spots**  \n✅ **Export Report as CSV**  \n✅ **Windows and Linux Compatible**  \n\n---\n\n## 🎥 Demo  \n![image](https://github.com/user-attachments/assets/fa4c90c5-ad35-4644-b183-092b0846f335)\n![image](https://github.com/user-attachments/assets/7e98977a-632b-4616-82d7-86b1c22200ef)\n\n![image](https://github.com/user-attachments/assets/7c2a444f-45ab-437a-98b7-66a4fae36b11)\n![image](https://github.com/user-attachments/assets/fdaefa02-5c81-47d9-802c-2b03690e2363)\n![image](https://github.com/user-attachments/assets/e0ef4c10-f17f-445d-90e7-be0446476b72)\n![image](https://github.com/user-attachments/assets/48d332ed-2311-4a5e-b835-0e1f15e35ce9)\n![image](https://github.com/user-attachments/assets/f6ec1824-b35f-49d3-ab3f-a8063b2c91bb)\n\n---\n\n\n# 📄 **TarangWifi Code Explanation**\n\n---\n\n## 1️⃣ **Importing Libraries**\n\n```python\nimport streamlit as st\nimport pandas as pd\nimport plotly.graph_objs as go\nimport subprocess\nimport platform\nimport speedtest\nfrom datetime import datetime\nimport time\nimport re\n```\n\n- **streamlit**: For building interactive web apps.\n- **pandas**: Data manipulation and storage of tracking data.\n- **plotly.graph_objs**: For creating interactive, real-time charts.\n- **subprocess**: To run system-level commands (fetching Wi-Fi info, ping).\n- **platform**: Detecting OS (Windows/Linux) to run the right commands.\n- **speedtest**: To check download and upload internet speeds.\n- **datetime, time**: Handling timestamps and delays.\n- **re (Regular Expressions)**: Parsing command-line output for Wi-Fi details.\n\n---\n\n## 2️⃣ **Helper Functions**\n\n---\n\n### 🔹 `get_wifi_info()`\nFetches **SSID**, **BSSID**, **Signal Strength**, **Frequency**, and **Channel** info.\n\n#### How it works:\n- Detects OS (`Linux` or `Windows`).\n- Runs OS-specific commands:\n  - **Linux**: Uses `iwconfig`\n  - **Windows**: Uses `netsh wlan show interfaces`\n- Uses **regular expressions** to extract relevant details from the command output.\n\n```python\ndef get_wifi_info():\n    system_platform = platform.system()\n\n    wifi_info = {\n        'SSID': 'Unknown',\n        'BSSID': 'Unknown',\n        'Signal': None,\n        'Frequency': 'Unknown',\n        'Channel': 'Unknown'\n    }\n\n    try:\n        if system_platform == 'Linux':\n            # Run 'iwconfig' to get Wi-Fi info\n            result = subprocess.check_output([\"iwconfig\"], universal_newlines=True)\n            \n            # Extract relevant info using regex\n            ssid_match = re.search(r'ESSID:\"(.+?)\"', result)\n            freq_match = re.search(r'Frequency:(\\d+\\.\\d+)', result)\n            signal_match = re.search(r'Signal level=(-?\\d+) dBm', result)\n\n            if ssid_match:\n                wifi_info['SSID'] = ssid_match.group(1)\n            if freq_match:\n                wifi_info['Frequency'] = f\"{freq_match.group(1)} GHz\"\n            if signal_match:\n                wifi_info['Signal'] = int(signal_match.group(1))\n\n        elif system_platform == 'Windows':\n            # Run 'netsh' to get Wi-Fi info\n            result = subprocess.check_output([\"netsh\", \"wlan\", \"show\", \"interfaces\"], universal_newlines=True)\n\n            # Extract data via regex\n            ssid_match = re.search(r'SSID\\s+:\\s(.*)', result)\n            bssid_match = re.search(r'BSSID\\s+:\\s(.*)', result)\n            signal_match = re.search(r'Signal\\s+:\\s(\\d+)%', result)\n            freq_match = re.search(r'Radio type\\s+:\\s(.*)', result)\n\n            if ssid_match:\n                wifi_info['SSID'] = ssid_match.group(1).strip()\n            if bssid_match:\n                wifi_info['BSSID'] = bssid_match.group(1).strip()\n            if signal_match:\n                wifi_info['Signal'] = int(signal_match.group(1).strip())\n            if freq_match:\n                wifi_info['Frequency'] = freq_match.group(1).strip()\n\n    except Exception as e:\n        st.error(f\"Error fetching Wi-Fi info: {e}\")\n\n    return wifi_info\n```\n\n---\n\n### 🔹 `get_latency(host=\"8.8.8.8\")`\nChecks the **ping latency** to Google's DNS (8.8.8.8).\n\n- Windows: `ping -n 1`\n- Linux: `ping -c 1`\n- Extracts **latency** from ping output using string parsing.\n\n```python\ndef get_latency(host=\"8.8.8.8\"):\n    try:\n        param = '-n' if platform.system().lower() == 'windows' else '-c'\n        command = ['ping', param, '1', host]\n        \n        result = subprocess.run(command, stdout=subprocess.PIPE, universal_newlines=True)\n        output = result.stdout\n\n        if platform.system().lower() == 'windows':\n            latency_line = [line for line in output.splitlines() if \"Average\" in line]\n            latency = latency_line[0].split('=')[-1].replace('ms', '').strip()\n        else:\n            latency_line = [line for line in output.splitlines() if \"time=\" in line]\n            latency = latency_line[0].split('time=')[1].split(' ')[0]\n\n        return float(latency)\n\n    except Exception as e:\n        st.warning(f\"Latency check failed: {e}\")\n        return None\n```\n\n---\n\n### 🔹 `run_speedtest()`\nUses `speedtest.Speedtest()` to measure **download** and **upload** speeds.\n\n```python\ndef run_speedtest():\n    try:\n        stest = speedtest.Speedtest()\n        download_speed = round(stest.download() / 1_000_000, 2)  # Convert to Mbps\n        upload_speed = round(stest.upload() / 1_000_000, 2)\n        return download_speed, upload_speed\n\n    except Exception as e:\n        st.warning(f\"Speedtest failed: {e}\")\n        return None, None\n```\n\n---\n\n## 3️⃣ **Streamlit App Layout**\n\n### 🔹 App Setup\n\n```python\nst.set_page_config(page_title=\"Wi-Fi Signal Tracker \u0026 Optimizer\", layout=\"wide\")\nst.title(\"📡 TarangWifi\")\nst.caption(\"Move around and find the best Wi-Fi spots in real time!\")\n```\n\n---\n\n## 4️⃣ **Session State Initialization**\n\nSession state ensures data persists across Streamlit reruns.\n\n```python\nif 'tracking' not in st.session_state:\n    st.session_state.tracking = False\n\nif 'data' not in st.session_state:\n    st.session_state.data = pd.DataFrame(columns=['Time', 'Location', 'SSID', 'BSSID', 'Signal', 'Latency', 'Download', 'Upload'])\n```\n\n---\n\n## 5️⃣ **Sidebar Controls**\n\n```python\nwith st.sidebar:\n    st.header(\"Controls\")\n    \n    location = st.text_input(\"🏷️ Enter Current Location\", \"Unknown\")\n\n    if st.button(\"🚀 Start Real-Time Tracking\"):\n        st.session_state.tracking = True\n        st.session_state.last_update = 0\n\n    if st.button(\"🛑 Stop Tracking\"):\n        st.session_state.tracking = False\n\n    if st.button(\"⚡ Run Speedtest\"):\n        d_speed, u_speed = run_speedtest()\n        if d_speed and u_speed:\n            st.success(f\"Download: {d_speed} Mbps | Upload: {u_speed} Mbps\")\n\n    if st.button(\"⏱️ Check Latency\"):\n        ping_latency = get_latency()\n        if ping_latency:\n            st.success(f\"Latency: {ping_latency} ms\")\n```\n\n---\n\n## 6️⃣ **Tracking Functionality**\n\nRuns every 3 seconds if tracking is active.\n\n```python\nif st.session_state.tracking:\n    now = time.time()\n\n    wifi_info = get_wifi_info()\n    latency = get_latency()\n\n    download, upload = None, None  # Optional speedtest during tracking\n\n    current_time = datetime.now().strftime(\"%H:%M:%S\")\n    new_row = {\n        'Time': current_time,\n        'Location': location,\n        'SSID': wifi_info['SSID'],\n        'BSSID': wifi_info['BSSID'],\n        'Signal': wifi_info['Signal'],\n        'Latency': latency,\n        'Download': download,\n        'Upload': upload\n    }\n\n    # Append data to DataFrame\n    st.session_state.data = pd.concat(\n        [st.session_state.data, pd.DataFrame([new_row])],\n        ignore_index=True\n    )\n\n    st.toast(f\"Updated {current_time}\")\n\n    # Metrics display\n    wifi_col1, wifi_col2, wifi_col3 = st.columns(3)\n    wifi_col1.metric(\"SSID\", wifi_info.get('SSID', 'Unknown'))\n    wifi_col2.metric(\"BSSID\", wifi_info.get('BSSID', 'Unknown'))\n    wifi_col3.metric(\"Frequency\", wifi_info.get('Frequency', 'Unknown'))\n\n    col1, col2, col3 = st.columns(3)\n    col1.metric(\"📶 Signal Strength\", f\"{wifi_info.get('Signal', 'N/A')} dBm\")\n    col2.metric(\"⏱️ Latency\", f\"{latency} ms\" if latency else \"N/A\")\n    col3.metric(\"⚡ Download/Upload\", f\"{download} / {upload} Mbps\" if download else \"Not Tested\")\n\n    time.sleep(3)\n    st.rerun()\n```\n\n---\n\n## 7️⃣ **Graphs \u0026 Visualization**\n\nPlotting graphs with **Plotly**:\n- Signal strength over time\n- Latency over time\n- Download/Upload speeds over time\n\n```python\ndf = st.session_state.data\n\nif not df.empty:\n    st.subheader(\"📊 Real-Time Tracking Data\")\n\n    # Signal strength\n    fig_signal = go.Figure()\n    fig_signal.add_trace(go.Scatter(x=df['Time'], y=df['Signal'], mode='lines+markers'))\n    st.plotly_chart(fig_signal, use_container_width=True)\n\n    # Latency\n    fig_latency = go.Figure()\n    fig_latency.add_trace(go.Scatter(x=df['Time'], y=df['Latency'], mode='lines+markers'))\n    st.plotly_chart(fig_latency, use_container_width=True)\n\n    # Download/Upload speeds\n    fig_speed = go.Figure()\n    fig_speed.add_trace(go.Scatter(x=df['Time'], y=df['Download'], mode='lines+markers'))\n    fig_speed.add_trace(go.Scatter(x=df['Time'], y=df['Upload'], mode='lines+markers'))\n    st.plotly_chart(fig_speed, use_container_width=True)\n```\n\n---\n\n## 8️⃣ **Summary Report**\n\nIf tracking is stopped:\n- Shows **best and worst spots**\n- Averages for signal, latency, speed\n- Allows downloading a CSV report\n\n```python\nif not st.session_state.tracking:\n    st.subheader(\"📋 Summary Report\")\n\n    best_row = df.loc[df['Signal'].idxmax()]\n    worst_row = df.loc[df['Signal'].idxmin()]\n\n    st.markdown(f\"**Best Spot** ➡️ `{best_row['Location']}` with **Signal** `{best_row['Signal']} dBm`\")\n    st.markdown(f\"**Worst Spot** ➡️ `{worst_row['Location']}` with **Signal** `{worst_row['Signal']} dBm`\")\n\n    st.write(f\"📶 **Average Signal**: {df['Signal'].mean():.2f} dBm\")\n    st.write(f\"⏱️ **Average Latency**: {df['Latency'].mean():.2f} ms\")\n    st.write(f\"⚡ **Average Download**: {df['Download'].mean():.2f} Mbps\")\n    st.write(f\"⚡ **Average Upload**: {df['Upload'].mean():.2f} Mbps\")\n\n    # Download CSV\n    csv = df.to_csv(index=False).encode('utf-8')\n    st.download_button(\"📥 Download Report as CSV\", data=csv, file_name='wifi_report.csv', mime='text/csv')\n```\n\n---\n\n## 9️⃣ **Footer**\n\n```python\nst.markdown(\"---\")\nst.markdown(\n    \"\u003cdiv style='text-align: center; color: gray;'\u003e\"\n    \"Made with ❤️ by \u003cstrong\u003eAditya Kumar Jha\u003c/strong\u003e\"\n    \"\u003c/div\u003e\",\n    unsafe_allow_html=True\n)\n```\n\n---\n\n# ✅ **High-Level Workflow**\n\n1. App starts ➡️ User enters location ➡️ Starts tracking\n2. App collects Wi-Fi signal, latency, (optional) speed every 3 seconds\n3. Displays real-time metrics + graphs\n4. User stops tracking ➡️ Generates summary + CSV download\n\n---\n\n\n## 🛠️ Installation\n\n### 1. Clone the Repository\n```bash\ngit clone https://github.com/adityajhakumar/-TarangWifi.git\ncd -TarangWifi\n```\n\n### 2. Create a Virtual Environment (Optional but Recommended)\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\n```\n\n### 3. Install Dependencies\n```bash\npip install -r requirements.txt\n```\n\nIf you don't have a `requirements.txt`, you can install dependencies directly:\n```bash\npip install streamlit pandas plotly speedtest-cli\n```\n\n---\n\n## ▶️ Run the App\n```bash\nstreamlit run tarangwifi.py\n```\n\nThen open the app in your browser:  \n`http://localhost:8501`\n\n---\n\n## 📂 Project Structure\n```\n-TarangWifi/\n├── tarangwifi.py        # Main Streamlit app\n├── README.md            # Project documentation\n├── LICENSE              # Apache 2.0 License\n└── requirements.txt     # Python dependencies\n```\n\n---\n\n## ⚙️ How It Works\n\n1. **Start Tracking:**  \n   - Enter your **current location**.  \n   - Click `🚀 Start Real-Time Tracking` to begin collecting data.\n\n2. **Move Around:**  \n   - TarangWifi fetches your **Wi-Fi SSID**, **BSSID**, **Signal Strength**, and **Frequency** every 3 seconds.  \n   - It also runs **ping latency checks**.\n\n3. **Speedtest (Optional):**  \n   - Run a speed test manually to measure **download** and **upload speeds**.\n\n4. **Stop Tracking:**  \n   - Click `🛑 Stop Tracking`.  \n   - Review the **best** and **worst** spots based on signal strength.  \n   - Analyze graphs and averages.\n\n5. **Export:**  \n   - Download a **CSV report** of your tracked data.\n\n---\n\n## 📊 Metrics Collected\n| Metric            | Description                                 |\n|-------------------|---------------------------------------------|\n| SSID              | Network Name                                |\n| BSSID             | Network Identifier (MAC Address)            |\n| Signal Strength   | Wi-Fi signal strength in dBm                |\n| Frequency         | Wi-Fi frequency (GHz)                       |\n| Latency           | Ping time to a test server (ms)             |\n| Download Speed    | Internet download speed (Mbps)              |\n| Upload Speed      | Internet upload speed (Mbps)                |\n| Location          | Custom location label entered by the user   |\n\n---\n\n## ✅ Supported Platforms\n- **Windows** (via `netsh wlan show interfaces`)  \n- **Linux** (via `iwconfig`)  \n\n⚠️ MacOS support isn't implemented yet.\n\n---\n\n## 📝 License\n\nThis project is licensed under the **Apache License 2.0**.  \nSee the full license [here](https://github.com/adityajhakumar/-TarangWifi/blob/main/LICENSE).\n\n```\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n   http://www.apache.org/licenses/LICENSE-2.0\n```\n\n---\n\n## 🙌 Acknowledgements\n- Inspired by the need for **better Wi-Fi optimization tools** in real-world spaces.\n- Thanks to open-source libraries: **Streamlit**, **Pandas**, **Plotly**, and **Speedtest-cli**.\n\n---\n\n## 👨‍💻 Author\n**Aditya Kumar Jha**  \n[GitHub](https://github.com/adityajhakumar) \n\n---\n\n## 🌟 Contributions  \nContributions, issues, and feature requests are welcome!  \nFeel free to **fork** this repo and **submit a pull request**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadityajhakumar%2F-tarangwifi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fadityajhakumar%2F-tarangwifi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fadityajhakumar%2F-tarangwifi/lists"}