Ejemplo n.º 1
0
def main():
    """
    Serves as the instantiation point to start Automater.

    Argument(s):
    No arguments are required.

    Return value(s):
    Nothing is returned from this Method.

    Restriction(s):
    The Method has no restrictions.
    """

    sites = []
    parser = Parser('IP, URL, and Hash Passive Analysis tool', __VERSION__)

    # if no target run and print help
    if parser.hasNoTarget():
        print('[!] No argument given.')
        parser.print_help()  # need to fix this. Will later
        sys.exit()

    if parser.VersionCheck:
        Site.checkmoduleversion(__GITFILEPREFIX__, __GITLOCATION__, parser.Proxy, parser.Verbose)

    # user may only want to run against one source - allsources
    # is the seed used to check if the user did not enter an s tag
    sourcelist = ['allsources']
    if parser.hasSource():
        sourcelist = parser.Source.split(';')

    # a file input capability provides a possibility of
    # multiple lines of targets
    targetlist = []
    if parser.hasInputFile():
        for tgtstr in TargetFile.TargetList(parser.InputFile, parser.Verbose):
            tgtstrstripped = tgtstr.replace('[.]', '.').replace('{.}', '.').replace('(.)', '.')
            if IPWrapper.isIPorIPList(tgtstrstripped):
                for targ in IPWrapper.getTarget(tgtstrstripped):
                    targetlist.append(targ)
            else:
                targetlist.append(tgtstrstripped)
    else:  # one target or list of range of targets added on console
        target = parser.Target
        tgtstrstripped = target.replace('[.]', '.').replace('{.}', '.').replace('(.)', '.')
        if IPWrapper.isIPorIPList(tgtstrstripped):
            for targ in IPWrapper.getTarget(tgtstrstripped):
                targetlist.append(targ)
        else:
            targetlist.append(tgtstrstripped)

    sitefac = SiteFacade(parser.Verbose)
    sitefac.runSiteAutomation(parser.Delay, parser.Proxy, targetlist, sourcelist, parser.UserAgent, parser.hasBotOut,
                              parser.RefreshRemoteXML, __GITLOCATION__)
    sites = sitefac.Sites
    if sites:
        SiteDetailOutput(sites).createOutputInfo(parser)
Ejemplo n.º 2
0
def main():
    """
    Serves as the instantiation point to start Automater.
    
    Argument(s):
    No arguments are required.
    
    Return value(s):
    Nothing is returned from this Method.
    
    Restriction(s):
    The Method has no restrictions.
    """
    sites = []
    parser = Parser('IP, URL, and Hash Passive Analysis tool')

    # if no target run and print help
    if parser.hasNoTarget():
        print '[!] No argument given.'
        parser.print_help()  # need to fix this. Will later
        sys.exit()

    # user may only want to run against one source - allsources
    # is the seed used to check if the user did not enter an s tag
    source = "allsources"
    if parser.hasSource():
        source = parser.Source

    # a file input capability provides a possibility of
    # multiple lines of targets
    targetlist = []
    if parser.hasInputFile():
        for tgtstr in TargetFile.TargetList(parser.InputFile):
            if IPWrapper.isIPorIPList(tgtstr):
                for targ in IPWrapper.getTarget(tgtstr):
                    targetlist.append(targ)
            else:
                targetlist.append(tgtstr)
    else:  # one target or list of range of targets added on console
        target = parser.Target
        if IPWrapper.isIPorIPList(target):
            for targ in IPWrapper.getTarget(target):
                targetlist.append(targ)
        else:
            targetlist.append(target)

    sitefac = SiteFacade()
    sitefac.runSiteAutomation(parser.Delay, targetlist, source,
                              parser.hasPost())
    sites = sitefac.Sites
    if sites is not None:
        SiteDetailOutput(sites).createOutputInfo(parser)
Ejemplo n.º 3
0
    def post(self, cible):
        """
        Serves as the instantiation point to start Automater.

        Argument(s):
        No arguments are required.

        Return value(s):
        Nothing is returned from this Method.

        Restriction(s):
        The Method has no restrictions.
        """

        urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
        __VERSION__ = '0.21'
        __GITLOCATION__ = 'https://github.com/1aN0rmus/TekDefense-Automater'
        __GITFILEPREFIX__ = 'https://raw.githubusercontent.com/1aN0rmus/TekDefense-Automater/master/'

        sites = []
        parser = Parser('IP, URL, and Hash Passive Analysis tool', __VERSION__,
                        cible)

        # if no target run and print help
        if parser.hasNoTarget():
            print('[!] No argument given.')
            parser.print_help()  # need to fix this. Will later
            sys.exit()

        if parser.VersionCheck:
            Site.checkmoduleversion(__GITFILEPREFIX__, __GITLOCATION__,
                                    parser.Proxy, parser.Verbose)

        # user may only want to run against one source - allsources
        # is the seed used to check if the user did not enter an s tag
        sourcelist = ['allsources']
        if parser.hasSource():
            sourcelist = parser.Source.split(';')

        # a file input capability provides a possibility of
        # multiple lines of targets
        targetlist = []
        if parser.hasInputFile():
            for tgtstr in TargetFile.TargetList(parser.InputFile,
                                                parser.Verbose):
                tgtstrstripped = tgtstr.replace('[.]', '.').replace(
                    '{.}', '.').replace('(.)', '.')
                if IPWrapper.isIPorIPList(tgtstrstripped):
                    for targ in IPWrapper.getTarget(tgtstrstripped):
                        targetlist.append(targ)
                else:
                    targetlist.append(tgtstrstripped)
        else:  # one target or list of range of targets added on console
            #target = parser.Target

            target = cible
            #print("---------------------------------------------------------------------------------------------")
            #print(target)

            tgtstrstripped = target.replace('[.]', '.').replace('{.}',
                                                                '.').replace(
                                                                    '(.)', '.')
            if IPWrapper.isIPorIPList(tgtstrstripped):
                for targ in IPWrapper.getTarget(tgtstrstripped):
                    targetlist.append(targ)
            else:
                targetlist.append(tgtstrstripped)
        #print(targetlist)
        sitefac = SiteFacade(parser.Verbose)
        sitefac.runSiteAutomation(parser.Delay, parser.Proxy, targetlist,
                                  sourcelist, parser.UserAgent,
                                  parser.hasBotOut, parser.RefreshRemoteXML,
                                  __GITLOCATION__)
        sites = sitefac.Sites
        if sites:
            resultTemp = SiteDetailOutput(sites).createOutputInfo(parser)
            #print("---------------------------------------------------------------------------------------------")
            #print(sites)
            #print("---------------------------------------------------------------------------------------------")

            #-------------------PARSE RESULT--------------------------------------
            tabTemp = resultTemp.split("\n")

            result = {}
            for i in range(len(tabTemp)):

                tabTemp[i] = tabTemp[i].replace("[+]", "")
                tabTemp[i] = tabTemp[i].strip()
                if (":" in tabTemp[i]):
                    tab = tabTemp[i].split(":", 1)
                    if (i == 1):
                        result["target"] = tab[1].replace(
                            "____________________", " ").strip()
                    elif (tab[0] in result):

                        result[tab[0]] = result[tab[0]] + " " + tab[1]
                    else:
                        result[tab[0]] = tab[1]

            results.append(result)
            #print(results)

        return result, 201