chg: [add_github_user] add ssh keys of the user in the MISP object

test-event-report
Alexandre Dulaunoy 2020-09-17 10:36:54 +02:00
parent e40b14e897
commit 0e0424fa30
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 3 additions and 0 deletions

View File

@ -46,8 +46,11 @@ if __name__ == '__main__':
followers = rfollowers.json() followers = rfollowers.json()
rfollowing = requests.get("https://api.github.com/users/{}/following".format(args.username)) rfollowing = requests.get("https://api.github.com/users/{}/following".format(args.username))
followings = rfollowing.json() followings = rfollowing.json()
rkeys = requests.get("https://api.github.com/users/{}/keys".format(args.username))
keys = rkeys.json()
misp_object.add_attributes("follower", *[follower['login'] for follower in followers]) misp_object.add_attributes("follower", *[follower['login'] for follower in followers])
misp_object.add_attributes("following", *[following['login'] for following in followings]) misp_object.add_attributes("following", *[following['login'] for following in followings])
misp_object.add_attributes("ssh-public-key", *[sshkey['key'] for sshkey in keys])
misp_object.add_attribute('bio', github_user['bio']) misp_object.add_attribute('bio', github_user['bio'])
misp_object.add_attribute('link', github_user['html_url']) misp_object.add_attribute('link', github_user['html_url'])
misp_object.add_attribute('user-fullname', github_user['name']) misp_object.add_attribute('user-fullname', github_user['name'])