Merge branch 'master' of github.com:MISP/PyMISP

pull/428/head
Raphaël Vinot 2019-07-25 14:53:56 +02:00
commit 0198c87b3f
2 changed files with 5 additions and 5 deletions

View File

@ -13,11 +13,12 @@ def init(url, key):
result = m.get_event(event) result = m.get_event(event)
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Get an event from a MISP instance.') parser = argparse.ArgumentParser(description='Get an event from a MISP instance.')
parser.add_argument("-e", "--event", required=True, help="Event ID to get.") parser.add_argument("-e", "--event", required=True, help="Event ID to get.")
parser.add_argument("-a", "--attribute", help="Attribute ID to modify. A little dirty for now, argument need to be included in event") parser.add_argument("-a", "--attribute", help="Attribute ID to modify. A little dirty for now, argument need to be included in event")
parser.add_argument("-t", "--tag", required=True, type=int, help="Attribute ID to modify.") parser.add_argument("-t", "--tag", required=True, type=int, help="Tag ID.")
parser.add_argument("-m", "--modify_attribute", action='store_true', help="If set, the tag will be add to the attribute, otherwise to the event.") parser.add_argument("-m", "--modify_attribute", action='store_true', help="If set, the tag will be add to the attribute, otherwise to the event.")
args = parser.parse_args() args = parser.parse_args()

View File

@ -12,12 +12,13 @@ def init(url, key):
result = m.get_event(event) result = m.get_event(event)
if __name__ == '__main__': if __name__ == '__main__':
parser = argparse.ArgumentParser(description='Tag something.') parser = argparse.ArgumentParser(description='Tag something.')
parser.add_argument("-u", "--uuid", help="UUID to tag.") parser.add_argument("-u", "--uuid", help="UUID to tag.")
parser.add_argument("-e", "--event", help="Event ID to tag.") parser.add_argument("-e", "--event", help="Event ID to tag.")
parser.add_argument("-a", "--attribute", help="Attribute ID to tag") parser.add_argument("-a", "--attribute", help="Attribute ID to tag")
parser.add_argument("-t", "--tag", required=True, help="Attribute ID to modify.") parser.add_argument("-t", "--tag", required=True, help="Tag ID.")
args = parser.parse_args() args = parser.parse_args()
if not args.event and not args.uuid and not args.attribute: if not args.event and not args.uuid and not args.attribute:
@ -26,8 +27,6 @@ if __name__ == '__main__':
misp = init(misp_url, misp_key) misp = init(misp_url, misp_key)
event = misp.get_event(args.event)
if args.event and not args.attribute: if args.event and not args.attribute:
result = misp.search(eventid=args.event) result = misp.search(eventid=args.event)
data = result['response'] data = result['response']
@ -48,5 +47,5 @@ if __name__ == '__main__':
if args.uuid: if args.uuid:
uuid = args.uuid uuid = args.uuid
print("UUID tagged: %s"%uuid) print("UUID tagged: %s" % uuid)
misp.tag(uuid, args.tag) misp.tag(uuid, args.tag)