본문으로 이동
주 메뉴
주 메뉴
사이드바로 이동
숨기기
둘러보기
대문
최근 바뀜
임의의 문서로
미디어위키 도움말
특수 문서 목록
lse
검색
검색
보이기
계정 만들기
로그인
개인 도구
계정 만들기
로그인
로그아웃한 편집자를 위한 문서
더 알아보기
기여
토론
코드해킹
편집하기
문서
토론
한국어
읽기
편집
원본 편집
역사 보기
도구
도구
사이드바로 이동
숨기기
동작
읽기
편집
원본 편집
역사 보기
일반
여기를 가리키는 문서
가리키는 글의 최근 바뀜
문서 정보
보이기
사이드바로 이동
숨기기
Hschoi2
(
토론
|
기여
)
님의 2025년 4월 25일 (금) 04:36 판
(
→
출력 제어
)
(
차이
)
← 이전 판
|
최신판
(
차이
) |
다음 판 →
(
차이
)
경고: 이 문서의 오래된 판을 편집하고 있습니다.
이것을 게시하면, 이 판 이후로 바뀐 모든 편집이 사라집니다.
경고:
로그인하지 않았습니다. 편집을 하면 IP 주소가 공개되게 됩니다.
로그인
하거나
계정을 생성하면
편집자가 사용자 이름으로 기록되고, 다른 장점도 있습니다.
스팸 방지 검사입니다. 이것을 입력하지
마세요
!
AI Agent를 이용한 코드 해킹 - 코드 분석이라는 이야기임. =LS GPT= LS GPT의 경우, 기업 라이선스 (혹은 재 라이선스) 제품 wrtn.ai 와 같은 회사에서, ai환경을 이용하고, 인터페이스 부분만 Teams 형태로 바꾼 것임. 실제로, 윈도우에서 보면, Chrome의 자동화로 검색됨. ==윈도우 핸들러 얻기== # LS GPT가 기동되는 상태에서, 윈도우 핸들러를 얻는다. # Objects로 창 내의 아이템을 확인한다. [[file:ls_gpt_03.jpg|400px]] * 코드 윈도우 title로 찾아서 윈도우 핸들러 얻기 <code> # find_ls_gpt.py import win32gui import pywinauto def window_enum_handler(hwnd, resultList): title = win32gui.GetWindowText(hwnd) resultList.append((hwnd, title)) def find_window_by_title(title_text): windows = [] win32gui.EnumWindows(window_enum_handler, windows) for hwnd, title in windows: if win32gui.IsWindowVisible(hwnd): print(f"HWND: {hwnd}, Title: {title}") if title_text in title: print(f"Found: HWND: {hwnd}, Title: {title}") def find_window_by_title_pywinauto(title): try: app = pywinauto.Application(backend="uia").connect(title=title) window = app.window(title=title) return window.handle except pywinauto.findwindows.ElementNotFoundError: return None if __name__ == '__main__': target_title = "LS GPT | Microsoft Teams" hwnd = find_window_by_title_pywinauto(target_title) if hwnd: print(f"Found window with HWND: {hwnd}") else: print(f"Window with title '{target_title}' not found.") </code> * LS GPT창의 Object list 받아오기 LS GPT에서 Object를 모두 찾는다. Web의 경우, CSS Selector로 구분할 수 있다. 기타 Power Automate나 uiPATH를 통해서, 숨겨져 있는 selector를 구분할 수 있다. 추가로 DOM 구조를 확인해 보는 것도 괜찮을 듯. <code> # test02.py import pywinauto import sys import find_ls_gpt try: # Get HWND from find_ls_gpt.py target_title = "LS GPT | Microsoft Teams" hwnd = find_ls_gpt.find_window_by_title_pywinauto(target_title) if hwnd is None: print(f"Error: Window with title '{target_title}' not found.") sys.exit(1) print(f"Attempting to connect to window with HWND: {hwnd}") # Connect to the application/window using the HWND # Use backend="uia" for modern apps like Teams, or "win32" for older apps app = pywinauto.Application(backend="uia").connect(handle=hwnd) print("Successfully connected to the application.") # Get the main window window = app.window(handle=hwnd) print("Successfully retrieved the window.") # Print control identifiers (object list) print("\nWindow Objects (Control Identifiers):") window.print_control_identifiers() print("\nSuccessfully printed control identifiers.") except pywinauto.findwindows.ElementNotFoundError: print(f"Error: Window with HWND {hwnd} not found. Make sure the window is open and the HWND is correct.") except IndexError: print("Error: Please provide the HWND as a command-line argument.") print("Usage: python list_window_objects.py <HWND>") except ValueError: print("Error: Invalid HWND provided. HWND must be an integer.") except Exception as e: print(f"An unexpected error occurred: {e}") </code> * Object list 발췌 <coide> | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Static - 'Large Language Model은 컴퓨팅 기술의 발전과 함께 많은 분야에 혁신을 가져오고 있으며, 인간과 기계 간의 상호작용을 더욱 자연스럽고 효과적으로 만들어 줍니다. 궁금한 점이 더 있으시면 언제든지 질문해 주세요!' (L857, T909, R1802, B964) | | | | | | | | | | | | | | | | | | | | ['Static47', 'Large Language Model은 컴퓨팅 기술의 발전과 함께 많은 분야에 혁신을 가져오고 있으며, 인간과 기계 간의 상호작용을 더욱 자연스럽고 효과적으로 만들어 줍니다. 궁금한 점이 더 있으시면 언제든지 질문해 주세요!Static', 'Large Language Model은 컴퓨팅 기술의 발전과 함께 많은 분야에 혁신을 가져오고 있으며, 인간과 기계 간의 상호작용을 더욱 자연스럽고 효과적으로 만들어 줍니다. 궁금한 점이 더 있으시면 언제든지 질문해 주세요!'] | | | | | | | | | | | | | | | | | | | | child_window(title="Large Language Model은 컴퓨팅 기술의 발전과 함께 많은 분야에 혁신을 가져오고 있으며, 인간과 기계 간의 상호작용을 더욱 자연스럽고 효과적으로 만들어 줍니다. 궁금한 점이 더 있으시면 언제든지 질문해 주세요!", control_type="Text") | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Button - '' (L835, T994, R881, B1040) | | | | | | | | | | | | | | | | | | | ['Large Language Model은 컴퓨팅 기술의 발전과 함께 많은 분야에 혁신을 가져오고 있으며, 인간과 기계 간의 상호작용을 더욱 자연스럽고 효과적으로 만들어 줍니다. 궁금한 점이 더 있으시면 언제든지 질문해 주세요!Button', 'Button10'] | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Image - '' (L841, T1001, R874, B1034) | | | | | | | | | | | | | | | | | | | | ['Large Language Model은 컴퓨팅 기술의 발전과 함께 많은 분야에 혁신을 가져오고 있으며, 인간과 기계 간의 상호작용을 더욱 자연스럽고 효과적으로 만들어 줍니다. 궁금한 점이 더 있으시면 언제든지 질문해 주세요!Image', 'Image110'] | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Button - '현재 GPT와 새 대화' (L838, T1113, R1022, B1168) | | | | | | | | | | | | | | | | | | ['현재 GPT와 새 대화', '현재 GPT와 새 대화Button', 'Button11'] | | | | | | | | | | | | | | | | | | child_window(title="현재 GPT와 새 대화", control_type="Button") | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Button - '다른 GPT와 새 대화' (L1032, T1113, R1216, B1168) | | | | | | | | | | | | | | | | | | ['다른 GPT와 새 대화', 'Button12', '다른 GPT와 새 대화Button'] | | | | | | | | | | | | | | | | | | child_window(title="다른 GPT와 새 대화", control_type="Button") | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Image - 'light-bulb' (L1242, T1124, R1272, B1155) | | | | | | | | | | | | | | | | | | ['Image111', 'light-bulbImage', 'light-bulb'] | | | | | | | | | | | | | | | | | | child_window(title="light-bulb", control_type="Image") | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Static - '앞 질문에 이어지는 질문이 아닐 경우, 새 대화로 물으면 대답을 더 잘합니다.' (L1282, T1128, R1834, B1151) | | | | | | | | | | | | | | | | | | ['앞 질문에 이어지는 질문이 아닐 경우, 새 대화로 물으면 대답을 더 잘합니다.', 'Static48', '앞 질문에 이어지는 질문이 아닐 경우, 새 대화로 물으면 대답을 더 잘합니다.Static'] | | | | | | | | | | | | | | | | | | child_window(title="앞 질문에 이어지는 질문이 아닐 경우, 새 대화로 물으면 대답을 더 잘합니다.", control_type="Text") | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Edit - '' (L840, T1181, R1778, B1247) | | | | | | | | | | | | | | | | | | ['Large Language Model은 컴퓨팅 기술의 발전과 함께 많은 분야에 혁신을 가져오고 있으며, 인간과 기계 간의 상호작용을 더욱 자연스럽고 효과적으로 만들어 줍니다. 궁금한 점이 더 있으시면 언제든지 질문해 주세요!Edit', 'Edit', '앞 질문에 이어지는 질문이 아닐 경우, 새 대화로 물으면 대답을 더 잘합니다.Edit'] | | | | | | | | | | | | | | | | | | child_window(title="", control_type="Edit") | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Button - 'up arrow' (L1777, T1181, R1842, B1250) | | | | | | | | | | | | | | | | | | ['up arrow', 'Button13', 'up arrowButton', 'up arrow0', 'up arrow1'] | | | | | | | | | | | | | | | | | | child_window(title="up arrow", control_type="Button") | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Image - 'up arrow' (L1790, T1196, R1829, B1235) | | | | | | | | | | | | | | | | | | | ['up arrow2', 'up arrowImage', 'Image112'] | | | | | | | | | | | | | | | | | | | child_window(title="up arrow", control_type="Image") | | | | | | | | | | | | | | </code> * 입력은 EDIT 컨트롤 * 엔터는 화살표 * 답변은 copy clip board 사용 - Group으로 생성되는데 끝을 알지 못함 (Power Automate) ==LS GPT에 질문 넘기기== edit 오브젝트에 내용을 넘기고, 결과를 LS GPT에서 출력함 : [[file:ls_gpt_01.jpg|700px]] <code> # list_window_objects.py import pywinauto import sys import find_ls_gpt try: # Get HWND from find_ls_gpt.py target_title = "LS GPT | Microsoft Teams" hwnd = find_ls_gpt.find_window_by_title_pywinauto(target_title) if hwnd is None: print(f"Error: Window with title '{target_title}' not found.") sys.exit(1) print(f"Attempting to connect to window with HWND: {hwnd}") # Connect to the application/window using the HWND # Use backend="uia" for modern apps like Teams, or "win32" for older apps app = pywinauto.Application(backend="uia").connect(handle=hwnd) print("Successfully connected to the application.") # Get the main window window = app.window(handle=hwnd) print("Successfully retrieved the window.") # Print control identifiers (object list) print("\nWindow Objects (Control Identifiers):") # window.print_control_identifiers() # 주석 처리 print("\nSuccessfully printed control identifiers.") # Find the Edit control edit_control = window.child_window(title="", control_type="Edit") # Edit control의 title이 "" 임을 확인 edit_control.set_text("생성형 AI는 무엇이야?") print("Successfully set text to the Edit control.") # Find the Button control button_control = window.child_window(title="up arrow", control_type="Button") button_control.click() print("Successfully clicked the Button control.") # Wait for the window content to change (adjust timeout if needed) window.wait('ready', timeout=10) print("Window content has changed.") # Find the Static control (adjust title if needed) # groupbox_control = window.child_window(control_type="Group") # 여러개라서 특정할 수 없음 # 특정 GroupBox를 찾기 위해 title을 사용 groupbox_control = window.child_window(title="Chat GPT와 일합니다.", control_type="GroupBox") print("Successfully found the GroupBox control.") # 다른 방법 # Image - ''은 카피 버튼이다. # 윈도우 변화가 끝나면,Button - ''을 찾고, 버튼 클릭 --> 클립보드에 복사됨, 해당 파일 가져오기임 # 버튼 여러개 중에서 맨 아래 것? 확인 필요 # Print the text of the GroupBox control print("\nGroupBox Content:") print(groupbox_control.texts()) print("\nSuccessfully printed GroupBox content.") except pywinauto.findwindows.ElementNotFoundError: print(f"Error: Window with HWND {hwnd} not found. Make sure the window is open and the HWND is correct.") except IndexError: print("Error: Please provide the HWND as a command-line argument.") print("Usage: python list_window_objects.py <HWND>") except ValueError: print("Error: Invalid HWND provided. HWND must be an integer.") except Exception as e: print(f"An unexpected error occurred: {e}") </code> ==출력 제어== Control이 Group으로 되어 있는데, 리스트 구조형으로 끝을 알 수 없는 자료형 따라서, 끝을 찾아서 출력하는 모델을 사용하거나, 맨 아래 있는 복사 버튼을 이용하여 해당 내용 복사 후, 콘솔에 뿌려주는 방식적용 필요 : [[file:ls_gpt_02.jpg|700px]] <code> # 다른 방법 # Image - ''은 카피 버튼이다. # 윈도우 변화가 끝나면,Button - ''을 찾고, 버튼 클릭 --> 클립보드에 복사됨, 해당 파일 가져오기임 # 버튼 여러개 중에서 맨 아래 것? 확인 필요 </code> [[category: AI]]
요약:
lse에서의 모든 기여는 다른 기여자가 편집, 수정, 삭제할 수 있다는 점을 유의해 주세요. 만약 여기에 동의하지 않는다면, 문서를 저장하지 말아 주세요.
또한, 직접 작성했거나 퍼블릭 도메인과 같은 자유 문서에서 가져왔다는 것을 보증해야 합니다(자세한 사항은
Lse:저작권
문서를 보세요).
저작권이 있는 내용을 허가 없이 저장하지 마세요!
취소
편집 도움말
(새 창에서 열림)
검색
검색
코드해킹
편집하기
새 주제