Skip to content
Life is short Play more
  • Computer
    • Cloud
    • DataBase
      • Mysql
      • Oracle
    • Operation system
      • Android
      • Linux
      • Windows
    • Programming
      • C , C++
      • Java
      • Javascript
      • Linux shell
      • Php
      • python
      • Web Programing
    • Security
    • Virtulization
    • Web hosting
      • Ad
  • Life Testing
  • My work
    • wrapEasyDevice
  • Network
    • HTTP
  • Note
  • Other
    • Embedded
    • Hardware
  • Share
    • Articles
    • Music
    • Tools
    • Video
  • Software Testing
    • Automation Testing
    • Cloud Testing
    • Functional Testing
    • Performance Testing
Life is short Play more
Life is short play more

bash中的冒号, 以及bash bomb解析还有各种各样的炸弹

Posted On 2011年11月18日

bash中的冒号是内建命令

“:” is a builtin shell command, and is equivalent to to the “true” command, it is used mostly as a placeholder in scripts.

永远返回真, 相当于一个站位符号.

可以用来注释,跨行注释

: ‘this is
comment
!!’

如下是一个有冒号的,看似是一个命令. 会不断fork线程,导致机器崩溃.
但实际上, 这个和冒号命令无关.

:(){ :|:& };:

: 这里代表是定义了一个函数名字而已. 和下面的一段bash代码意义相同.

funcname() {
# Run 2 instances of the very same function
# in the background. Each of these new
# processes will do the same: each starts 2 new
# processes doing the same,... and again, and again..
funcname | funcname &
}

STUB: dont run this! It will probably halt your computer.

# Now just call the function to start forking
# bash processes indefinately.

funcname

# We will never get here.

如何让机器死机?

Perl exmaple:
perl -e "fork while fork" &
Python example:
import os
while(1):
os.fork()
Windows XP / Vista bat file example:
:bomb
start %0
goto bomb
UNIX style for Windows:
%0|%0

C program example:

#include
int main() { while(1) fork(); }

Plz note that the fork bomb is a form of denial of service, so don’t run on production or unauthorized system.

此篇文章已被阅读2297 次

相关文章

  1. javascript有sleep方法么?
  2. linux(unix)文件格式类型以及dos和unix文件格式的转换
  3. Unix domain sockets介绍
  4. linux shell经典应用
  5. how to extend root partition size

Related Posts

linux shell脚本 发送multipart格式邮件
编程恐惧主义者
git撤回一个merge提交

About The Author

The Tester

技术交流,生活学习

Add a Comment

取消回复

邮箱地址不会被公开。 必填项已用*标注

最热文章

  • No results available

近期文章

  • vue2 动态import导入vue提示报错
  • batch udpate sql批量更新数据库中所有表的特定字段值
  • Springboot application启动missing EmbeddedServletContainerFactory错误解决
  • Dubbo使用java api 配置开发禁止使用config center
  • 使用jacoco实时生成后端服务集成测试代码覆盖率报告

近期评论

  • ghj发表在《科学上网trojan的安装和使用》
  • The Tester发表在《cloudflare Rocket Loader建议中国使用者关闭》
  • zhoulujun发表在《cloudflare Rocket Loader建议中国使用者关闭》
  • The Tester发表在《vue+iviewui menu+tabs联动及tabs切换总结》
  • xiaodong.xuexd发表在《sonarqube 7.0 新功能及安装》
  • Josephnex发表在《使用github pages作图床》

标签云

adsense ajax android aws crawler css eclipse findbugs git goagent htmlunit iptables jacoco java javascript jmeter joolma joomla junit jvm lcd linux moco mongodb monkeyrunner mysql oled openvpn oracle pdp php puppet python rabbitmq sonar sonarqube spring springboot ubuntu vpn vue wordpress wrapeasymonkey yii yum

分类目录

© 2025 Life is short Play more | blog | Powered by WordPress & Customizable Blogily