packetsnitch 1.5.599

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.
Files changed (54) hide show
  1. package/.eslintrc.json +28 -0
  2. package/.webpack/x64/main/index.js +2 -0
  3. package/.webpack/x64/main/index.js.map +1 -0
  4. package/.webpack/x64/renderer/assets/css/rubikglitch.woff2 +0 -0
  5. package/.webpack/x64/renderer/assets/css/style.css +1916 -0
  6. package/.webpack/x64/renderer/assets/images/loading.gif +0 -0
  7. package/.webpack/x64/renderer/assets/images/logo.webp +0 -0
  8. package/.webpack/x64/renderer/assets/images/packet-snitch-tag.webp +0 -0
  9. package/.webpack/x64/renderer/main_window/index.html +3 -0
  10. package/.webpack/x64/renderer/main_window/index.js +3 -0
  11. package/.webpack/x64/renderer/main_window/index.js.LICENSE.txt +36 -0
  12. package/.webpack/x64/renderer/main_window/index.js.map +1 -0
  13. package/.webpack/x64/renderer/main_window/preload.js +2 -0
  14. package/.webpack/x64/renderer/main_window/preload.js.map +1 -0
  15. package/backend/common/GeoLite2-City.mmdb +0 -0
  16. package/backend/common/mac-vendors-export.csv +56923 -0
  17. package/backend/common/service-names-port-numbers.csv +15368 -0
  18. package/backend/requirements.txt +14 -0
  19. package/backend/snitch.py +3611 -0
  20. package/forge.config.js +80 -0
  21. package/package.json +102 -0
  22. package/ps-icon.ico +0 -0
  23. package/snitch.spec +44 -0
  24. package/src/assets/css/rubikglitch.woff2 +0 -0
  25. package/src/assets/css/style.css +1916 -0
  26. package/src/assets/images/loading.gif +0 -0
  27. package/src/assets/images/logo.webp +0 -0
  28. package/src/assets/images/packet-snitch-tag.webp +0 -0
  29. package/src/back-comm.js +70 -0
  30. package/src/decoders.js +579 -0
  31. package/src/filter.js +461 -0
  32. package/src/front.js +10 -0
  33. package/src/index.html +1036 -0
  34. package/src/logging.js +150 -0
  35. package/src/main.js +571 -0
  36. package/src/preload.js +73 -0
  37. package/src/renderer.js +30 -0
  38. package/src/ui/common-frontend.js +13 -0
  39. package/src/ui/context-menu.js +88 -0
  40. package/src/ui/decoders.js +1 -0
  41. package/src/ui/main-frontend.js +4957 -0
  42. package/src/ui/panels/crypt-panel.js +565 -0
  43. package/src/ui/panels/data-panel.js +151 -0
  44. package/src/ui/panels/data-tools-panel.js +939 -0
  45. package/src/ui/panels/install-screen.js +59 -0
  46. package/src/ui/panels/keystore-panel.js +1248 -0
  47. package/src/ui/panels/list-panel.js +403 -0
  48. package/src/ui/panels/stats-panel.js +351 -0
  49. package/src/ui/panels/summary-panel.js +63 -0
  50. package/webpack.main.config.js +11 -0
  51. package/webpack.plugins.js +13 -0
  52. package/webpack.preload.config.js +7 -0
  53. package/webpack.renderer.config.js +30 -0
  54. package/webpack.rules.js +35 -0
package/src/logging.js ADDED
@@ -0,0 +1,150 @@
1
+ function initializeLogging({ logapi = null, documentRef = document, consoleRef = console }) {
2
+ let activityLogPath = "Unavailable";
3
+ const activityLogEntries = [];
4
+
5
+ function renderActivityLogEntries(searchText = "") {
6
+ const entriesEl = documentRef.getElementById("activity-log-entries");
7
+ if (!entriesEl) return;
8
+ entriesEl.replaceChildren();
9
+ const normalizedSearch = searchText.trim().toLowerCase();
10
+ activityLogEntries
11
+ .filter((entry) =>
12
+ normalizedSearch ? entry.message.toLowerCase().includes(normalizedSearch) : true,
13
+ )
14
+ .forEach((entry) => {
15
+ const row = documentRef.createElement("div");
16
+ row.className = "activity-log-entry";
17
+ row.textContent = entry.message;
18
+ entriesEl.appendChild(row);
19
+ });
20
+ }
21
+
22
+ function syncActivityLogPath(result) {
23
+ if (result && result.path) {
24
+ activityLogPath = result.path;
25
+ const pathEl = documentRef.getElementById("activity-log-path");
26
+ if (pathEl) {
27
+ pathEl.textContent = `Log file: ${activityLogPath}`;
28
+ }
29
+ }
30
+ }
31
+
32
+ function addActivityLogEntry(message, writeToFile = true) {
33
+ if (typeof message !== "string" || message.trim() === "") return;
34
+ const normalizedMessage = message.trim();
35
+ activityLogEntries.unshift({ message: normalizedMessage });
36
+ renderActivityLogEntries(
37
+ documentRef.getElementById("activity-log-search")?.value || "",
38
+ );
39
+ if (writeToFile && logapi) {
40
+ logapi.append(normalizedMessage).then(syncActivityLogPath);
41
+ }
42
+ }
43
+
44
+ function writeLogEntry(message) {
45
+ const stampedMessage = `[${new Date().toISOString()}] [GUI][UI] ${message}`;
46
+ addActivityLogEntry(stampedMessage);
47
+ }
48
+
49
+ function writeConsoleLogEntry(message) {
50
+ const stampedMessage = `[${new Date().toISOString()}] [Console][UI] ${message}`;
51
+ addActivityLogEntry(stampedMessage);
52
+ }
53
+
54
+ function writeBackendErrorLogEntry(message) {
55
+ const stampedMessage = `[${new Date().toISOString()}] [Console][Backend] ${message}`;
56
+ addActivityLogEntry(stampedMessage);
57
+ }
58
+
59
+ function logErrorEntry(context, error) {
60
+ const errorDetails =
61
+ error && typeof error === "object" && "message" in error
62
+ ? error.message
63
+ : String(error);
64
+ writeLogEntry(`Error context=${context} details="${errorDetails}"`);
65
+ }
66
+
67
+ function formatConsoleValue(value) {
68
+ if (value instanceof Error) {
69
+ return value.stack || value.message;
70
+ }
71
+ if (typeof value === "string") {
72
+ return value;
73
+ }
74
+ if (typeof value === "undefined") {
75
+ return "undefined";
76
+ }
77
+ try {
78
+ return JSON.stringify(value);
79
+ } catch (_error) {
80
+ return String(value);
81
+ }
82
+ }
83
+
84
+ function formatConsoleArgs(args) {
85
+ return args.map((value) => formatConsoleValue(value)).join(" ");
86
+ }
87
+
88
+ const originalConsoleLog = consoleRef.log.bind(consoleRef);
89
+ consoleRef.log = (...args) => {
90
+ originalConsoleLog(...args);
91
+ const message = formatConsoleArgs(args);
92
+ if (message) {
93
+ writeConsoleLogEntry(message);
94
+ }
95
+ };
96
+
97
+ async function initializeActivityLog() {
98
+ const pathEl = documentRef.getElementById("activity-log-path");
99
+ const panelEl = documentRef.getElementById("activity-log-panel");
100
+ const searchEl = documentRef.getElementById("activity-log-search");
101
+ const logBtn = documentRef.getElementById("log-btn");
102
+ const closeBtn = documentRef.getElementById("close-log-btn");
103
+ if (logapi) {
104
+ try {
105
+ const [path, entries] = await Promise.all([logapi.getPath(), logapi.getEntries()]);
106
+ if (Array.isArray(entries)) {
107
+ activityLogEntries.splice(0);
108
+ entries.forEach((entry) => {
109
+ activityLogEntries.push({ message: entry });
110
+ });
111
+ renderActivityLogEntries();
112
+ }
113
+ if (path) {
114
+ activityLogPath = path;
115
+ pathEl.textContent = `Log file: ${activityLogPath}`;
116
+ }
117
+ logapi.onEntry((entry) => {
118
+ addActivityLogEntry(entry, false);
119
+ });
120
+ } catch (error) {
121
+ logErrorEntry("activity-log-init", error);
122
+ }
123
+ }
124
+ logBtn.addEventListener("click", () => {
125
+ if (panelEl.style.display === "block") {
126
+ panelEl.style.display = "none";
127
+ } else {
128
+ panelEl.style.display = "block";
129
+ }
130
+ });
131
+ closeBtn.addEventListener("click", () => {
132
+ panelEl.style.display = "none";
133
+ });
134
+ searchEl.addEventListener("input", (event) => {
135
+ renderActivityLogEntries(event.target.value);
136
+ });
137
+ writeLogEntry("PacketSnitch UI session initialized");
138
+ }
139
+
140
+ return {
141
+ initializeActivityLog,
142
+ writeLogEntry,
143
+ writeBackendErrorLogEntry,
144
+ logErrorEntry,
145
+ };
146
+ }
147
+
148
+ module.exports = {
149
+ initializeLogging,
150
+ };