コード例 #1
0
def main():
    sSOURCEID = 'src_79'

    ### Setup for running as Main and template for use of adptr function
    tmpJSON = getFile_JSON2Dict('../../data/openSourceList.json')
    tmpDict = None

    for sKey in tmpJSON:
        if tmpJSON[sKey]['srcIndex'] == sSOURCEID:
            tmpDict = tmpJSON[sKey]

    ### Without a valide Source Meta data this function will exit
    if tmpDict == None:
        retrun(False)

    ### This infomation is only require if you wish upload this data
    ###     to a TAXII Server

    dstCreds = {
        "URI": "http://www.hailataxii.com/taxii-discovery-service",
        "usrName": "clean_mx_de",
        "usrPass": "******",
        "crtName": "",
        "crtPass": ""
    }

    dstCreds = {
        "URI": "http://172.16.167.147/taxii-discovery-service",
        "usrName": "admin",
        "usrPass": "******",
        "crtName": "",
        "crtPass": ""
    }

    ### The adpter function requires clsDataSource object populated
    ###     with a minimum of data
    srcData = clsDataSource(isDebugOn=True)
    srcData.from_dict(tmpDict)
    srcData.chnkSize = 500
    # This version does not make use of the chucking capability
    srcData.dstCreds = dstCreds
    srcData.filePath = os.path.dirname(os.path.abspath(__file__)) + '/'

    ### Extract(src2Dict) Transform(dict2STIX) Load(sndTAXII)
    dictObj = adptr_src2Dict(srcData, False)
    if not dictObj == False:
        stixObj = adptr_dict2STIX(srcData, dictObj)
        if not stixObj == False:
            taxiiMsg = sndTAXII(srcData.dstCreds, stixObj.to_xml(), True)

    return (0)
コード例 #2
0
def main():
    sourceid = 'src_82'

    ### Setup for running as Main and template for use of adptr function
    tmp_json = getFile_JSON2Dict('../../data/openSourceList.json')
    tmp_dict = None

    for sKey in tmp_json:
        if tmp_json[sKey]['srcIndex'] == sourceid:
            tmp_dict = tmp_json[sKey]

    ### Without a valide Source Meta data this function will exit
    if tmp_dict is None:
        return False

    ### This infomation is only require if you wish upload this data
    ###     to a TAXII Server

    dst_creds = {
        "URI": "http://172.16.167.147/taxii-discovery-service",
        "usrName": "admin",
        "usrPass": "******",
        "crtName": "",
        "crtPass": ""
    }

    ### The adpter function requires clsDataSource object populated
    ###     with a minimum of data
    src_data = clsDataSource(isDebugOn=True)
    src_data.from_dict(tmp_dict)
    src_data.chnkSize = 500  # This version does not make use of the chucking capability
    src_data.dstCreds = dst_creds
    src_data.filePath = os.path.dirname(os.path.abspath(__file__)) + '/'

    ### Extract(src2Dict) Transform(dict2STIX) Load(sndTAXII)
    dict_obj = adptr_src2Dict(src_data, True)
    if not dict_obj == False:
        stix_obj = adptr_dict2STIX(src_data, dict_obj)
        if not stix_obj == False:
            pass

    return 0
コード例 #3
0
def main():
    sSOURCEID = 'src_36'

    ### Setup for running as Main and template for use of adptr function
    tmpJSON = getFile_JSON2Dict('../../data/openSourceList.json')
    tmpDict = None

    for sKey in tmpJSON:
        if tmpJSON[sKey]['srcIndex'] == sSOURCEID:
            tmpDict = tmpJSON[sKey]

    ### Without a valide Source Meta data this function will exit
    if tmpDict == None:
        retrun(False)

    ### This infomation is only require if you wish upload this data
    ###     to a TAXII Server

    dstCreds = {
        "URI": "http://www.hailataxii.com/taxii-discovery-service",
        "usrName": "lehigh_edu",
        "usrPass": "******",
        "crtName": "",
        "crtPass": ""
    }

    dstCreds = {
        "URI": "http://172.16.167.147/taxii-discovery-service",
        "usrName": "admin",
        "usrPass": "******",
        "crtName": "",
        "crtPass": ""
    }

    ### The adpter function requires clsDataSource object populated
    ###     with a minimum of data
    srcData = clsDataSource(isDebugOn=True)
    srcData.from_dict(tmpDict)
    srcData.chnkSize = 250
    # This version does not make use of the chucking capability
    srcData.dstCreds = dstCreds
    srcData.filePath = os.path.dirname(os.path.abspath(__file__)) + '/'

    srcData.pkgTitle = "Domain Block list by MalwareDomain from Lehigh University"
    srcData.pkgDscrpt = "A list of domains that are known to be used to propagate malware are listed in Bind and Windows zone files. The domains are loaded onto an internal DNS server. When a computer requests a URL or file from one of these domains, a fake reply is sent, thus preventing many malware installs from occuring"
    srcData.pkgLink = "http://malwaredomains.lehigh.edu/files/"

    print "------< NOT UPDATING >------"

    if not getRmt_File(srcData.srcCreds,
                       srcData.filePath + srcData.fileName) == True:
        # if no source data is found, this script will exit
        return (False)

    ### Extract(src2Dict) Transform(dict2STIX) Load(sndTAXII)
    dictObj = adptr_src2Dict(srcData, True)

    if not dictObj == False:
        iCnt = 0
        tmpDict = {}
        for sKey in dictObj:
            if not dictObj[sKey] == None:
                tmpDict[sKey] = dictObj[sKey]
            if iCnt == srcData.chnkSize:
                stixObj = adptr_dict2STIX(srcData, tmpDict)
                tmpDict = {}
                iCnt = 0

                if not stixObj == False:
                    taxiiMsg = sndTAXII(srcData.dstCreds, stixObj.to_xml(),
                                        True)
            iCnt += 1

    return (0)
コード例 #4
0
def main():
    sSOURCEID = 'src_83'

    ### Setup for running as Main and template for use of adptr function
    tmpJSON = getFile_JSON2Dict('../../data/openSourceList.json')
    tmpDict = None

    if tmpJSON:
        for sKey in tmpJSON:
            if tmpJSON[sKey]['srcIndex'] == sSOURCEID:
                tmpDict = tmpJSON[sKey]
    else:
        return (0)

    ### Without a valide Source Meta data this function will exit
    if tmpDict == None:
        retrun(False)

    ### This infomation is only require if you wish upload this data
    ###     to a TAXII Server

    dstCreds = {
        "URI": "http://www.hailataxii.com/taxii-discovery-service",
        "usrName": "blutmagie_de",
        "usrPass": "******",
        "crtName": "",
        "crtPass": ""
    }

    dstCreds = {
        "URI": "http://172.16.167.147/taxii-discovery-service",
        "usrName": "admin",
        "usrPass": "******",
        "crtName": "",
        "crtPass": ""
    }

    ### The adpter function requires clsDataSource object populated
    ###     with a minimum of data
    srcData = clsDataSource(isDebugOn=True)
    srcData.from_dict(tmpDict)
    srcData.chnkSize = 250
    # This version does not make use of the chucking capability
    srcData.dstCreds = dstCreds
    srcData.filePath = os.path.dirname(os.path.abspath(__file__)) + '/'

    srcData.pkgTitle = "Tor 'Exit Point' router IP/Host list"
    srcData.pkgDscrpt = "torstatus.blutmagie.de idenitifes the following IP/Host as Tor network 'Exit Point' routers"
    srcData.pkgLink = "http://torstatus.blutmagie.de/query_export.php/Tor_query_EXPORT.csv"

    #print "------< NOT UPDATING >------"

    if not getRmt_File(srcData.srcCreds,
                       srcData.filePath + srcData.fileName) == True:
        # if no source data is found, this script will exit
        return (False)

    ### Extract(src2Dict) Transform(dict2STIX) Load(sndTAXII)
    dictObj = adptr_src2Dict(srcData, True)

    if not dictObj == False:
        iCnt = 0
        tmpDict = {}
        if len(dictObj) > srcData.chnkSize:
            for sKey in dictObj:
                if not dictObj[sKey] == None:
                    tmpDict[sKey] = dictObj[sKey]
                if iCnt == srcData.chnkSize:
                    stixObj = adptr_dict2STIX(srcData, tmpDict)
                    tmpDict = {}
                    iCnt = 0
                    if not stixObj == False:
                        taxiiMsg = sndTAXII(srcData.dstCreds, stixObj.to_xml(),
                                            True)
                iCnt += 1

        else:
            stixObj = adptr_dict2STIX(srcData, dictObj)
            if not stixObj == False:
                taxiiMsg = sndTAXII(srcData.dstCreds, stixObj.to_xml(), True)