728x90 ๐จ๐ผ๐ป๊ฐ๋ฐ158 ํ์ด์ฌ - ๋ฆฌ๋ ์ค์์ GPT ๋ช ๋ น์ด ์ฌ์ฉํ๊ธฐ ๋ชจ๋ ์ค์น pip install openai ~/dev/gpt.py import openai import sys openai.api_key = "์์ ์ API ํ ํฐ์ ์ฌ๊ธฐ์ ์ ๋ ฅ" messages = [ {"role": "system", "content": "You are a helpful assistant."}, ] def request(text:str): global messages if len(messages) >= 30: messages = messages[-10:] query = text messages.append({"role": "user", "content": query}) response = openai.ChatCompletion.create( model="gpt-3.5-turbo", m.. 2023. 5. 22. ์ ๋ ๋์ - xpath, ํ ์คํธ๊ฐ ํฌํจ๋ ์์ ์ ํ(contains text) ์ํ๋ ๋ฌธ์์ด์ธ ์์ ์ฐพ๊ธฐ ex) ์์์ ๋ด์ฉ์ด foo์ธ ๊ฒ์ ์ฐพ๊ธฐ //myparent/mychild[text() = 'foo'] ์ํ๋ ๋ฌธ์์ด์ด ํฌํจํ(contains) ์์ ์ฐพ๊ธฐ ex) ABC๋ผ๋ ๋ด์ฉ์ ํฌํจํ ์๋ ์์ ์ฐพ๊ธฐ //*[contains(text(),'ABC')] ํ์ด์ฌ ์ฌ์ฉ ์์ driver.find_element_by_xpath('//span[contains(text(),"ABC")]') ์๋ฐ์คํฌ๋ฆฝํธ(๋ธ๋ผ์ฐ์ ๊ฐ๋ฐ์ ๋๊ตฌ) ์ฌ์ฉ ์์ $x("//*[contains(text(),'12:00')]") ๊ทธ ๋ฌธ์์ธ ๊ฒ์ ์ฐพ๊ธฐ $x('//*[text()="๋ค์ด๋ฒ๋ก ์ด์ฉํ๊ธฐ"]') ์์ฑ(class๋ id) ๊ฐ์ด ํน์ ๋ฌธ์๋ก ์์ํ๋ ์์ ์ฐพ๊ธฐ $x("//div[starts-with(@class,.. 2023. 5. 7. ํ์ด์ฌ - ๋ ์ง์คํธ๋ฆฌ ์กฐ์(winreg) import winreg # ๋ ์ง์คํธ๋ฆฌ ํค ์์ฑ key_path = r"Software\MyExampleKey" try: key = winreg.CreateKey(winreg.HKEY_CURRENT_USER, key_path) print("ํค ์์ฑ ์ฑ๊ณต") except: print("ํค ์์ฑ ์คํจ") # ๋ ์ง์คํธ๋ฆฌ ํค์ ๊ฐ ์ค์ value_name = "ExampleValue" value_data = "Hello, Registry!" try: winreg.SetValueEx(key, value_name, 0, winreg.REG_SZ, value_data) winreg.CloseKey(key) print("๊ฐ ์ค์ ์ฑ๊ณต") except: print("๊ฐ ์ค์ ์คํจ") # ๋ ์ง์คํธ๋ฆฌ ํค์์ ๊ฐ ์ฝ๊ธฐ try.. 2023. 5. 5. ํ์ด์ฌ - pyinstaller ๊ด๋ฆฌ์ ๊ถํ์ผ๋ก ์คํ ํ๊ธฐ --uac-admin ์ต์ ์ ์ถ๊ฐํ๊ณ ๋น๋๋ฅผ ํ๋ฉด ๊ด๋ฆฌ์ ๊ถํ์ผ๋ก ์คํ์ด ๊ฐ๋ฅํ๋ค. ์์ pyinstaller -w --uac-admin test.py ์ถ์ฒ: https://dev-dream.tistory.com/4 pyinstaller ๋ก exe ๋ง๋ค ๋ ๊ด๋ฆฌ์ ๊ถํ์ผ๋ก ์คํํ๊ธฐ python ์ผ๋ก ํ๋ก๊ทธ๋จ์ ๋ง๋ค๋ฉด exe (์คํํ์ผ) ํํ๋ก ๋ฐฐํฌํ ๊ฒฝ์ฐ๊ฐ ์๋ค. py2exe ๋ฅผ ์ฃผ๋ก ์ผ๋๋ฐ setup ํ์ผ ๋ง๋๋๊ฒ ๋ถํธํ๋๋ฐ pyinstaller ๋ฅผ ํ์ฉํ๋ฉด ์ฝ๊ฒ ๋ง๋ค ์ ์๋ค. pip3 install pyinstaller ๋ก pyins dev-dream.tistory.com 2023. 5. 5. ํ์ด์ฌ - ๋งฅ ์ฃผ์ ๋ณ๊ฒฝ(changeMAC) changeMAC.py (๊ด๋ฆฌ์ ๊ถํ ํ์) from winreg import * import os, time def run(adapterName, adapterType="Wi-Fi"): aReg = ConnectRegistry(None, HKEY_LOCAL_MACHINE) aKey = OpenKey(aReg, r"SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}") oKey = None sValue = None for i in range(255): try: aValue_name = EnumKey(aKey, i) oKey = OpenKey(aKey, aValue_name) sValue = QueryValueEx(oK.. 2023. 5. 2. ์นํํฌ(webhook) ์ฌ์ดํธ(requestcatcher.com, webhook.site) https://requestcatcher.com/ Request Catcher — record HTTP requests, webhooks, API calls Request Catcher will create a subdomain on which you can test an application. All requests sent to any path on the subdomain are forwarded to your browser in real time. requestcatcher.com https://webhook.site/ Webhook.site - Test, process and transform emails and HTTP requests This URL received over {{ appCon.. 2023. 3. 27. ์ด์ ๋ธ๋ฆฌ์ด - ๋ฆฌ๋ ์ค syscall๋ก open, read, write ์ฌ์ฉ ๋ฆฌ๋ ์ค ์ํคํ ์ฒ ํ์ธ ๋ช ๋ น์ด uname -a syscall ํ ์ด๋ธ https://chromium.googlesource.com/chromiumos/docs/+/master/constants/syscalls.md#x86_64-64_bit Chromium OS Docs - Linux System Call Table Linux System Call Table These are the system call numbers (NR) and their corresponding symbolic names. These vary significantly across architectures/ABIs, both in mappings and in actual name. This is a quick reference for p.. 2023. 3. 24. C/C++ - DLL ๋ง๋ค๊ธฐ, DLL ์ฌ์ฉํ๊ธฐ (GCC) my_dll.c (DLL ๋ง๋ค๊ธฐ) #include void func() { system("start www.google.com");} GCC DLL ๋น๋ gcc -shared my_dll.dll -o my_dll.c run.c (DLL ์ฌ์ฉํ๊ธฐ) #include #include typedef void(*dll_func)();int main(){ HINSTANCE hDLL = LoadLibrary("my_dll.dll"); if(hDLL == NULL){ printf("Failed to load DLL\n"); return 1; } dll_func func = (dll_func)GetProcAddress(hDLL, "func"); if(func ==.. 2023. 3. 23. ํ์ด์ฌ - ์ฝ๋ ๋๋ ํ ๋ณํ ์ฌ์ดํธ(pyob.oxyry.com) https://pyob.oxyry.com/ Oxyry Python Obfuscator - The most reliable python obfuscator in the world Features Rename symbol names, includes variables, functions, classes, arguments, class private methods. The name replacer avoids a 1:1 mapping of cleartext names to obfuscated names, the same name may be converted to several different names within differen pyob.oxyry.com 2023. 3. 16. ํ์ด์ฌ - ์บก์ฑ ์์ฑ๊ธฐ(captcha) ๋ชจ๋ ์ค์น pip install captcha ๊ธ์ ์์ฑ ์์ # Import the following modules from captcha.image import ImageCaptcha # Create an image instance of the given size image = ImageCaptcha(width = 280, height = 90) # Image captcha text captcha_text = 'GeeksforGeeks' # generate the image of the given text data = image.generate(captcha_text) # write the image on the given file and save it image.write(captcha_text, .. 2023. 3. 12. ์ ๋ ๋์ - ํฌ๋กฌ๋๋ผ์ด๋ธ ์๋ ์ค์น ๋ชจ๋ ์ค์น pip install webdriver_manager from webdriver_manager.chrome import ChromeDriverManager def exec_chrom(): driver = webdriver.Chrome(service=Service(ChromeDriverManager().install())) return driver 2023. 3. 8. ํ์ด์ฌ - pyinstaller์ RecursionError : maximum recursion depth exceeded ์ค๋ฅ ํด๊ฒฐ ๋ฐฉ๋ฒ pyinstaller -w --onefile main.py ์ด๋ฐ ์์๋ก main.py๋ฅผ exe๋ก ๋ณํํ๋ ๊ณผ์ ์ RecursionError ์ค๋ฅ๊ฐ ์๊ฒผ๋ค๋ฉด .spec ํ์ผ์ ์๋์ฒ๋ผ ์์ pyinstaller๋ก ๋น๋๋ฅผ ํ๋ฒ ํด์ฃผ๋ฉด ๊ทธ ํด๋์ main.spec์ด๋ผ๋ ํ์ผ์ด ํ๋ ์๊ธฐ๋๋ฐ ์ด๊ฑธ ์ฐ๋ค. ์์ ๋ถ๋ถ์๋ค. (์ธ์ฝ๋ฉ ๋ฐ๋ก ์๋์) # -*- mode: python ; coding: utf-8 -*- import sys sys.setrecursionlimit(5000) # ํน์ import sys ; sys.setrecursionlimit(sys.getrecursionlimit() * 5) ๋ ์ค์ ์๋ก ์ถ๊ฐํ๋ค. (sys.setrecursionlimit ํจ์๋ ์ฌ๊ท ํธ์ถ์ ์ ํ ์ค์ ์ด๋ผ๊ณ ํ๋ค. ๊ธฐ.. 2023. 3. 8. ์ด์ 1 2 3 4 5 6 ยทยทยท 14 ๋ค์ 728x90