sdn_detect.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:sdnpwn 作者: smythtech 项目源码 文件源码
def run(params): 
  global verbose

  verbose = False
  testMethod = "arp"
  dstIP = ""
  count = 10
  interval = 1

  if("-m" in params):
    testMethod = (params[params.index("-m")+1]).lower()
  if("-t" in params):
    dstIP = params[params.index("-t")+1]
  if("-i" in params):
    interval = float(params[params.index("-i")+1])
  if("-c" in params):
    count = int(params[params.index("-c")+1])
  if("-v" in params):
    verbose = True

  if(dstIP == ""):
    sdnpwn.message("No target given, using default gateway", sdnpwn.NORMAL)
    try:
      dstIP = netifaces.gateways()['default'][netifaces.AF_INET][0]
    except:
      sdnpwn.message("Could not determine gateway address. Please specify a target using the -t option.", sdnpwn.ERROR)
      return
    sdnpwn.message("Default gateway detected as " + dstIP, sdnpwn.NORMAL)

  try:
    if(testForSDN(testMethod, dstIP, count, interval)):
      sdnpwn.message("SDN detected!", sdnpwn.SUCCESS)
    else:
      sdnpwn.message("SDN not detected", sdnpwn.WARNING)
  except PermissionError as e:
    sdnpwn.message("Needs root!", sdnpwn.ERROR)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号