+ 6

Can we use while loop to create a virus?

If we set a while loop condition that runs for infinity, is there a possible way to use this advantage for a virus?

10th Jun 2017, 4:50 AM
Ondape Valery
Ondape Valery - avatar
9 odpowiedzi
+ 14
Back in the good ol' days "a virus" meant purely a part of code which glued to executables or infected BIOS and its main feature, apart from dealing damage or halting, was to autoreplicate and glue to other executables - that's why the name, duh :) There are of course other types of malware like "trojans", which do not necessarily autoreplicate, but rather reside in the background of the OS and listen (event-based listening mostly) with a purpose of keylogging, mouseclicklogging and such. They mostly get activated when certain action condition is met. Infinite or extra large loop, unless it has some intrinsic maliciousness inside, I would not consider an essential part of a virus. The very autoreplication feature is enough.
10th Jun 2017, 5:35 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 11
while(True): print('infinity') #Good ideas #but another people can close the program !!
10th Jun 2017, 4:58 AM
Nithiwat
Nithiwat - avatar
+ 8
well, yes. but it's just a basic thing like any other programming concept. most programs use while loops. for a virus, maybe it would use a while loop to scan ports forever to find new places to infect. or use a while loop to constantly log your keystrokes and what you type, to get passwords.
10th Jun 2017, 5:27 AM
Ahri Fox
Ahri Fox - avatar
+ 6
Thanks
10th Jun 2017, 5:01 AM
Ondape Valery
Ondape Valery - avatar
+ 6
thanks. I'll check it out
17th Jun 2017, 10:40 AM
Ondape Valery
Ondape Valery - avatar
+ 4
The Best thing you can do is create a folder for each iteration of a while loop when clicked on the application launcher. Change the icon of the app (like icon of notepad or any game) and you can fool your friends. This will atleast make their desktop very very messy.. :)
10th Jun 2017, 5:04 AM
Abhijith R
Abhijith R - avatar
+ 4
You can create a fork-bomb. Read about it on Wikipedia. This is the code (batch): :loop start %0 goto loop #Start itself in the loop.
17th Jun 2017, 9:23 AM
Piotr
Piotr - avatar
+ 4
@Piotr that is not bash program -_- it is batch program that run on Windows.. :loop #this is a checkpoint start %0 #start the file itself goto loop #back to the checkpoint This is a very old virus but still very annoying, imagine you clicked it.. 1,2,4,16,32,64,128,.. in few seconds it will eat all your RAM... must restart your pc to stop it
18th Jun 2017, 4:54 PM
Alvin Ardiansyah
Alvin Ardiansyah - avatar
+ 1
Of course ! If you make an infinite while loop (where the condition is always true). Otherwise, to kill your virus it is simple, just close the program :)
10th Feb 2019, 9:48 AM
‏‪Regal Script‬‏
‏‪Regal Script‬‏ - avatar