Javascript function output (deobfuscation) [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have come across this code in a web page from a CTF game:
function conexion() {
var Password = "unescape(String.fromCharCode%2880%2C%20108%2C%2097%2C%20110%29):KZQWYZLOMNUWC===":
for (i = 0; i < Password.length; i++) {
if (Password[i].indexOf(code1) == 0) {
var TheSplit = Password[i].split(":");
var code1 = TheSplit[0];
var code2 = TheSplit[1];
}
}
}
After working a little bit, I have deobfuscated the Password line and obtained:
unescape(String.fromCharCode(80, 108, 97, 110)):KZQWYZLOMNUWC===
which was also translated to Password = "Plan:KZQWYZLOMNUWC===";.
My first reading of the code is that code1 = Plan and code2 = KZQWYZLOMNUWC.
But this is not the correct answer. I’m also not sure how the === operates here.
May you please give me some insights?

Related

how to prevent user input any string that it's size more than two bytes? (two bytes only) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I'm trying to figure out how to configure my input that only receives two bytes characters. I've tried so many functions here but it seems not to work. For example, I have an input and I want the user just only fill it with 2 bytes characters.
var i = document.createElement("input");
i.type = "text";
document.body.appendChild(i);
i.addEventListener("change", (e) => {
let v = e.target.value;
console.log(v);
let b = (new Blob([v])).size;;
console.log(b);
})

I want to convert array to object in java script like[ ["key1","ans1"],["key2","ans2"] ]=> {key1:"ans1",key2:"ans2"} [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I want to convert array to object in javascript like
[["key1","ans1"],["key2","ans2"]] => {key1:"ans1",key2:"ans2"}
Here you go;
let res = {}
let arr = [["key1","ans1"],["key2","ans2"]]
for (let i = 0; i < arr.length; i++) {
res[arr[i][0]] = arr[i][1]
}
console.log(res)
please comment if you need explanation.

For loop JS for a calculator [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm trying to create a calculator which goes through 18 units. I wanted to make my code shorter by using a for loop. I thought something like this would work:
var i=0;
for (i=0;i<=18;i++)
{
if (Unit[i] = "P" or Unit[i] == "p")
{
UnitTotal[i] = 70;
SetCookie('UnitAns'[i],UnitAns[i]);
}
}
This doesn't work what am I doing wrong or what do I need to do differently?
Unit[i] = "P"
Unless it throws an exception because Unit isn't defined, this will always be true. = is an assignment, not a comparison.
or
or is not a keyword in JavaScript. The OR operator is ||.

how to change constructor value JS [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to change constructor base value like I have:
function G()
{
this.speed=1;
}
and var k=new G(); gives me k.speed=1;
now I want that every time I create new G , its speed was like 10;
I tried
G.changeSpeed=function(){this.speed=10;}
G.prototype.changeSpeed=function(){this.speed=10;}
second works on already initialised ones, but first doesn't work at all ( error ).
any way I can do it?
How about:
function G(speed)
{
this.speed = speed;
}
You can do:
var x = new G(1); // x.speed = 1;
var y = new G(2); // y.speed = 2;

Why JavaScript Alert Message is not working ? Code Error cannot be indicated [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Why JavaScript Alert Message is not working ?
var ckc = prompt ("Enter Your City");
ckc = ckc.toLowerCase();
var cities =["Aaan", "Baan", "Caan" ,"Daan"];
for (var i=0; i<=4 ; i++){
if (ckc === cities[i]){
alert ("Hum, Nice City");
}
}
Use:
if (ckc === cities[i].toLowerCase()){
since you have downcased ckc and cities array has upcase values, your original if condition would never work.
Remove this code
ckc = ckc.toLowerCase();

Categories

Resources