2020년 3월 25일 보안정보 스크래핑

2020년 3월 25일 보안정보 스크래핑 3월 25일 보안정보 스크래핑 ==================================================================== + 주요 취약점 - 메일전송 프로토콜을 이용한 원격 명령어 실행 주의 권고 외 1건 1. 메일전송 프로토콜을 이용한 원격 명령어 실행 주의 권고 최근 OpenSMTPD* 취약점이 발견되는 등 메일전송 프로토콜에서 원격 명령어 실행이 가능하여 주의를 권고함 공격자는 취약점을 악용하여 피해를 발생시킬 수 있으므로, 해결방안을 참고하여 조치 필요 - https://www.krcert.or.kr/data/secNoticeView.do?bulletin_writing_sequence=35302 2. Django 제품 SQL Injection 취약점 보안 업데이트 권고 최근 Django*에서 SQL Injection취약점(CVE-2020-9402)을 악용할 수 있는 개념증명코드(Proof of concept, PoC)가 인터넷상에 공개되어 사용자의 보안 업데이트 필요 - https://www.krcert.or.kr/data/secNoticeView.do?bulletin_writing_sequence=35301 ==================================================================== + 취약점 - Apple Safari 취약점 1. Apple Safari 취약점 Apple Safari security bypass CVE-2020-3885 - https://exchange.xforce.ibmcloud.com/vulnerabilities/178339 Apple Safari security bypass CVE-2020-3887 - https://exchange.xforce.ibmcloud.com/vulnerabilities/178338 Apple Safari inform...

장고의 단짝 친구, django extensions

장고의 단짝 친구, django extensions

매번 Django 앱을 시작하면서 항상 requirements.txt 에 포함시키는 앱이 있습니다.

django-extensions==2.2.6

아래와 같이 많은 확장 명령어를 확인할 수 있는데요.

$ python manage.py [django_extensions] admin_generator clean_pyc clear_cache compile_pyc create_command create_jobs create_template_tags delete_squashed_migrations describe_form drop_test_database dumpscript export_emails find_template generate_password generate_secret_key graph_models mail_debug merge_model_instances notes passwd pipchecker print_settings print_user_for_session reset_db reset_schema runjob runjobs runprofileserver runscript runserver_plus set_default_site set_fake_emails set_fake_passwords shell_plus show_template_tags show_templatetags show_urls sqlcreate sqldiff sqldsn sync_s3 syncdata unreferenced_files update_permissions validate_templates

그 중에 제가 자주 사용하는 명령어를 정리해봅니다.

shell_plus

Django shell with autoloading of the apps database models and subclasses of user-defined classes.

장고에서 제공하는 shell 의 향상된 버젼입니다. custom models 에서 추가적인 import 없이 사용할 수 있고, tab 키를 이용한 자동 완성 기능도 훌륭합니다.

$ python manage.py shell_plus --ipython # Shell Plus Model Imports from actstream.models import Action, Follow from admin_interface.models import Theme from allauth.account.models import EmailAddress, EmailConfirmation # Shell Plus Django Imports from django.core.cache import cache from django.conf import settings from django.contrib.auth import get_user_model from django.db import transaction from django.db.models import Avg, Case, Count, F, Max, Min, Prefetch, Q, Sum, When, Exists, OuterRef, Subquery from django.utils import timezone from django.urls import reverse Python 3.7.5 (default, Feb 26 2020, 16:28:00) Type 'copyright', 'credits' or 'license' for more information IPython 7.12.0 -- An enhanced Interactive Python. Type '?' for help. In [1]:

create_command

Creates a command extension directory structure within the specified application. This makes it easy to get started with adding a command extension to your application.

커스텀 명령어 작업을 쉽게 시작하기 위한 템플릿을 제공합니다.

$ python manage.py create_command your_app $ cat your_app/management/commands/sample.py from django.core.management.base import BaseCommand class Command(BaseCommand): help = "My shiny new management command." def add_arguments(self, parser): parser.add_argument('sample', nargs='+') def handle(self, *args, **options): raise NotImplementedError()

graph_models

Creates a GraphViz dot file. You need to send this output to a file yourself. Great for graphing your models. Pass multiple application names to combine all the models into a single dot file.

진행중이던 django 프로젝트에 참여하게 되었을 때, 그 프로젝트를 가장 빨리 이해하는 방법은 models.py 를 파악하는 것입니다. 대부분의 로직들이 models에서 관리되기 때문입니다. 코드를 단순히 읽는 것보다도 graph로 각 모델간의 관계를 그림으로 표현해 준다면 더욱 쉽게 이해를 할 수 있을텐데요. 이 기능을 위해서는 필수라고 생각합니다.

$ python manage.py graph_models your_app your_model -o /tmp/models.png

https://django-extensions.readthedocs.io/en/latest/

from http://pointer81.tistory.com/79 by ccl(A) rewrite - 2020-03-18 09:54:14

댓글

이 블로그의 인기 게시물

엑스브레인(XBrain) 기업 정보

django 설치 방법

[aws] deploy Angular app with s3 | AWS S3로 angular 앱 배포하기