Skip to content

Commit 23b63f5

Browse files
updated lib, examples and readme
1 parent 0902094 commit 23b63f5

File tree

9 files changed

+480
-437
lines changed

9 files changed

+480
-437
lines changed

capy.rb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/ruby
2+
3+
# Imagetypers API test
4+
load "lib/imagetyperzapi.rb"
5+
6+
def test_api
7+
# grab token from https://imagetyperz.com
8+
access_token = "your_access_token"
9+
ita = ImageTyperzAPI.new(access_token)
10+
11+
# check account balance
12+
balance = ita.account_balance # get balance
13+
puts "Account balance: #{balance}" # print balance
14+
15+
# submit image captcha, and check for solution
16+
puts "Waiting for captcha to be solved..."
17+
d = {}
18+
d['pageurl'] = 'https://your-site.com'
19+
d['sitekey'] = 'Fme6hZLjuCRMMC3uh15F52D3uNms5c'
20+
# d['proxy'] = '126.45.34.53:123' # - HTTP proxy - optional
21+
# d['user_agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' # optional
22+
captcha_id = ita.submit_capy d
23+
response = nil
24+
while response == nil
25+
sleep 10
26+
response = ita.retrieve_response captcha_id
27+
end
28+
puts "Response: #{response}"
29+
end
30+
31+
def main
32+
begin
33+
test_api
34+
rescue => details
35+
puts "[!] Error occured: #{details}"
36+
end
37+
end
38+
39+
main

example.rb

Lines changed: 0 additions & 89 deletions
This file was deleted.

geetest.rb

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/ruby
2+
3+
# Imagetypers API test
4+
load "lib/imagetyperzapi.rb"
5+
6+
def test_api
7+
# grab token from https://imagetyperz.com
8+
access_token = "your_access_token"
9+
ita = ImageTyperzAPI.new(access_token)
10+
11+
# check account balance
12+
balance = ita.account_balance # get balance
13+
puts "Account balance: #{balance}" # print balance
14+
15+
# submit image captcha, and check for solution
16+
puts "Waiting for captcha to be solved..."
17+
d = {}
18+
d['domain'] = 'https://your-site.com'
19+
d['challenge'] = 'eea8d7d1bd1a933d72a9eda8af6d15d3'
20+
d['gt'] = '1a761081b1114c388092c8e2fd7f58bc'
21+
# d['proxy'] = '126.45.34.53:123' # - HTTP proxy - optional
22+
# d['user_agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' # optional
23+
captcha_id = ita.submit_geetest d
24+
response = nil
25+
while response == nil
26+
sleep 10
27+
response = ita.retrieve_response captcha_id
28+
end
29+
puts "Response: #{response}"
30+
end
31+
32+
def main
33+
begin
34+
test_api
35+
rescue => details
36+
puts "[!] Error occured: #{details}"
37+
end
38+
end
39+
40+
main

hcaptcha.rb

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/ruby
2+
3+
# Imagetypers API test
4+
load "lib/imagetyperzapi.rb"
5+
6+
def test_api
7+
# grab token from https://imagetyperz.com
8+
access_token = "your_access_token"
9+
ita = ImageTyperzAPI.new(access_token)
10+
11+
# check account balance
12+
balance = ita.account_balance # get balance
13+
puts "Account balance: #{balance}" # print balance
14+
15+
# submit image captcha, and check for solution
16+
puts "Waiting for captcha to be solved..."
17+
d = {}
18+
d['pageurl'] = 'https://your-site.com'
19+
d['sitekey'] = '1c7062c7-cae6-4e12-96fb-303fbec7fe4f'
20+
# d['proxy'] = '126.45.34.53:123' # - HTTP proxy - optional
21+
# d['user_agent'] = 'Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Firefox/60.0' # optional
22+
captcha_id = ita.submit_hcaptcha d
23+
response = nil
24+
while response == nil
25+
sleep 10
26+
response = ita.retrieve_response captcha_id
27+
end
28+
puts "Response: #{response}"
29+
end
30+
31+
def main
32+
begin
33+
test_api
34+
rescue => details
35+
puts "[!] Error occured: #{details}"
36+
end
37+
end
38+
39+
main

image.rb

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/ruby
2+
3+
# Imagetypers API test
4+
load "lib/imagetyperzapi.rb"
5+
6+
def test_api
7+
# grab token from https://imagetyperz.com
8+
access_token = "your_access_token"
9+
ita = ImageTyperzAPI.new(access_token)
10+
11+
# check account balance
12+
balance = ita.account_balance # get balance
13+
puts "Account balance: #{balance}" # print balance
14+
15+
# submit image captcha, and check for solution
16+
puts "Waiting for captcha to be solved..."
17+
captcha_id = ita.submit_image(image_path = 'captcha.jpg')
18+
# with optional image parameters
19+
# captcha_id = ita.solve_captcha(image_path = 'captcha.jpg', is_case_sensitive = true, is_math = true, is_phrase = true, digits_only = false, letters_only = true, min_length = 2, max_length = 5)
20+
captcha_text = ita.retrieve_response captcha_id
21+
puts "Response: #{captcha_text}"
22+
end
23+
24+
def main
25+
begin
26+
test_api
27+
rescue => details
28+
puts "[!] Error occured: #{details}"
29+
end
30+
end
31+
32+
main

0 commit comments

Comments
 (0)