+ 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?
9 Respostas
+ 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.
+ 11
while(True):
print('infinity')
#Good ideas
#but another people can close the program !!
+ 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.
+ 6
Thanks
+ 6
thanks. I'll check it out
+ 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..
:)
+ 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.
+ 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
+ 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 :)