Giter VIP home page Giter VIP logo

captchouli's People

Contributors

avdb13 avatar bakape avatar chiya-chan avatar kamuso avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

captchouli's Issues

Allow non-safe images

What is wrong when I try to use tag kissxsis and it does this indefinitely and I want to be able to use non-work safe images too?

2019/12/27 07:06:58 captchouli: initializing tag=kissxsis explicitness=[safe, questionable, explicit]
fetch attempt: 3290540

C++ code sometimes crashes dues to an assert

OpenCV(3.4.3) /var/tmp/portage/media-libs/opencv-3.4.3/work/opencv-3.4.3/modules/imgproc/src/color.cpp:181: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor'

Panic when initializing tag database

I've been using captchouli for a while with the following Dockerfile, and it's worked great:

FROM debian:buster-slim
# install prereqs
RUN apt-get update
RUN apt-get install -y golang libopencv-dev
RUN apt-get install -y git
# grab utils for bootstrapping watcher
RUN apt-get install -y netcat-openbsd psmisc
# make a new user so we don't run as root
RUN useradd -r captchouli
WORKDIR /home/captchouli
RUN chown -R captchouli /home/captchouli
# preemptively make the supporting directory so docker won't
# attempt to make a new directory owned by root (aids when
# attempting to persist .captchouli)
RUN mkdir -p .captchouli/images
RUN chown -R captchouli .captchouli
# install captchouli
USER captchouli
RUN go get github.com/bakape/captchouli/cmd/captchouli
# setup entrypoint and port
COPY entrypoint.sh .
COPY captchouli.sh .
EXPOSE 8512
# entrypoint switches back to the captchouli user but needs to
# start with root privileges
USER root
ENTRYPOINT ["sh", "./entrypoint.sh"]

(There's also captchouli.sh and entrypoint.sh, but they're small shell scripts and don't really do much beyond handle startup.)

Lately, I tried to rebuild my captchouli container and got the following message when initializing the tag database (with me exiting the container on the last two lines, and the first line stemming from captchouli.sh):

Waiting for captchouli to finish bootstrapping...
2020/05/05 12:35:04 captchouli: upgrading database to version 1
2020/05/05 12:35:04 captchouli: upgrading database to version 2
2020/05/05 12:35:04 captchouli: upgrading database to version 3
2020/05/05 12:35:04 captchouli: upgrading database to version 4
2020/05/05 12:35:04 captchouli: initializing tag=izayoi_sakuya explicitness=[safe, questionable, explicit]

fetch attempt: 1	panic: captchouli: error initializing image pool for tag `izayoi_sakuya`: &{%!w(string=number) %!w(*reflect.rtype=&{1 0 335480517 7 1 1 129 0xbe4ec0 0x93b6c1 9448 169216}) %!w(int64=306) %!w(string=gelbooruDecoder) %!w(string=Sample)}

goroutine 1 [running]:
main.main()
	/home/captchouli/go/src/github.com/bakape/captchouli/cmd/captchouli/main.go:52 +0x307
^C
Session terminated, killing shell... ...killed.

Now, I realized I had the prerequisites for captchouli still directly installed on my Debian Sid machine, and so I re-installed captchouli on my laptop without any containers to see what would happen, and got the following message:

2020/05/05 07:33:59 captchouli: upgrading database to version 1
2020/05/05 07:33:59 captchouli: upgrading database to version 2
2020/05/05 07:33:59 captchouli: upgrading database to version 3
2020/05/05 07:33:59 captchouli: upgrading database to version 4
2020/05/05 07:33:59 captchouli: initializing tag=senjougahara_hitagi explicitness=[safe]

fetch attempt: 1	panic: captchouli: error initializing image pool for tag `senjougahara_hitagi`: json: cannot unmarshal number into Go struct field gelbooruDecoder.Sample of type bool

goroutine 1 [running]:
main.main()
	/home/kermit/projects/go/src/github.com/bakape/captchouli/cmd/captchouli/main.go:52 +0x3ee

Any idea as to what the problem might be?

I bypassed the captcha . sneed

Useless now lol

  1. first scrap all of the waifus
  2. find the md5 hash - by manually looking at the folder
  3. once you have a waifu just loop until you find the waifu and match the md5
import requests as req
from bs4 import BeautifulSoup
from PIL import Image
import re, base64
from io import BytesIO
import hashlib
import concurrent.futures as porn
import time, string, random
def ran_str(string_length):
  input = string.ascii_lowercase + string.digits
  return ''.join(random.choice(input) for i in range(string_length))

sneed1 = []
headers = {
    'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8',
    'Accept-Language': 'en-US,en;q=0.5',
    'Accept-Encoding': 'gzip, deflate, br',
        
    'Origin': 'https://midov.pl',
    'DNT': '1',
    'Connection': 'keep-alive',
    # 'Referer': 'https://midov.pl/registerform.sh',
    'Upgrade-Insecure-Requests': '1',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'same-origin',
    'Sec-Fetch-User': '?1',
    'Pragma': 'no-cache',
    'Cache-Control': 'no-cache',
    # Requests doesn't support trailers
    # 'TE': 'trailers',
}


answers = {
    'liru': ['a67db0fc66aedba7e028a7da4999d67b','4cfe005813df6d8ce6847c9b2274f599','52351b9999f67c5e92c76c381bd4ffd7'],
    'rem': ['c0c13825e8f35dcb36fab7ee5bc8f670','68e2750d81d48c6f1ac450ed24b5d601']
}

def send_post(data):
    res = req.post('https://midov.pl/registerform.sh', headers=headers, data=data)
    # print(res.text)
    soup = BeautifulSoup(res.text, "html.parser")
    captcha = soup.find_all('input', {'name':'captcha'})[0]['value']
    # print(captcha)

    u_name = ran_str(9)
    p_word = ran_str(9)
    data2 = {
        'login': u_name,
        'password': p_word,
        'passwordagain': p_word,
        'captcha': captcha,
    }
    # print(data2)

    res = req.post('https://midov.pl/do-register.sh', headers=headers, data=data2)
    if "You need to know the animu girls better." in res.text:
        None
        # print("Failure")
    elif "Success!" in res.text:
        print(res.text)
        with open("accounts.kek", 'a') as f:
            f.write(f"{u_name}:{p_work}\n")
    else:
        print(res.text)
def sneed(i):
    # for x in range(1):
    while True:
        res = req.get("https://midov.pl/registerform.sh", headers=headers)
        soup = BeautifulSoup(res.text, "html.parser")
        img_list = soup.find_all('img')
        label = soup.find_all('b')[0].text.lower()
        captchouli_id = soup.find_all('input', {'name':'captchouli-id'})[0]['value']
        captchouli_color = soup.find_all('input', {'name':'captchouli-color'})[0]['value']
        captchouli_background = soup.find_all('input', {'name':'captchouli-background'})[0]['value']
        # if not "rem" in label:
            # continue
        if "liru" != label:
            time.sleep(2)
            continue
        print(label)

        data_dict_to_send = {
            'captchouli-id': captchouli_id,
            'captchouli-color': captchouli_color,
            'captchouli-background': captchouli_background,
        }
        for i in range(len(img_list)):
            image_bytes = img_list[i]['src']
            md5_img = hashlib.md5(
                image_bytes.encode('utf-8')).hexdigest()
            
            # print(i, md5_img)
            # if md5_img in answers["rem"]:
            if md5_img in answers[label]:
                # print("in DB",i, md5_img)
                data_dict_to_send[f'captchouli-{i}'] = 'on'
        print(data_dict_to_send)
        send_post(data_dict_to_send)

        break
        

    
sneed(1)

MVP feature set

https://github.com/hybridgroup/gocv
https://github.com/nagadomi/lbpcascade_animeface

Ideas:

  • 3x3 grid

  • 2-3 images match (cryptographically random)

  • 6-7 images are from other tags from the array

    • at least 3 tags have to be input per service
  • performance:

    • to reduce blocking don't fetch new images on captcha generation but schedule a new image fetch (if not already scheduled)
      • if image count in category below 10 on start, download more
    • Do OpenCV stuff in C++ and avoid copying from Go
    • store cache on disk with max size (bytes) and LRC pruning
    • Store all images as 80 quality JPEG
  • make it work 100% noscript

    • possible usability improvements
  • separate library

    • include API server for easy deployment
    • encapsulate inside struct to allow multiple concurrent configurations

Port to Postgres

Provides better performance and multithreading support.

  • Generate captcha in one call using plpgsql returning a set of bytea and pgcrypto
  • Allow specifying captcha ID in creation call
  • Store files as gzipped buffers in DB

Create adversarial net to bot-test the captcha

assuming that you have a large corpus of (image, character name) data, you should be able to plug that into an off-the-shelf ML lib and get a model that solves the current captchas.
from there, apply filters to the images, retrain your solver, and repeat until you can no longer train the solver with decent accuracy.

Setting it up on my server

Hey,

I'm looking to integrate captchouli into my ViChan fork. I was impressed by it when I went on meguca and want to involve it in my efforts.

How do I go about using it on my site?
Something like, you run main.go and it listens on a port for you to send post requests?
Which files am I supposed to look at to understand setting it up on the client side?

Time limited captcha

Prevents googling the name.
Also having more than say 6 captchas go past the time limit would trigger ban, but that might be a meguca issue.
Anyway, two ways to fail, user fail and time limit fail, user fail is normal limit, time limit is normal times 2 perhaps.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.