This VSCode extension named "Hackatime" provides an interactive dashboard to visualize coding statistics using data from the Hackatime API, which is compatible with Wakatime data. It fetches user coding activity summaries and displays them in various charts within a WebView panel.
Key Functionalities and API Calls
- Reading Local Configuration: Reads the
.wakatime.cfg file from the user's home directory to extract an API key.
const wakatimeFilePath = path.join(homeDir, '.wakatime.cfg');
const fileContent = fs.readFileSync(wakatimeFilePath, 'utf-8');
const apiKeyMatch = fileContent.match(/api_key\s*=\s*(.+)/);
- Network Communication: Makes an authenticated GET request to
https://waka.hackclub.com/api/compat/wakatime/v1/users/current/summaries with query parameters to fetch coding summaries.
axios.get(`https://waka.hackclub.com/api/compat/wakatime/v1/users/current/summaries?${params.toString()}`, {
headers: { Accept: 'application/json', Authorization: authorizationHeader }
});
- WebView UI: Creates a WebView panel with embedded HTML/JavaScript that uses Chart.js to render doughnut and pie charts for languages, categories, editors, and projects.
- Data Aggregation: Aggregates multiple days of data into a single summary for display.
Filesystem Activity
- Reads the
.wakatime.cfg file from the user's home directory.
Network Activity
- Sends HTTPS GET requests to
https://waka.hackclub.com to retrieve user coding statistics.
Process Execution
- No evidence of spawning new processes or executing shell/PowerShell commands.
Obfuscation
- The code is not obfuscated; it is straightforward and readable.
Persistence
- No mechanisms for persistence or autostart detected.
Privilege Escalation
- No requests or usage of elevated privileges.
Data Exfiltration
- Data is sent only as authenticated requests to a known API endpoint to fetch user coding stats; no suspicious data exfiltration observed.
Registry and User Operations
- No Windows Registry read/write or user account creation.
Clipboard Access
- No clipboard access or monitoring.
Summary
The extension reads a local config file to obtain an API key, fetches coding activity data from a remote API, and displays it in a user-friendly dashboard within VSCode. It does not perform any suspicious or malicious operations.