KevinFire2030 / Fire2025

0 stars 0 forks source link

18.1 자동 로그인 #1

Open KevinFire2030 opened 1 year ago

KevinFire2030 commented 1 year ago

image

image

image

image

고객 ID

image

비밀번호

image

인증비밀번호

image

로그인

image

KevinFire2030 commented 1 year ago

(py39_32) D:\Fire2025\23W23>pip install pywinauto Collecting pywinauto Using cached pywinauto-0.6.8-py2.py3-none-any.whl (362 kB) Collecting pywin32 Downloading pywin32-306-cp39-cp39-win32.whl (8.6 MB) |████████████████████████████████| 8.6 MB 6.4 MB/s Collecting comtypes Downloading comtypes-1.2.0-py2.py3-none-any.whl (184 kB) |████████████████████████████████| 184 kB 6.8 MB/s Requirement already satisfied: six in d:\anaconda3\envs\py39_32\lib\site-packages (from pywinauto) (1.16.0) Installing collected packages: pywin32, comtypes, pywinauto Successfully installed comtypes-1.2.0 pywin32-306 pywinauto-0.6.8

KevinFire2030 commented 1 year ago

image

KevinFire2030 commented 1 year ago

PyQt5 와 pywinauto 는 함께 사용 못함 (삽질)

image

KevinFire2030 commented 1 year ago

(py39_32) D:\Fire2025\23W23>pip install win32gui Collecting win32gui Downloading win32gui-221.5.tar.gz (605 kB) |████████████████████████████████| 605 kB 3.3 MB/s Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: 'D:\Anaconda3\envs\py39_32\python.exe' 'D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py' get_requires_for_build_wheel 'C:\Users\Public\Documents\ESTs oft\CreatorTemp\tmp2fpz7b62' cwd: C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-install-homoz2i5\win32gui_4b7f23eb98244cbea5529aaaec937d60 Complete output (19 lines): Traceback (most recent call last): File "D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 349, in main() File "D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 331, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 117, in get_requires_for_build_wheel return hook(config_settings) File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-jl9fb11t\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-jl9fb11t\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires self.run_setup() File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-jl9fb11t\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup super(_BuildMetaLegacyBackend, File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-jl9fb11t\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup exec(code, locals()) File "", line 27, in File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-install-homoz2i5\win32gui_4b7f23eb98244cbea5529aaaec937d60\win32\distutils\gui.py", line 6, in from .command import win32_build_ext ModuleNotFoundError: No module named 'win32.distutils.command'

WARNING: Discarding https://files.pythonhosted.org/packages/b8/75/7bed82934e51903f9d48b26b3996161bb2dce1731607b4bb7fd26003ed3e/win32gui-221.5.tar.gz#sha256=b2be0885d526d70b3f9a62f4005e9452cdb4bce67e117f 4c14e7aa684bc5b2a5 (from https://pypi.org/simple/win32gui/). Command errored out with exit status 1: 'D:\Anaconda3\envs\py39_32\python.exe' 'D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep51 7\in_process_in_process.py' get_requires_for_build_wheel 'C:\Users\Public\Documents\ESTsoft\CreatorTemp\tmp2fpz7b62' Check the logs for full command output. Downloading win32gui-221.4.tar.gz (605 kB) |████████████████████████████████| 605 kB 6.8 MB/s Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: 'D:\Anaconda3\envs\py39_32\python.exe' 'D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py' get_requires_for_build_wheel 'C:\Users\Public\Documents\ESTs oft\CreatorTemp\tmph6_rzsq6' cwd: C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-install-homoz2i5\win32gui_255623e4666a4528960a8465567440e5 Complete output (19 lines): Traceback (most recent call last): File "D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 349, in main() File "D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 331, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 117, in get_requires_for_build_wheel return hook(config_settings) File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-edbg8a8n\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-edbg8a8n\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires self.run_setup() File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-edbg8a8n\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup super(_BuildMetaLegacyBackend, File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-edbg8a8n\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup exec(code, locals()) File "", line 26, in File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-install-homoz2i5\win32gui_255623e4666a4528960a8465567440e5\win32\distutils\gui.py", line 6, in from win32.distutils.command import win32_build_ext ModuleNotFoundError: No module named 'win32.distutils.command'

WARNING: Discarding https://files.pythonhosted.org/packages/82/93/e3908020a82c2a628ecc05faad79aa947f22eee672f272622ca7ad4d7bf3/win32gui-221.4.tar.gz#sha256=91d1df0a00c8dbbc82bfd8a04039bd26a96d2119307ceb 695d1b356f478cecee (from https://pypi.org/simple/win32gui/). Command errored out with exit status 1: 'D:\Anaconda3\envs\py39_32\python.exe' 'D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep51 7\in_process_in_process.py' get_requires_for_build_wheel 'C:\Users\Public\Documents\ESTsoft\CreatorTemp\tmph6_rzsq6' Check the logs for full command output. Downloading win32gui-221.3.tar.gz (614 kB) |████████████████████████████████| 614 kB 6.4 MB/s Installing build dependencies ... done Getting requirements to build wheel ... error ERROR: Command errored out with exit status 1: command: 'D:\Anaconda3\envs\py39_32\python.exe' 'D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py' get_requires_for_build_wheel 'C:\Users\Public\Documents\ESTs oft\CreatorTemp\tmp7al1p30c' cwd: C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-install-homoz2i5\win32gui_27b53dd5f325440594179c70a4da8108 Complete output (19 lines): Traceback (most recent call last): File "D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 349, in main() File "D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 331, in main json_out['return_val'] = hook(**hook_input['kwargs']) File "D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep517\in_process_in_process.py", line 117, in get_requires_for_build_wheel return hook(config_settings) File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-uw95w8pk\overlay\Lib\site-packages\setuptools\build_meta.py", line 341, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-uw95w8pk\overlay\Lib\site-packages\setuptools\build_meta.py", line 323, in _get_build_requires self.run_setup() File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-uw95w8pk\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup super(_BuildMetaLegacyBackend, File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-build-env-uw95w8pk\overlay\Lib\site-packages\setuptools\build_meta.py", line 338, in run_setup exec(code, locals()) File "", line 26, in File "C:\Users\Public\Documents\ESTsoft\CreatorTemp\pip-install-homoz2i5\win32gui_27b53dd5f325440594179c70a4da8108\win32\distutils\gui.py", line 6, in from win32.distutils.command import win32_build_ext ModuleNotFoundError: No module named 'win32.distutils.command'

WARNING: Discarding https://files.pythonhosted.org/packages/58/d8/727d452ea900aa4be08b0e264e4a12d1f04e51b60f46ce01e0996f071f85/win32gui-221.3.tar.gz#sha256=d6ebe58330480bde71ad93c0e67b31b58ec6091e281d94 4f1cb529f4e9611c00 (from https://pypi.org/simple/win32gui/). Command errored out with exit status 1: 'D:\Anaconda3\envs\py39_32\python.exe' 'D:\Anaconda3\envs\py39_32\lib\site-packages\pip_vendor\pep51 7\in_process_in_process.py' get_requires_for_build_wheel 'C:\Users\Public\Documents\ESTsoft\CreatorTemp\tmp7al1p30c' Check the logs for full command output. ERROR: Could not find a version that satisfies the requirement win32gui (from versions: 221.3, 221.4, 221.5) ERROR: No matching distribution found for win32gui

(py39_32) D:\Fire2025\23W23>pip install win32api ERROR: Could not find a version that satisfies the requirement win32api (from versions: none) ERROR: No matching distribution found for win32api

KevinFire2030 commented 1 year ago

No module named 'win32gui' 에러 zeen263·2023년 3월 28일

https://velog.io/@zeen263/No-module-named-win32gui-%EC%97%90%EB%9F%AC

(py39_32) D:\Fire2025\23W23>pip install pywin32==225 Collecting pywin32==225 Downloading pywin32-225-cp39-cp39-win32.whl (8.3 MB) |████████████████████████████████| 8.3 MB 598 kB/s Installing collected packages: pywin32 Attempting uninstall: pywin32 Found existing installation: pywin32 306 Uninstalling pywin32-306: Successfully uninstalled pywin32-306 ERROR: Could not install packages due to an OSError: [WinError 5] 액세스가 거부되었습니다: 'D:\Anaconda3\envs\py39_32\Lib\site-packages\~ywin32_system32\pythoncom39.dll' Consider using the --user option or check the permissions.

(py39_32) D:\Fire2025\23W23>pip install --user pywin32==225
Requirement already satisfied: pywin32==225 in d:\anaconda3\envs\py39_32\lib\site-packages (225)

KevinFire2030 commented 1 year ago

D:\Anaconda3\envs\py39_32\python.exe "C:/Program Files/JetBrains/PyCharm Community Edition 2022.3.2/plugins/python-ce/helpers/pydev/pydevd.py" --multiprocess --qt-support=auto --client 127.0.0.1 --port 52035 --file D:\Fire2025\23W23\book\ch18\18.1-3.py Connected to pydev debugger (build 223.8617.48) 로그인 창 대기 ... 로그인 창 대기 ... 로그인 대기: 120 로그인 대기: 119 로그인 대기: 118 로그인 대기: 117 로그인 대기: 116 로그인 대기: 115 로그인 대기: 114 로그인 대기: 113

[GetPCIdentity] VER 3.2.0.0 build 2015.8.12

[GetPCIdentity] VER 3.2.0.0 build 2015.8.12 로그인 대기: 112 버전처리 완료

Process finished with exit code 0

KevinFire2030 commented 1 year ago

C:\Users\ih15h>python D:\Fire2025\23W23\book\ch18\18.1-4.py KiwoomAuto

C:\Users\ih15h>python D:\Fire2025\23W23\book\ch18\18.1-3.py Traceback (most recent call last): File "D:\Fire2025\23W23\book\ch18\18.1-3.py", line 3, in from PyQt5.QtWidgets import * ModuleNotFoundError: No module named 'PyQt5'

C:\Users\ih15h>D:\Anaconda3\envs\py39_32\python D:\Fire2025\23W23\book\ch18\18.1-4.py KiwoomAuto

C:\Users\ih15h>D:\Anaconda3\envs\py39_32\python D:\Fire2025\23W23\book\ch18\18.1-3.py 로그인 창 대기 ... 로그인 창 대기 ... Traceback (most recent call last): File "D:\Fire2025\23W23\book\ch18\18.1-3.py", line 201, in version("iami15", "hoya1515", "hoya1515!!") File "D:\Fire2025\23W23\book\ch18\18.1-3.py", line 152, in version click_button(btn_login) File "D:\Fire2025\23W23\book\ch18\18.1-3.py", line 60, in click_button win32api.PostMessage(btn_hwnd, win32con.WM_LBUTTONDOWN, 0, 0) pywintypes.error: (5, 'PostMessage', '액세스가 거부되었습니다.')

KevinFire2030 commented 1 year ago

관리자 권한으로 run.bat 실행하기

https://jinseongsoft.tistory.com/194

@echo off

:: BatchGotAdmin
:-------------------------------------
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    set params = %*:"=""
    echo UAC.ShellExecute "cmd.exe", "/c %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    del "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    pushd "%CD%"
    CD /D "%~dp0"

D:\Anaconda3\envs\py39_32\python D:\Fire2025\23W23\book\ch18\18.1-3.py
KevinFire2030 commented 1 year ago

image

image

image

image

image

KevinFire2030 commented 1 year ago

힘빼기, 선우와 태어날 선우 동생을 위해, 선우에게 설명한다 물려준다는 느낌으로

KevinFire2030 commented 1 year ago

로그인 창 대기 로그인 창 대기 로그인 대기: 120 로그인 대기: 119 로그인 대기: 118 로그인 대기: 117 로그인 대기: 116 로그인 대기: 115 로그인 대기: 114 로그인 대기: 113 로그인 대기: 112 버전처리 완료

KevinFire2030 commented 1 year ago

[답변] 자동 계좌 비밀번호 입력 문의

안타까운 마음에 도움을 드리려고 합니다.

같은 문제로 며칠 고민하다 찾은 내용입니다. 파이썬 사용자이신듯 하니 금방 이해하리라 생각합니다.

import pyautogui # 라이브러리 호출 import win32gui import win32con import win32api

self.dynamicCall("GetCommonFunc(QString, QString)", "ShowAccountWindow", "") # 계좌번호 입력창을 띄우는 내부함수 중간 생략 def window_enumeration_handler(hwnd, top_windows): top_windows.append((hwnd, win32gui.GetWindowText(hwnd)))

def enum_windows(): windows = [] win32gui.EnumWindows(window_enumeration_handler, windows) return windows

def find_window(caption): hwnd = win32gui.FindWindow(None, caption) if hwnd == 0: windows = enum_windows() for handle, title in windows: if caption in title: hwnd = handle break return hwnd 중간 생략 hwnd = find_window("계좌번호관리") #계좌번호관리 창의 핸들 찾기 rect = win32gui.GetWindowRect(hwnd) #계좌번호관리 창의 좌상단 좌표 찾기 pyautogui.click(rect[0]+104,rect[1]+72)#나열된 계좌번호 중 처번째 클릭 edit_account = win32gui.GetDlgItem(hwnd, 0x3EA) #계좌번호 클릭시 나타나는 좌하단 계좌번호 표시 edit의 핸들 얻기
edit_pw2 = win32gui.GetDlgItem(hwnd, 0x3E9) #계좌암호 edit의 핸들 얻기 user_account = win32gui.GetWindowText(edit_account) #계좌번호 읽어들이기 win32gui.SendMessage(edit_pw2, win32con.WM_SETTEXT, 0, user_pw2) #계좌암호 user_pw2 입력


핵심만 적어 놓았습니다. 이해가 안되시면 koolsg@naver.com로 문의 주세요

KevinFire2030 commented 1 year ago

image

image

저장 image

일괄저장 image

닫기

image

계좌리스트 image

비밀번호 image

KevinFire2030 commented 1 year ago

https://springcoming.tistory.com/141

image

KevinFire2030 commented 1 year ago

봄이오네

https://springcoming.tistory.com/141

image