-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilter.py
executable file
·46 lines (41 loc) · 1.25 KB
/
filter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#! /usr/bin/env python2
"""
Arsh Chauhan
04/11/2016
Edited: 04/12/2016
filter.py: Filters a dump of Mike's lawlorg DB
Made for a UAF Cyber Security Club exercise
"""
"""
TODO: Function to filter by employee name
Funtion to take employee and return ID
"""
import json
import time
def search(employees,department):
ITEmployees = []
for person in employees:
if person["4Department"] == department:
ITEmployees.append(person)
return ITEmployees
if __name__ == '__main__':
startTime = time.time()
with open("employees.json") as jsonFile:
rawDatabase = json.load(jsonFile)
ITEmployees = search(rawDatabase,"Information Technology")
Management = search (rawDatabase,"Management")
HREmployees = search(rawDatabase,"Human Resources")
securityEmployees = search (rawDatabase,"Security")
janiorialEmployees = search (rawDatabase, "Janitorial")
IT = open('informationTechnology.json','w')
Mng = open("management.json",'w')
HR = open('humanResources.json','w')
Sec = open('security.json','w')
Janitors = open('janitorial.json','w')
json.dump(ITEmployees,IT)
json.dump(Management,Mng)
json.dump(HREmployees,HR)
json.dump(securityEmployees,Sec)
json.dump(janiorialEmployees,Janitors)
endTime = time.time()
print("Run Time: ") + str(endTime - startTime)