<reponame>brenorms/ispy-hijackdet<gh_stars>0
import parameters as param
from Traceroute import Traceroute
from datetime import datetime
import json
import sys

def measure(destination, iface = None, source = None):
    result = {}
    result[param.DESTINATION] = destination
    result[param.TIMESTAMP] = datetime.now().timestamp()
    route = Traceroute.unixTraceroute(destination, iface, source)
    result[param.ROUTE] = route
    result[param.INCOMPLETE] =  route[-1] != destination
    return result

def getHitlist(fileName):
    lineList = [line.rstrip('\n') for line in open(fileName)]
    return lineList

def main(hitlistFile, iface = None, source = None):
    hitlist = getHitlist(hitlistFile)
    results = []
    try:
        for destination in hitlist:
            result = measure(destination, iface, source)
            results.append(result)
    except KeyboardInterrupt:
        print("Encerrando")
    return results
import parameters as param
from Traceroute import Traceroute
from datetime import datetime
import json
import sys

def measure(destination, iface = None, source = None):
    result = {}
    result[param.DESTINATION] = destination
    result[param.TIMESTAMP] = datetime.now().timestamp()
    route = Traceroute.unixTraceroute(destination, iface, source)
    result[param.ROUTE] = route
    result[param.INCOMPLETE] =  route[-1] != destination
    return result

def getHitlist(fileName):
    lineList = [line.rstrip('\n') for line in open(fileName)]
    return lineList

def main(hitlistFile, iface = None, source = None):
    hitlist = getHitlist(hitlistFile)
    results = []
    try:
        for destination in hitlist:
            result = measure(destination, iface, source)
            results.append(result)
    except KeyboardInterrupt:
        print("Encerrando")
    return results