How to make virus using javascript? | Sololearn: Learn to code for FREE!


How to make virus using javascript?

10/26/2016 9:20:06 AM

Rohit Yadav

14 Answers

New Answer


There is no such a thing as a JS virus. But, you still can run some scripts to collect some data. The most widespread example is to use JS to get like on FB etc. it's simple and nothing like virus, however it's a trick and you can try on your system. Hint: you can use CharCode() to trick non computer guys. There is a sample CharCode in my profile, take a look to get the basic idea.


@Zen because it's one of the main parts of the programming and if you want to know how to secure your stuff you better know how to do it by yourself. BTW it's not a advanced thing and he should still use his skills to done it. We are here to learn and hack(in a good way) so I prefer to share my knowledge and learn new things including bad stuff.


console.log("I am a virus, you are infected, be afraid")


@zen - I agree with Aar0n on this. Although I agree hacking is genreally seen as "the bad hacking" these days, thats only because most people don't fully understand hacking and so don't realise that there are the white hats or ethical hackers and the black -hats. Knowledge is a free thing. None of us here have the right to tell people what they are and aren't allowed to learn. It's a legitimate question. If @Rohit Yadav decides that he wants to use what he learns for nefarious purposes, then he does so of his own back. No one here is responsible for his actions, only himself.


not a good questions . but FYI viruses are created for some specific destructive purposes also it have capability to recreate itself. so here you can access data of an application if it has security breaches. testing these kind of stuffs are good for making secure applications .there are lot of application scanner s in market which tell u vulnerabilities and resolutions. still you have to learn it itself nobody is going to teach


what do you need it for ;)


javascript have no access to OS environment


you can't because browsers will block even a slightest thing logging it as access denied. js can only change dom and nothing else more. thanks to it it provides security it has no access to os. it cannot even change the browser system. I think browser should complete remove such malicious commands from their engine instead of blocking


You can't create viruses with javascript but you can create a trojan horse which infects computer. There are a lot of computers infected by these javascript trojan horses. One of the popular trojan horse created with js is "YouAreAnIdiot" which stores Trojan.js.youareanidiot file on your computuer permanently.


@Aar0n: Why the heck would you encourage that kind of behavior?


I get it and like what is said.


krijg de corona ik wil gekke virussen


Well, JavaScript is a wide term these days. You can program executables, that use JavaScript in some sense, as you do with electron (Discord, Visual Studio Code). But if you mean JavaScript in the webbrowser, I need to disappoint you. Webbrowsers would never allow JavaScript to leave the webpage environment because if they would, any webpage could access your computer.


virus code: while(true){ alert("you got a virus") }