コード例 #1
0
ファイル: vkapi.py プロジェクト: hiddenzed/vktest
def groupJoin(access_token, proxies, group_id, myid='1'):
    # try:
    params = {'access_token': access_token, 'v': '5.80', 'group_id': group_id}

    response = requests.get('https://api.vk.com/method/groups.join',
                            params=params,
                            proxies=proxies).json()

    if 'error' in response:
        if response['error']['error_code'] == 14:
            capkey = captcha.main(response['error']['captcha_img'], myid)
            params.update({
                'captcha_sid': response['error']['captcha_sid'],
                'captcha_key': capkey
            })

            requests.get('https://api.vk.com/method/groups.join',
                         params=params,
                         proxies=proxies).json()

            return 'captcha'

        elif response['error']['error_code'] == '103':
            return '5000'

        else:
            return response

    else:
        return 'ok'
コード例 #2
0
ファイル: api.py プロジェクト: AsadAliDD/captcha_server
def upload_base64_file():
    """ 
        Upload image with base64 format and get car make model and year 
        response 
    """

    data = request.form.get('img')

    if data is None:
        print("No valid request body, json missing!")
        return jsonify({'error': 'No valid request body, json missing!'})
    else:

        path = convert(data)
        cords = captcha.main('temp_bin.jpg', path)
        if (cords == 0):
            output = str(0) + "," + str(0)
            record(path, output)
            return jsonify({'Failure': output})

        x = (cords[0] + cords[1]) / 2.0
        y = (cords[2] + cords[3]) / 2.0
        output = str(x) + "," + str(y)
        record(path, output)
        return jsonify({'Success': output})
コード例 #3
0
ファイル: vkapi.py プロジェクト: hiddenzed/vktest
def videoComment(access_token,
                 proxies,
                 owner_id,
                 video_id,
                 message=None,
                 attachments=None,
                 myid='1'):
    params = {
        'access_token': access_token,
        'v': '5.80',
        'owner_id': owner_id,
        'video_id': video_id
    }

    if attachments != None:
        params.update({'attachments': attachments})

    if message != None:
        params.update({'message': message})

    response = requests.get('https://api.vk.com/method/video.createComment',
                            params=params,
                            proxies=proxies)

    try:
        response = response.json()

        if 'error' in response:
            if response['error']['error_code'] == 14:
                capkey = captcha.main(response['error']['captcha_img'], myid)

                params.update({
                    'captcha_sid': response['error']['captcha_sid'],
                    'captcha_key': capkey
                })

                response = requests.get(
                    'https://api.vk.com/method/video.createComment',
                    params=params,
                    proxies=proxies).json()

                return 'captcha'

            elif response['error']['error_code'] == 801:
                return 'closed comments'

            elif response['error']['error_code'] == 10:
                return 'internal server error'

        else:
            cid = response['response']

            return f'ok {cid}'

    except:
        try:
            return response

        except:
            return response.json()
コード例 #4
0
def create_pub(access_token, proxies=None):
	create_pub_params = {
		'title'          : 'Настенька',
		'type'           : 'public',
		'public_category': 1,
		'subtype'        : 1,
		'version'        : '5.80',
		'access_token'   : access_token
	}

	createpubanswer = requests.get('https://api.vk.com/method/groups.create', params=create_pub_params, proxies=proxies).json()

	if 'error' in createpubanswer:

		if createpubanswer['error']['error_code'] == 14:

			print ('captcha needed')

			import captcha as cap

			capkey = cap.main(createpubanswer['error']['captcha_img'])
			create_pub_params.update({'captcha_sid' : createpubanswer['error']['captcha_sid'],'captcha_key' : capkey})
			
			createpubanswer = requests.get('https://api.vk.com/method/groups.create', params=create_pub_params, proxies=proxies).json()

		else:
			print ('unknown error')
			print (createpubanswer)

	pubid = createpubanswer['response']['gid']
	print ('pub created, link: https://vk.com/club{}'.format(pubid))

	return pubid
コード例 #5
0
ファイル: jo.py プロジェクト: hiddenzed/vkpub
def thread_(access_token, proxies):
    url = 'https://api.vk.com/method/'

    closed_pubs = []
    open_pubs = []

    with open('modules/closed.txt', 'r') as file:
        for line in file:
            closed_pubs.append(line.strip())

    with open('modules/open.txt', 'r') as file:
        for line in file:
            open_pubs.append(line.strip())

    shuffle(closed_pubs)
    shuffle(open_pubs)

    base = closed_pubs[0:40] + open_pubs[0:15]
    shuffle(base)

    s = r.session()
    for pub in base:
        joinparams = {
            'access_token': access_token,
            'version': '5.73',
            'group_id': pub
        }

        try:
            result = s.get(url + 'groups.join',
                           params=joinparams,
                           proxies=proxies).json()

        except:
            sleep(4)

        if 'response' in result:
            if result['response'] == 1:
                pass

        elif 'error' in result:
            if result['error']['error_code'] == 14:
                print('captcha needed')
                capkey = c.main(result['error']['captcha_img'])

                joincaptchaparams = {
                    'access_token': access_token,
                    'version': '5.73',
                    'group_id': line.strip(),
                    'captcha_sid': result['error']['captcha_sid'],
                    'captcha_key': capkey
                }

                s.get(url + 'groups.join',
                      params=joincaptchaparams,
                      proxies=proxies).json()

        sleep(randint(7, 20))
コード例 #6
0
ファイル: jo.py プロジェクト: hiddenzed/phantomvk
def way (access_token, proxies):
	closed_pubs = []
	open_pubs   = []

	with open ('closed.txt', 'r') as file:
		for line in file:
			closed_pubs.append (line.strip ())

	with open ('open.txt', 'r') as file:
		for line in file:
			open_pubs.append (line.strip ())

	random.shuffle (closed_pubs)
	random.shuffle (open_pubs)    


	base = closed_pubs [0:18] + open_pubs [0:75]
	random.shuffle (base)

	s = r.session()

	for pub in base:
		joinparams = {
			'access_token': access_token,
			'version'     : '5.80',
			'group_id'    : pub}
		
		try:
			result = s.get('https://api.vk.com/method/groups.join', params=joinparams, proxies=proxies).json()

		except:
			sleep (4)

		if 'error' in result:
			if result ['error']['error_code'] == 14:
				print ('error: captcha needed')

				capkey = captcha.main (result ['error']['captcha_img'])

				joincaptchaparams = {
					'access_token': access_token,
					'version'     : '5.80',
					'group_id'    : line.strip (),
					'captcha_sid' : result ['error']['captcha_sid'],
					'captcha_key' : capkey}

				s.get ('https://api.vk.com/method/groups.join', params=joincaptchaparams, proxies=proxies).json ()
		
		time.sleep (random.randint (7, 20))
コード例 #7
0
ファイル: func.py プロジェクト: hiddenzed/vkpub
def join_pubs(access_token, proxies):
	closed_pubs = []
	open_pubs   = []

	with open ('closed.txt', 'r') as file:
		for line in file:
			closed_pubs.append(line.strip())

	with open ('open.txt', 'r') as file:
		for line in file:
			open_pubs.append(line.strip())

	shuffle (closed_pubs)
	shuffle (open_pubs)


	base = closed_pubs[0:30] + open_pubs[0:30]
	shuffle (base)

	for pub in base:
		joinparams = {
			'access_token': access_token,
			'version'     : '5.73',
			'group_id'    : pub
		}

		result = r.get(url + 'groups.join', params=joinparams, proxies=proxies).json()

		if 'response' in result:
			if result['response'] == 1:
				print ('join request added to community', pub)

		elif 'error' in result:
			if result['error']['error_code'] == 14:
				print ('captcha needed')
				capkey = cap.main(result['error']['captcha_img'])

				joincaptchaparams = {
					'access_token': access_token,
					'version'     : '5.73',
					'group_id'    : line.strip(),
					'captcha_sid' : result['error']['captcha_sid'],
					'captcha_key' : capkey
				}

				print (r.get(url + 'groups.join', params=joincaptchaparams, proxies=proxies).json())

		sleep(randint(7, 40))
コード例 #8
0
    def createcomment(a, s, p, m):
        params = {
            'access_token': a[0],
            'version': '5.78',
            'owner_id': p[0],
            'post_id': p[1],
            'message': m[0],
            'sticker_id': m[1]
        }

        z = s.get('https://api.vk.com/method/wall.createComment',
                  params=params,
                  proxies=a[1])

        if 'error' in z.json():
            if z.json()['error']['error_code'] == 14:
                print('captcha')

                capkey = captcha.main(z.json()['error']['captcha_img'])
                params.update({
                    'captcha_sid': z.json()['error']['captcha_sid'],
                    'captcha_key': capkey
                })
                z = s.get('https://api.vk.com/method/wall.createComment',
                          params=params,
                          proxies=a[1])

            elif z.json()['error']['error_code'] == 213:
                print('error: banned in the group, leaving it')

                params = {
                    'group_id': -p[0],
                    'access_token': a[0],
                    'version': '5.80'
                }

                print(
                    s.get('https://api.vk.com/method/groups.leave',
                          params=params,
                          proxies=a[1]).json())

        print(z.json())
コード例 #9
0
ファイル: vkapi.py プロジェクト: hiddenzed/vktest
def userAdd(access_token, proxies, user_id, myid='1'):
    params = {'access_token': access_token, 'v': '5.80', 'user_id': user_id}

    response = requests.get('https://api.vk.com/method/friends.add',
                            params=params,
                            proxies=proxies).json()

    if 'error' in response:
        if response['error']['error_code'] == 14:
            capkey = captcha.main(response['error']['captcha_img'], myid)

            params.update({
                'captcha_sid': response['error']['captcha_sid'],
                'captcha_key': capkey
            })

            response = requests.get('https://api.vk.com/method/friends.add',
                                    params=params,
                                    proxies=proxies).json()

            return 'captcha'

        elif response['error']['error_code'] == 177:
            params = {
                'access_token': access_token,
                'v': '5.80',
                'owner_id': user_id
            }
            resp = requests.get('https://api.vk.com/method/account.ban',
                                params=params,
                                proxies=proxies).json()

            return 'not found'

        elif response['error']['error_code'] == 1:
            return 'unknown error'

        else:
            return response

    else:
        return 'ok'
コード例 #10
0
 def test_filtered(self):
     """retirn sum as intered"""
     print("id: " + self.id())
     self.assertIsInstance(captcha.main(), int)
コード例 #11
0
ファイル: vkapi.py プロジェクト: hiddenzed/vktest
def wallComment(access_token,
                proxies,
                owner_id,
                post_id,
                message=None,
                attachments=None,
                myid='1'):
    params = {
        'access_token': access_token,
        'v': '5.80',
        'owner_id': owner_id,
        'post_id': post_id
    }

    if attachments != None:
        params.update({'attachments': attachments})

    if message != None:
        params.update({'message': message})

    response = requests.get('https://api.vk.com/method/wall.createComment',
                            params=params,
                            proxies=proxies)

    try:
        response = response.json()

        if 'error' in response:
            if response['error']['error_code'] == 14:
                capkey = captcha.main(response['error']['captcha_img'], myid)

                params.update({
                    'captcha_sid': response['error']['captcha_sid'],
                    'captcha_key': capkey
                })

                response = requests.get(
                    'https://api.vk.com/method/wall.createComment',
                    params=params,
                    proxies=proxies).json()

                return 'captcha'

            elif response['error']['error_code'] == 213:
                params = {
                    'group_id': -owner_id,
                    'access_token': access_token,
                    'v': '5.80'
                }

                requests.get('https://api.vk.com/method/groups.leave',
                             params=params,
                             proxies=proxies).json()

                return 'banned in group'

            elif response['error']['error_code'] == 10:
                return 'internal server error'

        else:
            cid = response['response']['comment_id']
            return f'ok {cid}'

    except:
        try:
            return response.json()

        except:
            return response