336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

포트변경 / SSH root접속차단

========================================================

/etc/ssh/sshd_config

#Port 22

Port 2222


cat /etc/ssh/sshd_config | egrep ^\#?Port


service sshd restart 또는 service ssh restart


/etc/ssh/sshd_config

#PermitRootLogin yes

PermitRootLogin on


service sshd restart 또는 service ssh restart



SSH 허용IP 설정(외 모든IP 차단)

========================================================

/etc/hosts.allow 수정
# hosts.allow    This file describes the names of the hosts which are
#        allowed to use the local INET services, as decided
#        by the '/usr/sbin/tcpd' server.
#
sshd: 113.157.124.168, 135.79.246.
또는
sshd: 113.157.124.168
sshd: 135.79.246.

/etc/hosts.deny 수정
# hosts.deny    This file describes the names of the hosts which are
#        *not* allowed to use the local INET services, as decided
#        by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow.  In particular
# you should know that NFS uses portmap!
sshd: ALL



Rewrite 설정

========================================================

vim /etc/nginx/rewrite.rule

rewrite ^/html/index?$ /html/index.html last;

#/html/index.html 접근시 /html/index로 재작성


vim /etc/nginx/sites-available/default

server {

........................

include /etc/nginx/rewrite.rule #마지막줄에 추가

}


nginx -c /etc/nginx/nginx.conf -t #conf 검증

service nginx reload 또는 restart


rule 참고 : http://jasontody.tistory.com/181

설정 참고 : http://sarc.io/index.php/nginx/61-nginx-nginx-conf

'Web Service' 카테고리의 다른 글

OWASP Honeypot  (0) 2022.03.10
[PHP] IP체크 정규식  (0) 2016.07.12
우분투에 nginx, MySQL, PHP(LEMP) 설치  (0) 2016.03.09
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.

빈 리스트
>>> a = [ ]
>>> a
[ ]


append를 이용한 리스트 추가
>>> a.append(1)
>>> a
[1]
>>> a.append("ABC")
>>> a
[1, 'ABC']


+ 연산자를 이용한 리스트 추가
>>> a += "DEF"
>>> a
[1, 'ABC', 'D', 'E', 'F']

>>> a += ["GHI"]
>>> a
[1, 'ABC', 'D', 'E', 'F', 'GHI']


instert를 이용해 리스트 끼워넣기
>>> a.insert(2, 'TEST')
>>> a
[1, 'ABC', 'TEST', 'D', 'E', 'F', 'GHI']



remove를 이용해 삭제하기
>>> a.remove('D')
>>> a
[1, 'ABC', 'TEST', 'E', 'F', 'GHI']


pop을 이용해 맨 마지막 삭제
>>> a
[1, 'ABC', 'TEST', 'E', 'F']
>>> a.pop(2)
'TEST'
>>> a
[1, 'ABC', 'E', 'F']


pop을 이용해 인덱스 값을 꺼내오면서 삭제
>>> a
[1, 'ABC', 'TEST, 'E', 'F']
>>> a.pop(2)
'TEST'
>>> a
[1, 'ABC', 'E', 'F']


len을 이용해서 크기 구하기
>>> a
[1, 'ABC', 'E', 'F']
>>> len(a)
4


index를 이용해서 찾기
>>> a
[1, 'ABC', 'E', 'F']
>>> a.index('E')
2


count
>>> a.count('A')
0
>>> a.count('ABC')
1


sort, reverse
>>> a.reverse()
>>> a
['F', 'E', 'ABC', 1]

>>> a.sort()
>>> a
[1, 'ABC', 'E', 'F']


extend 와 append
>>> a.extend("TEST")
>>> a
[1, 'ABC', 'E', 'F', 'T', 'E', 'S', 'T']

>>> a.append("TEST")
>>> a
[1, 'ABC', 'E', 'F', 'T', 'E', 'S', 'T', 'TEST']



참고 : http://flowarc.tistory.com/118

'Analysis > Python' 카테고리의 다른 글

[Python] wmi  (0) 2016.08.10
[Python] with, seek, tell  (0) 2016.08.03
Python Random 함수  (0) 2016.07.05
base64로 인코딩된 바이너리 파일 확인  (0) 2016.03.31
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
랜덤함수
1) random
>>> import random
>>> import string
>>> c = string.letters + string.digits
>>> c
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

>>> v = ''.join(random.sample(c, 6))
>>> v
'yxEeLl'
2) uuid
>>> import uuid
>>> uuid.uuid1()
UUID('8f9f01b8-923e-11e0-889b-1093e9020660')

>>> str(uuid.uuid1())
'98c3d57a-923e-11e0-ae95-1093e9020660'

>>> uuid.uuid4() 
UUID('6a81a0ca-dcfc-4024-883e-5abb29238b4d')

>>> str(uuid.uuid4()) 
'7ed3f7b9-84a5-4066-8e9c-e5e1bc370573' 

>>> str(uuid.uuid4()).replace("-", "")
'7ed3f7b984a54066-8e9ce5e1bc370573' 
3) os
>>> import os
>>> import binascii
>>> os.urandom(16)
'h\xb4\xaa<\x12\xa5\xc8\xaf\xa2sCr\x93\x01f\xdc'

>>> binascii.hexlify(os.urandom(16))
'7a26ada27ace29eb422c04efe7313526'

>>> int(binascii.hexlify(os.urandom(16)), 16)
69812220901636122490437131090184792388L 
4) 기타
>>> random.random()
0.37444887175646646

>>> random.uniform(1, 10)
1.1800146073117523

>>> random.randint(1, 10)
7

>>> random.randrange(0, 101, 2)
26

>>> random.choice('abcdefghij')
'c'

>>> items = [1, 2, 3, 4, 5, 6, 7]
>>> random.shuffle(items)
>>> items
[7, 3, 2, 5, 6, 4, 1]

>>> random.sample([1, 2, 3, 4, 5],  3)
[4, 1, 5]

'Analysis > Python' 카테고리의 다른 글

[Python] wmi  (0) 2016.08.10
[Python] with, seek, tell  (0) 2016.08.03
Python 리스트(배열)  (0) 2016.07.05
base64로 인코딩된 바이너리 파일 확인  (0) 2016.03.31

+ Recent posts