|
| 1 | +// Name: extendedFourndyUserData.js Ver: 0.1.0 |
| 2 | +// Made by 4ndy64 |
| 3 | + |
| 4 | +const extendedFourndyUserData = (function() { |
| 5 | + let battery = null; |
| 6 | + |
| 7 | + const isBatteryApiAvailable = () => 'getBattery' in navigator; |
| 8 | + |
| 9 | + const getBatteryStatus = async () => { |
| 10 | + if (isBatteryApiAvailable()) { |
| 11 | + try { |
| 12 | + battery = await navigator.getBattery(); |
| 13 | + return { |
| 14 | + level: battery.level * 100, |
| 15 | + charging: battery.charging, |
| 16 | + chargingTime: battery.chargingTime, |
| 17 | + dischargingTime: battery.dischargingTime, |
| 18 | + isBatteryApiAvailable: true |
| 19 | + }; |
| 20 | + } catch (error) { |
| 21 | + return { error: "Error fetching battery data" }; |
| 22 | + } |
| 23 | + } else { |
| 24 | + return { error: "Battery API is not supported" }; |
| 25 | + } |
| 26 | + }; |
| 27 | + |
| 28 | + const getOSInfo = () => { |
| 29 | + const userAgent = navigator.userAgent; |
| 30 | + let os = "Unknown OS"; |
| 31 | + let browser = "Unknown Browser"; |
| 32 | + |
| 33 | + if (userAgent.indexOf("Win") !== -1) os = "Windows"; |
| 34 | + else if (userAgent.indexOf("Mac") !== -1) os = "macOS"; |
| 35 | + else if (userAgent.indexOf("Linux") !== -1) os = "Linux"; |
| 36 | + else if (userAgent.indexOf("Android") !== -1) os = "Android"; |
| 37 | + else if (userAgent.indexOf("like Mac") !== -1) os = "iOS"; |
| 38 | + |
| 39 | + if (userAgent.indexOf("Chrome") !== -1) browser = "Chrome"; |
| 40 | + else if (userAgent.indexOf("Firefox") !== -1) browser = "Firefox"; |
| 41 | + else if (userAgent.indexOf("Safari") !== -1) browser = "Safari"; |
| 42 | + else if (userAgent.indexOf("Edge") !== -1) browser = "Edge"; |
| 43 | + else if (userAgent.indexOf("Opera") !== -1) browser = "Opera"; |
| 44 | + |
| 45 | + return { |
| 46 | + os: os, |
| 47 | + browser: browser, |
| 48 | + userAgent: userAgent |
| 49 | + }; |
| 50 | + }; |
| 51 | + |
| 52 | + const isMobileDevice = () => /Mobi|Android|iPhone|iPad|iPod/i.test(navigator.userAgent); |
| 53 | + |
| 54 | + const getViewportSize = () => ({ |
| 55 | + width: window.innerWidth, |
| 56 | + height: window.innerHeight |
| 57 | + }); |
| 58 | + |
| 59 | + const getMemoryInfo = () => { |
| 60 | + if ('deviceMemory' in navigator) { |
| 61 | + return { |
| 62 | + totalMemory: navigator.deviceMemory + "GB", |
| 63 | + isMemoryApiAvailable: true |
| 64 | + }; |
| 65 | + } else { |
| 66 | + return { |
| 67 | + error: "Device memory info not available", |
| 68 | + isMemoryApiAvailable: false |
| 69 | + }; |
| 70 | + } |
| 71 | + }; |
| 72 | + |
| 73 | + const search = (query, engine = 'google') => { |
| 74 | + let searchURL = ''; |
| 75 | + switch(engine.toLowerCase()) { |
| 76 | + case 'google': searchURL = `https://www.google.com/search?q=${encodeURIComponent(query)}`; break; |
| 77 | + case 'bing': searchURL = `https://www.bing.com/search?q=${encodeURIComponent(query)}`; break; |
| 78 | + case 'duckduckgo': searchURL = `https://duckduckgo.com/?q=${encodeURIComponent(query)}`; break; |
| 79 | + case 'yahoo': searchURL = `https://search.yahoo.com/search?p=${encodeURIComponent(query)}`; break; |
| 80 | + case 'ask': searchURL = `https://www.ask.com/web?q=${encodeURIComponent(query)}`; break; |
| 81 | + case 'yandex': searchURL = `https://yandex.com/search/?text=${encodeURIComponent(query)}`; break; |
| 82 | + case 'baidu': searchURL = `https://www.baidu.com/s?wd=${encodeURIComponent(query)}`; break; |
| 83 | + case 'qwant': searchURL = `https://www.qwant.com/?q=${encodeURIComponent(query)}`; break; |
| 84 | + case 'startpage': searchURL = `https://www.startpage.com/sp/search?q=${encodeURIComponent(query)}`; break; |
| 85 | + default: searchURL = `https://www.google.com/search?q=${encodeURIComponent(query)}`; break; |
| 86 | + } |
| 87 | + window.open(searchURL, '_blank'); |
| 88 | + }; |
| 89 | + |
| 90 | + const getUserTimezone = () => { |
| 91 | + return { |
| 92 | + timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, |
| 93 | + offset: new Date().getTimezoneOffset() |
| 94 | + }; |
| 95 | + }; |
| 96 | + |
| 97 | + const getConnectionInfo = () => { |
| 98 | + if ('connection' in navigator) { |
| 99 | + return { |
| 100 | + effectiveType: navigator.connection.effectiveType, |
| 101 | + downlink: navigator.connection.downlink, |
| 102 | + rtt: navigator.connection.rtt, |
| 103 | + saveData: navigator.connection.saveData |
| 104 | + }; |
| 105 | + } else { |
| 106 | + return { error: "Network Information API is not supported" }; |
| 107 | + } |
| 108 | + }; |
| 109 | + |
| 110 | + const getSystemMemoryUsage = () => { |
| 111 | + if (performance.memory) { |
| 112 | + return { |
| 113 | + totalJSHeap: (performance.memory.totalJSHeapSize / 1024 / 1024).toFixed(2) + "MB", |
| 114 | + usedJSHeap: (performance.memory.usedJSHeapSize / 1024 / 1024).toFixed(2) + "MB", |
| 115 | + jsHeapLimit: (performance.memory.jsHeapLimit / 1024 / 1024).toFixed(2) + "MB" |
| 116 | + }; |
| 117 | + } else { |
| 118 | + return { error: "Memory usage info not available" }; |
| 119 | + } |
| 120 | + }; |
| 121 | + |
| 122 | + const isDarkMode = () => window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches; |
| 123 | + |
| 124 | + const getGeoLocation = () => { |
| 125 | + return new Promise((resolve, reject) => { |
| 126 | + if (navigator.geolocation) { |
| 127 | + navigator.geolocation.getCurrentPosition(resolve, reject); |
| 128 | + } else { |
| 129 | + reject("Geolocation is not supported by this browser."); |
| 130 | + } |
| 131 | + }); |
| 132 | + }; |
| 133 | + |
| 134 | + const isIncognitoMode = () => { |
| 135 | + return new Promise((resolve, reject) => { |
| 136 | + const fs = window.RequestFileSystem || window.webkitRequestFileSystem; |
| 137 | + if (!fs) { |
| 138 | + resolve(false); |
| 139 | + return; |
| 140 | + } |
| 141 | + fs(window.TEMPORARY, 100, () => resolve(false), () => resolve(true)); |
| 142 | + }); |
| 143 | + }; |
| 144 | + |
| 145 | + const getAllTabs = () => { |
| 146 | + return new Promise((resolve, reject) => { |
| 147 | + if (typeof chrome !== "undefined" && chrome.tabs) { |
| 148 | + chrome.tabs.query({}, (tabs) => { |
| 149 | + resolve(tabs); |
| 150 | + }); |
| 151 | + } else { |
| 152 | + reject("Tabs API is not available in this browser."); |
| 153 | + } |
| 154 | + }); |
| 155 | + }; |
| 156 | + |
| 157 | + const getHardwareConcurrency = () => { |
| 158 | + if ('hardwareConcurrency' in navigator) { |
| 159 | + return navigator.hardwareConcurrency; |
| 160 | + } else { |
| 161 | + return { error: "Hardware concurrency information not available" }; |
| 162 | + } |
| 163 | + }; |
| 164 | + |
| 165 | + const getLanguageInfo = () => { |
| 166 | + return { |
| 167 | + language: navigator.language || "unknown", |
| 168 | + languages: navigator.languages || [] |
| 169 | + }; |
| 170 | + }; |
| 171 | + |
| 172 | + const getScreenInfo = () => { |
| 173 | + if (window.screen) { |
| 174 | + return { |
| 175 | + width: screen.width, |
| 176 | + height: screen.height, |
| 177 | + availableWidth: screen.availWidth, |
| 178 | + availableHeight: screen.availHeight, |
| 179 | + colorDepth: screen.colorDepth, |
| 180 | + pixelDepth: screen.pixelDepth |
| 181 | + }; |
| 182 | + } else { |
| 183 | + return { error: "Screen information not available" }; |
| 184 | + } |
| 185 | + }; |
| 186 | + |
| 187 | + const getCookiesEnabled = () => { |
| 188 | + return navigator.cookieEnabled; |
| 189 | + }; |
| 190 | + |
| 191 | + const getOnlineStatus = () => { |
| 192 | + return navigator.onLine; |
| 193 | + }; |
| 194 | + |
| 195 | + const getPlugins = () => { |
| 196 | + if (navigator.plugins) { |
| 197 | + const plugins = []; |
| 198 | + for (let i = 0; i < navigator.plugins.length; i++) { |
| 199 | + plugins.push(navigator.plugins[i].name); |
| 200 | + } |
| 201 | + return plugins; |
| 202 | + } else { |
| 203 | + return { error: "Plugins information not available" }; |
| 204 | + } |
| 205 | + }; |
| 206 | + |
| 207 | + const getLocalStorageUsage = () => { |
| 208 | + if (window.localStorage) { |
| 209 | + let total = 0; |
| 210 | + for (let key in localStorage) { |
| 211 | + if (localStorage.hasOwnProperty(key)) { |
| 212 | + const item = localStorage.getItem(key); |
| 213 | + if (item) { |
| 214 | + total += item.length; |
| 215 | + } |
| 216 | + } |
| 217 | + } |
| 218 | + |
| 219 | + return (total / 1024).toFixed(2) + "KB"; |
| 220 | + } else { |
| 221 | + return { error: "localStorage is not supported" }; |
| 222 | + } |
| 223 | + }; |
| 224 | + |
| 225 | + const getAllData = async () => { |
| 226 | + const batteryStatus = await getBatteryStatus(); |
| 227 | + const osInfo = getOSInfo(); |
| 228 | + const memoryInfo = getMemoryInfo(); |
| 229 | + const viewportSize = getViewportSize(); |
| 230 | + const systemMemoryUsage = getSystemMemoryUsage(); |
| 231 | + const connectionInfo = getConnectionInfo(); |
| 232 | + const timezone = getUserTimezone(); |
| 233 | + const darkMode = isDarkMode(); |
| 234 | + const geoLocation = await getGeoLocation().catch(() => null); |
| 235 | + const incognito = await isIncognitoMode(); |
| 236 | + const tabs = await getAllTabs().catch(() => []); |
| 237 | + |
| 238 | + return { |
| 239 | + OS: osInfo.os, |
| 240 | + Browser: osInfo.browser, |
| 241 | + UserAgent: osInfo.userAgent, |
| 242 | + Battery: batteryStatus, |
| 243 | + Memory: memoryInfo, |
| 244 | + Viewport: viewportSize, |
| 245 | + SystemMemory: systemMemoryUsage, |
| 246 | + Connection: connectionInfo, |
| 247 | + Timezone: timezone, |
| 248 | + DarkMode: darkMode, |
| 249 | + Location: geoLocation, |
| 250 | + Incognito: incognito, |
| 251 | + IsMobile: isMobileDevice(), |
| 252 | + TabsOpen: tabs, |
| 253 | + HardwareConcurrency: getHardwareConcurrency(), |
| 254 | + Language: getLanguageInfo(), |
| 255 | + Screen: getScreenInfo(), |
| 256 | + CookiesEnabled: getCookiesEnabled(), |
| 257 | + Online: getOnlineStatus(), |
| 258 | + Plugins: getPlugins(), |
| 259 | + LocalStorageUsage: getLocalStorageUsage() |
| 260 | + }; |
| 261 | + }; |
| 262 | + |
| 263 | + return { |
| 264 | + getBatteryStatus, |
| 265 | + getOSInfo, |
| 266 | + isMobileDevice, |
| 267 | + getViewportSize, |
| 268 | + getMemoryInfo, |
| 269 | + search, |
| 270 | + getUserTimezone, |
| 271 | + getConnectionInfo, |
| 272 | + getSystemMemoryUsage, |
| 273 | + isDarkMode, |
| 274 | + getGeoLocation, |
| 275 | + isIncognitoMode, |
| 276 | + getAllTabs, |
| 277 | + getHardwareConcurrency, |
| 278 | + getLanguageInfo, |
| 279 | + getScreenInfo, |
| 280 | + getCookiesEnabled, |
| 281 | + getOnlineStatus, |
| 282 | + getPlugins, |
| 283 | + getLocalStorageUsage, |
| 284 | + getAllData |
| 285 | + }; |
| 286 | +})(); |
0 commit comments