Skip to content
조회 수 19022 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

파이썬으로 captCha 분석하여 웹사이트 소스 가져오기

 

파이썬으로 captCha 분석 프로그램을 만들 수 있습니다.

그러나 captCha 분석은 비교적 복잡한 작업이며, 다양한 알고리즘과 기술이 필요합니다.

일반적으로 이미지 처리 및 인공지능 분야에서 활용되는 기술들을 사용하여 captCha 분석 프로그램을 개발합니다.

따라서, 만약 captCha 분석에 대한 경험이 부족하다면, 이미지 처리 및 인공지능 분야에서의 기술 및 알고리즘에 대한 학습이 필요할 수 있습니다.

그러나 Python은 이미지 처리 및 인공지능 분야에서 널리 사용되는 언어 중 하나이며, 다양한 라이브러리 및 프레임워크가 제공되고 있기 때문에 이러한 작업을 수행하는 데 사용할 수 있습니다.

이미지 처리에는 Pillow, OpenCV, Scikit-image 등의 라이브러리가 있으며, 인공지능 분야에는 TensorFlow, PyTorch, Keras 등의 프레임워크가 있습니다.

이러한 라이브러리 및 프레임워크를 사용하여 captCha 분석 프로그램을 구현할 수 있습니다.


 

import requests
from PIL import Image
import io
import pytesseract
 
# 테써렉트 위치
pytesseract.pytesseract.tesseract_cmd = r'G:/tesseract/tesseract.exe'
 
# 캡차 이미지 URL
captcha_url = 'https://chuksaro.nias.go.kr/hanwoori/captchaImg.do'
 
# 세션 생성
session = requests.Session()
 
# 인증서 다운로드
cert_url = 'https://www.nia.or.kr/common/key/nia-ca.crt'
cert_file = 'nia-ca.crt'
response = session.get(cert_url)
 
with open(cert_file, 'wb') as f:
    f.write(response.content)
 

# 캡차 이미지 다운로드
#response = session.get(captcha_url, verify=cert_file)

 
# 캡차 이미지 다운로드 개무시하기
 
response = session.get(captcha_url, verify=False) #인증서 검증을 비활성화하는 방법
 
# 캡차 이미지 다운로드 인증서 설치하기
#cert_file = "C:/python/py_code/automouse/ssl/_.nias.go.kr.crt"
#response = session.get(captcha_url, verify=cert_file)#신뢰할 수 있는 인증서를 설치하는 방법

captcha_img = Image.open(io.BytesIO(response.content))
 
# 캡차 이미지 처리
captcha_img = captcha_img.convert('L')
threshold = 127
table = []
for i in range(256):
    if i < threshold:
        table.append(0)
    else:
        table.append(1)
captcha_img = captcha_img.point(table, '1')
 
# pytesseract를 사용하여 캡차 이미지에서 텍스트 추출
captcha_text = pytesseract.image_to_string(captcha_img, config='--psm 10')

# 검색어 입력 폼에 값을 입력하여 검색
search_url = 'https://chuksaro.nias.go.kr/hanwoori/cowCntcInfo.do'
search_keyword = '002xxxxxxx'
response = session.post(search_url, data={'answer': captcha_text, 'search_keyword': search_keyword}, verify=cert_file)

with open('C:/python/py_code/automouse/result.txt', 'w', encoding='utf-8') as f:
    f.write(response.text)
   
# 검색 결과 출력
print(response.text)

 

 

 

 

로그인 후 댓글쓰기가 가능합니다.

?

  1. 13
    Nov 2023
    05:45

    파이썬 requestsbeautifulsoup 으로 웹 input에 입력값 대입한 뒤 결과값 파일로 저장하기

    Category파이썬 Views63689
    Read More
  2. 04
    Oct 2023
    23:33

    파이썬 랜덤으로 문제풀기 #2

    Category파이썬 Views75903
    Read More
  3. 04
    Oct 2023
    23:29

    파이썬 랜덤으로 시험문제 풀기

    Category파이썬 Views72274
    Read More
  4. 15
    Sep 2023
    14:04

    파이썬에서 인식이 잘되는 OCR 종류

    Category파이썬 Views76369
    Read More
  5. 14
    Sep 2023
    22:34

    한우경매낙찰 유튜브 영상의 이미지에서 특정 문자 가져와서 저장하기

    Category파이썬 Views75753
    Read More
  6. 07
    May 2023
    04:17

    python AttributeError: 'WebDriver' object has no attribute 'find_element_by_css_selector' 해결방법

    Category파이썬 Views47497
    Read More
  7. 21
    Apr 2023
    20:10

    DiffusionWrapper has 859.52 M params.

    Category파이썬 Views37378
    Read More
  8. 25
    Mar 2023
    12:40

    파이썬으로 captCha 분석하여 웹사이트 소스 가져오기

    Category파이썬 Views19022
    Read More
  9. 25
    Mar 2023
    09:40

    파이썬에서 captCha 분석 프로그램을 만들 수 있을까?

    Category파이썬 Views11722
    Read More
  10. 15
    Mar 2023
    04:01

    웹 페이지에서 동적으로 생성되는 데이터 가져오는 방법

    Category파이썬 Views6937
    Read More
  11. 10
    Mar 2023
    14:33

    네이버 주식의 기업정보와 펀더멘탈정보 소스 가져오기

    Category파이썬 Views3366
    Read More
  12. 10
    Mar 2023
    14:09

    네이버 주식에서 종목의 투자정보 자료 가져오기

    Category파이썬 Views2244
    Read More
  13. 04
    Mar 2023
    08:47

    파이썬 변수가 정의되었는지 여부 확인방법코드

    Category파이썬 Views3982
    Read More
  14. 04
    Mar 2023
    08:39

    python class def

    Category파이썬 Views2366
    Read More
  15. 25
    Feb 2023
    12:36

    파이썬 비활성화 된 창 활성화 시키기

    Category파이썬 Views3550
    Read More
  16. 25
    Feb 2023
    12:03

    파이썬으로 비활성화 된 창의 이미지를 캡쳐하는 방법

    Category파이썬 Views3961
    Read More
  17. 24
    Feb 2023
    07:12

    파이썬 비활성화 창 이미지 캡쳐하고 클릭하기

    Category파이썬 Views3978
    Read More
  18. 21
    Feb 2023
    06:32

    파이썬 모듈 업그레이드 명령어

    Category파이썬 Views3628
    Read More
  19. 12
    Feb 2023
    21:16

    파이썬 pyautogui 자주쓰는 이미지 서치 def 지정하기

    Category파이썬 Views5249
    Read More
  20. 12
    Feb 2023
    21:13

    파이썬 pyautogui 화면에 여러개의 동일한 이미지가 있을 때 n번째 이미지 선택하기

    Category파이썬 Views5002
    Read More
Board Pagination Prev 1 2 3 Next
/ 3

http://urin79.com

우린친구블로그

sketchbook5, 스케치북5

sketchbook5, 스케치북5

나눔글꼴 설치 안내


이 PC에는 나눔글꼴이 설치되어 있지 않습니다.

이 사이트를 나눔글꼴로 보기 위해서는
나눔글꼴을 설치해야 합니다.

설치 취소