Re:发现图书馆信号最好的地方

[复制链接]
查看11 | 回复3 | 2021-1-29 05:36:19 | 显示全部楼层 |阅读模式
alizee:~/code/bbsbotayuer$catREADMEBBSbot:上水木BBS的工具I.系统要求:在Unix系统下使用,必需装有expect和Tcl.
II.使用方法:
1.修改bbsbot脚本开头的变量datafile和passwdfile,使它们指向data和passwd文件的绝对路径。
2.修改passwd文件,加入你的ID和密码,你的马甲和密码。如下面所示:
setpasswd(yourid)yourpasswordsetpasswd(your_majia)majia_password
然后运行:
bbsbotID
III.功能:功能可以任意扩展,现在主要的功能是
1.自动上站,防止断线。2.支持telnet和ssh。缺省登录方式是ssh,你可以把bbsbot文件开头加入setssh0
从而使用telnet登录。
2.自动回复消息,并且可以按msg内容回复多个随机消息。按Ctrl-E切换自动回复功能,缺省时关闭自动回复。定制消息内容请修改data文件,依葫芦画瓢。消息记录在chatlog.ID文件里。其它热键可以自己定义,只需要修改bbsbot文件的interact部分,依葫芦画瓢.比如现在Ctrl-K可以立即断线。
目前只支持smthBBS.因为bbsbot使用比较精确的匹配消息,条件自动回复功能。我只提取了smth的消息格式,所以如果要在其它BBS自动回复,需要修改文件相关正则表达式。
alizee:~/code/bbsbotayuer$xxmo (showmethemoney) 在 ta 的帖子中提到:期待一下~快点贴!

回复

使用道具 举报

千问 | 2021-1-29 05:36:19 | 显示全部楼层
alizee:~/code/bbsbotayuer$catdata#!/usr/bin/expect-fsetreplies{hi{你有事找我?}kick{kickback}.*{$id,你有事找我吗?请稍等。}}
alizee:~/code/bbsbotayuer$xxmo (showmethemoney) 在 ta 的帖子中提到:期待一下~快点贴!

回复

使用道具 举报

千问 | 2021-1-29 05:36:19 | 显示全部楼层
alizee:~/code/bbsbotayuer$catpasswdsetpasswd(guest2002)jiandandemima
alizee:~/code/bbsbotayuer$xxmo (showmethemoney) 在 ta 的帖子中提到:期待一下~快点贴!

回复

使用道具 举报

千问 | 2021-1-29 05:36:19 | 显示全部楼层
alizee:~/code/bbsbotayuer$catbbsbot#!/usr/bin/expect-f
setdatafile/home/wy/bin/bbsbot/datasetpasswdfile/home/wy/bin/bbsbot/passwdsettimeout60setidsetauto0setautoreply0setbotname[lindex$argv0]setarticle_counter0setcountstarted0setssh1
if{[llength$argv]1}{putsuseage:;exit;}puts[lindex$argv0]
procreloaddata{}{globalrepliesarrlenpasswddatafilepasswdfile#readdatafilesetdatafile_contents[open$datafiler0400]setfilecontents[read-nonewline$datafile_contents]eval$filecontentsclose$datafile_contentssetarrlen[llength$replies]
#readpasswordfilesetdatafile_contents[open$passwdfiler0400]setfilecontents[read-nonewline$datafile_contents]eval$filecontentsclose$datafile_contents}
procresetstate{}{send\033\133\104\033\133\104\033\133\104\033\133\104f\r}
procsendmsg{idstr}{sendw$id\r$str\r\r\r}
procpost{theboardtitlefile}{sends$theboard\rsend\020$title\r\r[execcat$file]\027s\r}
procmail{recvidtitlefile}{globalautosettmp$autosetauto0send\033\133\104\033\133\104\033\133\104sendm\rs\r$recvid\r$title\r\rsend[execcat$file]\027s\r\ry\r\rresetstatesetauto$tmp}
proccountarticle{board}{globalcountarticlearticle_countercountboardarticle_countcountstartedsetcountstarted0setcountboard$boardsends$board\rcatch{unsetarticle_count}send$setarticle_counter1}
reloaddata

if($ssh){spawnssh-l$botname166.111.8.238expectpassword:{send$passwd($botname)\r}timeoutexp_continue}else{spawntelnet166.111.8.238expect请输入代号:{send$botname\r}timeoutexp_continueexpect请输入密码:{send$passwd($botname)\r}timeoutexp_continue}
expect_background-re你同时上线的窗口数过多|密码输入错误的记录{if{$auto}{sendy\r}}上次连线时间为{if{$auto}{sendn\r}}eof{exit}-re上次连线时间为|按.*继续{if{$auto}{send\r}
}-re{\r(\u001b\[[[:digit:];]*.)*([[:alnum:]]+)*(\u001b\[[[:digit:];]*.*)*(\(.*\)).*\n\r(\u001b\[[[:digit:];]*.)*(.*?)*(\u001b\[[[:digit:]]*.)+.*\n\r}{if{$autoreply}{#autoreplymsgsetsendreply1setretindex0setnamenobodysetret哦setretpat哦
setid$expect_out(2,string)settime$expect_out(4,string)setcontents$expect_out(6,string)
setretval0setretval[catch{sethk$lastreply($id)}]if{$retval}{setlastreply($id)}
setretval0setretval[catch{incrautorepeat($id)1}]if{$retval}{setautorepeat($id)1}
setpatfound0
#selectrandomreplypatternfromthelistifamatchfoundfor{setind0}{$ind$arrlen}{incrind2}{setpat[lindex$replies$ind]
if{[regexp-nocase$pat$contentsmatchmsubmsubbmsubbb]}{setpatfound1setretpatterns[lindex$replies[expr$ind+1]]setpatlistlen[llength$retpatterns]
#dealwithemptypatternlists#setlisttodefaultlistif{$patlistlen==0}{setretpatterns[lindex$replies[expr$arrlen-3]]setpatlistlen[llength$retpatterns]}
#pickuparandomreplaypatternfromthelistsetrand0setretpat[lindex$retpatterns$rand]setretindex$randevalsetret\$retpat\break;}}
if{$sendreply}{sendr$ret\rsetlastreply($id)$ret
#logsetfileId[openchatlog.$botnamea0600]puts$fileId$id$time:$contents\nputs$fileId====$retclose$fileId}}
#seeifarticlecounterinterrupted}-re{讨论区.*?\[(.*?)\]}{setcurrentboard$expect_out(1,string)}
for{}1{}{interacttimeout60{send\033\133\101\033\133\102}\005{#C-eif{$autoreply}{setautoreply0send_usernoautoreply}else{setautoreply1send_userautoreply}
}\013{#C-kexit}}
alizee:~/code/bbsbotayuer$xxmo (showmethemoney) 在 ta 的帖子中提到:期待一下~快点贴!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行