Ce este un Fork Bomb si cum functioneaza

Stefanescu Mihai 9 months ago Linux

Exista mai multe comenzi periculoase pe care un utilizator le poate scrie in terminal si sa ii provoace un crash sau poate chiar mai rau, sa strice lucrurile.

Acestea fiind zise, cred ca este o idee buna sa povestesc despre anumite comenzi periculoase astfel incat sa le cunoasteti si sa nu le rulati.

Una dintre cele mai cunoscute comenzi periculoase este bineinteles aceasta

sudo rm -rf /

Ar trebui sa fie destul de clar ce face aceasta comanda pentru majoritatea utilizatorilor, dar totusi am sa incerc sa o explic.

sudo iti da drepturi de root
rm sterge un fisier
-r sterge in mod recursiv
f vine de la force
/ se refera la root-ul sistemului de operare

Astfel incat, comanda asta o sa inceapa de la root si o sa stearga in mod recursiv toate fisierele din sistem.
Referitor la structura sistemului de fisiere din linux recomand acest articol.

Evident aceasta comanda este destul de periculoasa, dar cred ca distributiile moderne nu iti permit sa rulezi aceasta comanda fara sa te intrebe cel putin inca o data daca esti sigur ca vrei sa o rulezi.


Alta comanda periculoasa care este de fapt un fel de atac DDOS este Fork Bomb-ul. Fork bomb-ul este un script de shell, dar poate fi scris in orice limbaj, care poate fi executat pe sistem.
Fork Bomb-ul porneste fork-uieste in continuare un proces pana cand masina ta ramane fara memorie si esti nevoit sa o restartezi.
Porneste de la 1 proces, il forkuieste si ajunge sa aiba 2 procese, apoi fiecare dintre aceste procese este fork-uit si ajungem sa avem 4 procese si tot asa.

Dupa cum spuneam, un fork bomb poate fi scris in orice limbaj, de fapt chiar am gasit acest repository cu fork bomb-uri in mai multe limbaje.

Cred ca una dintre cele mai folosite fork bomb-uri este aceea scrisa in shell, pe care cel mai probabil ai mai vazut-o pe internet :(){:|:&};:

Dupa cum puteti observa, acest fork bomb este interesant pentru ca esti compus doar din caractere speciale, fara text, ceea ce o face mai greu de inteles, mai ales daca nu stii shell scripting.

Hai sa explicam cum functioneaza.
Pornind de la comanda scrisa putin mai sus, am sa incerc sa o aranjez putin ca sa ne ajute sa intelegem.

: () {
	:|: &

Dupa cum putem observa, acum ca este aranjata putin mai frumos, forkbomb-ul nostru incepe sa arate ca o function si de fapt chiar asta, o functie cu numele :, care dupa ce este definita esti si rulata (vezi : de pe randul 4)

Acum, ce face de fapt aceasta functie, se apeleaza pe sine insusi si trimite rezultatul tot care ea, creeand inca un proces, iar & ii spune sa tine acel proces in background creean o bucla infinita in care la fiecare rulare mai creeaza un proces si tot asa.

Apoi, dupa inchiderea functiei avem ; care este folosit strict pentru ca este folosita inline si marcheaza inchiderea primei parti a scriptului si urmeaza a doua, daca scriptul era aranjat, cum e mai sus, nu mai aveam nevoie de acel ;.

Asta este toata explicatia, un forkbomb nu este chiar atat de complicat dupa cum vezi.

Sper ca acest articol ti-a fost util si ai invatat ceva.


Programator de ~8 ani, am lucrat la proiecte din mai multe industrstrii, de la eCommerce la telecomunicatii la automatizari. In acest timp am folosi diferite tehnologii, de la PHP, MySQL, PostgreSql, RabbitMq, Redis, Memcached si altele.

Get in touch
Pentru nelamuriri, dubii, comentarii si chestii de pe suflet ne putem auzi pe Discord, Reddit sau poti deschide o discutie noua pe forum

ovi_cluj # 5 months ago Ma asteptam ceva Ms-Dos : gen " format c: " sau "fdisk /mbr' Da is bune si astea :p Da-le idei la hackeri-crackeri cu Dos sa faca si flood in retea sau Lan gen: https://en.wikipedia.org/wiki/Denial-of-service_attack
How to buy affordable Lantus insulin online without a prescription and get it de # 5 months ago Yo where can I score some cheap diabetes drugs without a damn prescription? You want discounted diabetes medication without a prescription? You got it, bud Discounted insulin without a prescription. Who needs doctors anyway? Low cost Glyburide without a prescription to treat diabetes online
Supplements affiliate marketing registration # 5 months ago health blog influencer marketing make money from home with no experience online tutoring jobs for stay-at-home moms pharmacy affiliate marketing
but I don't want to pay a fortune or jump through any hoops # 5 months ago buy Actoplus online without prescription Buy diabetes drugs online with free shipping and no prescription Looking for a dark web pharmacy that sells Acarbose at a discount? Mail-order Metformin without prescription
forzest en venta en España # 1 month ago Wow, superb blog layout! How lengthy have you ever been blogging for? you make blogging look easy. The total look of your site is magnificent, let alone the content material!
achat de sildenafil 100 mg en Italie # 1 month ago Hi it's me, I am also visiting this website on a regular basis, this web site is genuinely fastidious and the people are truly sharing fastidious thoughts.
Cbizxj # 1 month ago order fenofibrate online <a href="https://fenoficor.com/">fenofibrate pills</a> tricor 200mg us
Online-Apotheke für tretinoin in Österreich # 1 month ago Greetings! Very helpful advice in this particular article! It is the little changes which will make the biggest changes. Thanks a lot for sharing!
Kauf von schlaffördernden Medikamenten # 1 month ago We stumbled over here coming from a different web page and thought I might as well check things out. I like what I see so i am just following you. Look forward to exploring your web page repeatedly.
Mpgbag # 1 month ago zaditor drug <a href="https://geozipin.com/">buy geodon 80mg</a> purchase imipramine generic
ansial sin receta en Bélgica # 1 month ago What's up, the whole thing is going perfectly here and ofcourse every one is sharing data, that's in fact good, keep up writing.
Xrcdcr # 1 month ago precose 50mg us <a href="https://tofobose.shop/">acarbose sale</a> griseofulvin cheap
Mibysi # 4 weeks ago order aspirin 75mg online cheap <a href="https://levquinon.shop/">eukroma for sale</a> buy generic zovirax
Rosalina # 4 weeks ago Just desire to say your article is as amazing. The clarity in your post is simply excellent and i could assume you're an expert on this subject. Well with your permission let me to grab your feed to keep updated with forthcoming post. Thanks a million and please continue the enjoyable work.
Lzmzji # 3 weeks ago meloset online order <a href="https://danaterone.com/">buy cheap danocrine</a> order danazol generic
Rene # 3 weeks ago The other day, while I was at work, my cousin stole my apple ipad and tested to see if it can survive a forty foot drop, just so she can be a youtube sensation. My apple ipad is now destroyed and she has 83 views. I know this is completely off topic but I had to share it with someone!
risedon expédié discrètement # 3 weeks ago I'm not sure why but this site is loading incredibly slow for me. Is anyone else having this problem or is it a problem on my end? I'll check back later on and see if the problem still exists.
Pdjuiz # 3 weeks ago cost dydrogesterone 10 mg <a href="https://empaolol.com/">cheap jardiance 10mg</a> order empagliflozin for sale
Bcoygn # 3 weeks ago florinef drug <a href="https://imocarbam.com/">purchase loperamide online cheap</a> imodium 2mg uk
Tjqjxz # 2 weeks ago order prasugrel 10mg <a href="https://thoramine.shop/">buy dramamine 50mg sale</a> purchase detrol without prescription
Chet # 2 weeks ago Woah! I'm really loving the template/theme of this website. It's simple, yet effective. A lot of times it's difficult to get that "perfect balance" between superb usability and visual appearance. I must say you have done a amazing job with this. Additionally, the blog loads super fast for me on Safari. Exceptional Blog!
Pnvrfv # 2 weeks ago buy monograph 600mg without prescription <a href="https://benedolac.shop/">buy etodolac pills</a> cilostazol price
clomipramine kopen in Italië zonder recept # 2 weeks ago My partner and I stumbled over here by a different website and thought I may as well check things out. I like what I see so now i am following you. Look forward to looking at your web page yet again.
Hsiort # 2 weeks ago ferrous 100mg over the counter <a href="https://fertonel.shop/">actonel online order</a> cost sotalol 40 mg
novo-furan prescrit sur ordonnance # 2 weeks ago Touche. Sound arguments. Keep up the good effort.
Uejovf # 2 weeks ago vasotec online buy <a href="https://duphstine.com/">order duphalac bottles</a> lactulose online
Qfxwnt # 1 week ago betahistine online order <a href="https://benedolac.com/">order probenecid 500mg</a> benemid tablet
Bhiajh # 1 week ago buy xalatan generic <a href="https://aexeloda.com/">xeloda 500 mg cheap</a> buy exelon 3mg online
Ftrcxf # 1 week ago order generic micardis 80mg <a href="https://molnenil.shop/">molnunat 200 mg price</a> order molnupiravir generic
Qdxgyj # 5 days ago oral cenforce 100mg <a href="https://chlodinir.com/">buy aralen 250mg generic</a> purchase chloroquine online
Preis von Medikamenten in der Apotheke # 2 days ago This paragraph will help the internet people for building up new webpage or even a blog from start to end.
Club-ul este dedicat membrilor si ofera access la mai multe zone ale website-ului.
Login Register

🔖 Bookmarks
✨ Pentru a sustine aceasta comunitate am sa te rog sa te autentifici sau sa te inregistrezi!

🌪️ Discord
Back to top
Folosim cookie-uri pentru a oferi functionalitatile critice ale aplicatiei Invata-Programare. Folosim cookie-uri si pentru a analiza traficul, pentru care e nevoie de consimtamantul dvs. explicit.