elif arguments['crime']: response = pt.set_classification(item, classification='crime') elif arguments['multiple']: response = pt.set_classification(item, classification='multiple') else: response = pt.set_classification(item, classification='benign') if response['success']: print "[*] Successfully classified %s" % item else: print "[!] Error when trying to classify %s: %s" % (item, response['error']) if arguments['tag']: if not arguments['--bulk']: if arguments['add']: response = pt.add_tag(arguments['<indicator>'], tag=arguments['<tag>']) else: response = pt.remove_tag(arguments['<indicator>'], tag=arguments['<tag>']) if response['success']: if arguments['add']: print "[*] Successfully tagged %s with %s" % (arguments['<indicator>'], arguments['<tag>']) else: print "[*] Successfully untagged %s from %s" % (arguments['<tag>'], arguments['<indicator>']) else: print "[!] Error when trying to tag %s: %s" % (arguments['<indicator>'], response['error']) else: if os.path.exists(arguments['<indicator>']): items = [ x.strip() for x in open(arguments['<indicator>'], 'r').readlines() ] for item in items:
response = pt.set_classification( item, classification='multiple') else: response = pt.set_classification( item, classification='benign') if response['success']: print "[*] Successfully classified %s" % item else: print "[!] Error when trying to classify %s: %s" % ( item, response['error']) if arguments['tag']: if not arguments['--bulk']: if arguments['add']: response = pt.add_tag(arguments['<indicator>'], tag=arguments['<tag>']) else: response = pt.remove_tag(arguments['<indicator>'], tag=arguments['<tag>']) if response['success']: if arguments['add']: print "[*] Successfully tagged %s with %s" % ( arguments['<indicator>'], arguments['<tag>']) else: print "[*] Successfully untagged %s from %s" % ( arguments['<tag>'], arguments['<indicator>']) else: print "[!] Error when trying to tag %s: %s" % ( arguments['<indicator>'], response['error'])
#!/usr/bin/env python from passivetotal import PassiveTotal # create a new instance pt = PassiveTotal('9240860a2790ca058fac39f2c39c86dace50f44dc020e3dd4d6308e152b354fb') # set our logging pt.logger = 'DEBUG' # get pdns information print pt.get_passive('www.passivetotal.org') # set classification print pt.set_classification('www.passivetotal.org', classification='benign') # set a tag print pt.add_tag('www.passivetotal.org', tag='security')