Skip to content

Instantly share code, notes, and snippets.

@iamfuzz
Created November 6, 2023 18:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamfuzz/b18ba4e64264b1159869949d974c976c to your computer and use it in GitHub Desktop.
Save iamfuzz/b18ba4e64264b1159869949d974c976c to your computer and use it in GitHub Desktop.
#!/usr/bin/python3
import json
import time
import sys
fbuffer = open(sys.argv[1],'r')
lines = fbuffer.readlines()
fbuffer.close()
timestamp = int(time.time())
counter = 0
data = []
for line in lines:
line = line.strip()
if counter == 0:
header = line.split("\t")
counter = counter + 1
continue
event = {}
event['eventType'] = "Anchore" + str(timestamp)
values = line.split("\t")
for i in range(0,len(header)):
event[header[i]] = values[i]
data.append(event)
counter = counter + 1
json_data = json.dumps(data, indent=2)
print (json_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment