曲径通幽论坛

标题: 基于 culr 针对 DZ7.0 的自动回帖工具 [打印本页]

作者: beyes    时间: 2011-1-30 13:04
标题: 基于 culr 针对 DZ7.0 的自动回帖工具
这里仅实现登陆和发一贴的功能,如果你有需要,可以对其扩展:
#!/bin/sh

curl -A "Mozilla/4.0" -o login.html http://192.168.1.102/dz/logging.php?action=login

loginhash=`cat login.html |grep "input type=\"hidden\" name=\"formhash\"" |awk '{print NR, $0}' |tail -1 |awk '{print $5}'|sed -e 's/value="//' |sed -e 's/\"//'`

curl -A "Mozilla/4.0" -d "answer=&formhash=${loginbash}&loginfield=username&username=admin&password=123456&questionid=0&referer=http://192.168.1.102/dz/index.php&loginsubmit=提交" -D bbscookie.txt -o logined.html http://192.168.1.102/dz/logging.php?action=login

curl -A "Mozilla/4.0" -b bbscookie.txt -o view.html http://192.168.1.102/dz/viewthread.php?tid=2&extra=page%3D1

tidhash=`cat view.html |grep "input type=\"hidden\" name=\"formhash\"" |awk '{print NR, $0}' |tail -1 |awk '{print $5}'|sed -e 's/value="//' |sed -e 's/\"//'`

curl -A "Mozilla/4.0" -d "formhash=${tidhash}&subject=&usesig=0&message=okle8888" -b bbscookie.txt -o ok.html "http://192.168.1.102/dz/post.php?action=reply&fid=2&tid=2&extra=page=1&replysubmit=yes&infloat=yes&handlekey=fastpost&inajax=1"
在本机上测试成功,效果如下:
[root@centos samba]# sh post.sh
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  8892    0  8892    0     0   166k      0 --:--:-- --:--:-- --:--:--     0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  4130  100  4130    0     0  57002      0 --:--:-- --:--:-- --:--:--     0
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 55897    0 55897    0     0   653k      0 --:--:-- --:--:-- --:--:-- 7784k
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   514  100   514    0     0   6327      0 --:--:-- --:--:-- --:--:--     0





欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) Powered by Discuz! X3.2