Created
February 12, 2019 18:01
-
-
Save rkreddyp/236bb754b6cc59f9e3524d8aa19c558e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
readonly = "false" # change it to false if you want write events as well | |
eventdf = cloudtrail_helpers.get_events_df("EventName", "PutConfigRule", starttime, endtime, readonly) | |
print (eventdf.shape) | |
eventdf.EventTime = pd.to_datetime(eventdf.EventTime, format='%m-%d-%Y:%H').apply(lambda x:x.strftime('%m-%d-%Y')) | |
sdf = eventdf[["EventTime", 'Username', 'userAgent', 'sourceIPAddress']] | |
sdf = sdf.groupby( ["EventTime", "userAgent", 'sourceIPAddress'] )['Username'].agg(','.join).reset_index(name='Usernames') | |
sdf.to_csv("/tmp/consolelogins.csv") | |
link = lib_helpers.take_uploadfilename_return_link("consolelogins.csv", "consolelogins.csv") | |
display (md("##### Download the csv of the below table [here]({link})".format(link=link) ) ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment