Skip to content

Instantly share code, notes, and snippets.

@aeharvlee
Created April 20, 2020 12:30
Show Gist options
  • Save aeharvlee/e17a40805dbe7340b9901e764582090e to your computer and use it in GitHub Desktop.
Save aeharvlee/e17a40805dbe7340b9901e764582090e to your computer and use it in GitHub Desktop.
attack_purposes = ['Vulnerability Scan', 'Falsifying Websites', 'Interrupting Server', 'Spreading Malware', 'Identity Theft', 'Monetary Loss']
r_len = len(ipv4_list)
c_len = len(attack_purposes)
attack_purposes_map = np.zeros((r_len, c_len))
before = None
start = True
row_idx = 0
for tup, detected_count in grp_attack_purpose.items():
ipv4 = tup[0]
attack_purpose = tup[1]
if ipv4 != before:
row_idx += 1
if start:
start = False
row_idx = 0
col_idx = attack_purposes.index(attack_purpose)
ap_map[row_idx, col_idx] = detected_count
before = ipv4
# 다차원 배열의 각 컬럼(공격 목적을 의미)을 그대로 데이터프레임에 삽입해줍니다.
stat_pd['vulnerability_scan'] = attack_purposes_map[:,0]
stat_pd['falsifying_websites'] = attack_purposes_map[:,1]
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment