Very CD 관수 기 데모 코드 (다른 스티커 코드 첨부)
매일 물 을 주입 하려 면 Liux 는 cron job 를 만 들 고 windows 는 임 무 를 계획 하 며 2 주 후에 구리 로 올 라 가 그 후보 지역 을 돌아 다 닐 수 있 습 니 다.
#!/usr/bin/env python
#coding:utf-8
#author:observer
#http://obmem.info/old
import urllib,urllib2,cookielib
import re,time,random
username = 'username' #
passwd = 'password' #
# , ,
msg = [ ' ',
'Mark',
' , ',
' ',
]
def login():
''' '''
print 'try to login...'
# cookie
cookie=cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cookie), urllib2.HTTPHandler)
urllib2.install_opener(opener)
# verycd fk ,
print '...getting login form...'
loginform = urllib2.urlopen('http://secure.verycd.com/signin/*/http://www.verycd.com/').read()
fk = re.compile(r'id="fk" value="(.*)"').findall(loginform)[0]
# ,
postdata=urllib.urlencode({'username':username,
'password':passwd,
'continueURI':'http://www.verycd.com/',
'fk':fk,
'login_submit':' ',
})
req = urllib2.Request(
url = 'http://secure.verycd.com/signin/*/http://www.verycd.com/',
data = postdata
)
# header, , , ,
req.add_header('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.6) Gecko/20091201 Firefox/3.5.6')
req.add_header('Accept','text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8')
req.add_header('Accept-Encoding','gzip,deflate')
# ,
print '...login form submitted'
result = urllib2.urlopen(req).read()
print '...login succeed!'
def farm():
''' '''
# , id
res = urllib.urlopen('http://www.verycd.com').read()
topics = re.compile(r'/topics/(\d+)').findall(res)
topics = set(topics)
print topics
# , :)
#
for topic in topics:
url = 'http://www.verycd.com/topics/'+str(topic)+'/reply#fast-replay'
print url
postData = {
'contents':random.choice(msg),
'use_bbcode':'1',
'tid':str(topic),
'Action':'FolderCommentOperate:doReplyFolder'
}
postData = urllib.urlencode(postData)
req = urllib2.Request(url = url, data = postData )
kk = urllib2.urlopen(req).read()
time.sleep(random.randint(1,10)) #
if __name__ == '__main__':
login()
farm()
-------------------------------------------------------------------
#! /usr/bin/python
# -*- coding: cp936 -*-
import urllib, urllib2, cookielib
import re, time, random
#####################################
#
# Globals
#
#####################################
site = 'http://www.*******.com.cn/bbs'
catagory = '2'
sleep_interval = '900'
content_choices = [' ', ' ', ' ', ' ', ' ……', ' !', ' ',
' ', ' ', ' , ']
content_max_index = len(content_choices) - 1
####################################
#
# Store the cookie
#
####################################
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
########################
#
# setup connection
#
########################
conn = opener.open(site + '/index.asp')
####################################
#
# Find the passcode and prompt user
#
####################################
conn = opener.open(site + '/code.asp')
conn.read(54) # the header of bitmap file
debug = ['', '', '', '', '', '', '', '', '', '']
s = ['', '', '', '']
bg = '\xee\xee\xee'
for x in range(0, 10):
for y in range(0, 4):
for z in range(0, 10):
data = conn.read(3)
if data == bg:
s[y] += '1'
debug[x] += ' '
else:
s[y] += '0'
debug[x] += '#'
#debug[x] += '|'
for x in range (9, -1, -1):
print debug[x]
passcode = raw_input('
Please input passcode as above: ')
params = {'username':'******', 'UserPassword':'******', 'passcode':passcode}
data = urllib.urlencode(params)
req = urllib2.Request(site + '/chkuserj.asp', data)
conn = opener.open(req);
print conn.read(200)
##############################
#
# find titles
#
##############################
conn = opener.open(site + '/jj.asp?fenlei=' + catagory)
reo = re.compile(r'titleid=(\d+)');
f = conn.readlines()
post_count = 0
for line in f:
if line.find('titleid=') != -1:
m = reo.search(line);
tid = m.group(1)
# Get random data for watering the topic, hehe
index = random.randint(0, content_max_index)
userface = random.randint(1,24)
params = {'title':'Re:', 'body':content_choices[index], 'userface':str(userface)}
data = urllib.urlencode(params)
# post my replies
print 'Re: ' + tid + ' with data: ' + content_choices[index]
#conn = opener.open(site + '/saveh.asp?fenlei=' + catagory + '&titleid=' + tid, data)
# This is a bug of the website. There is no catagory 33 at all. The post is lost,
# but the post score of the user has been increased. hehe.
conn = opener.open(site + '/saveh.asp?fenlei=' + '33' + '&titleid=' + tid, data)
#print conn.read()
conn.close()
post_count = post_count + 1
# Don't make a flood
time.sleep(sleep_interval)
print '
Total posted: ' + post_count
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
다양한 언어의 JSONJSON은 Javascript 표기법을 사용하여 데이터 구조를 레이아웃하는 데이터 형식입니다. 그러나 Javascript가 코드에서 이러한 구조를 나타낼 수 있는 유일한 언어는 아닙니다. 저는 일반적으로 '객체'{}...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.