2013년 12월 17일 화요일

[Python] 텍스트에서 이메일 추출하기

def grab_email(files = []):
    # if passed a list of text files, will return a list of
    # email addresses found in the files, matched according to
    # basic address conventions. Note: supports most possible
    # names, but not all valid ones.
   
    found = []
    if files != None:
        mailsrch = re.compile(r'[\w\-][\w\-\.]+@[\w\-][\w\-\.]+[a-zA-Z]{1,4}')
       
        for file in files:           
            for line in open(file,'r'):               
                found.extend(mailsrch.findall(line))   

    # remove duplicate elements
    # borrowed from Tim Peters' algorithm on ASPN Cookbook
    u = {}
    for item in found:
        u[item] = 1

    # return list of unique email addresses
    return u.keys()

Reentrancy Attack: 블록체인 스마트 컨트랙트의 치명적인 취약점

블록체인 기술이 전 세계적으로 주목받으면서 스마트 컨트랙트(Smart Contract)의 사용이 급격히 증가하고 있습니다. 하지만 그만큼 보안 취약점도 함께 늘어나고 있는데, 그 중에서도 Reentrancy Attack(재진입 공격)은 매우 치명적이고...