Skip to content

Commit f4118cf

Browse files
committed
Restuctured project and dependancies
1 parent 5201686 commit f4118cf

File tree

6 files changed

+1545
-1546
lines changed

6 files changed

+1545
-1546
lines changed

RansomwareOverview.json

Lines changed: 1508 additions & 1508 deletions
Large diffs are not rendered by default.

RansomwareOverview.xlsx

0 Bytes
Binary file not shown.

UpdateJsonDataset/GenerateJsonDataset.pyproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<Compile Include="update_json.py">
2929
<SubType>Code</SubType>
3030
</Compile>
31-
<Compile Include="pretty_json.py">
31+
<Compile Include="generate_json.py">
3232
<SubType>Code</SubType>
3333
</Compile>
3434
</ItemGroup>

UpdateJsonDataset/generate_json.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import simplejson as json
2+
import xlrd
3+
from collections import OrderedDict
4+
5+
def formatJson(input):
6+
return json.dumps(json.loads(input), indent=4)
7+
8+
def excel_to_json(filename):
9+
wb = xlrd.open_workbook(filename)
10+
sh = wb.sheet_by_index(0)
11+
12+
# List to hold dictionaries
13+
c_list = []
14+
15+
# Iterate through each row in worksheet and fetch values into dict
16+
for rownum in range(1, sh.nrows):
17+
cars = OrderedDict()
18+
row_values = sh.row_values(rownum)
19+
cars['RansomwareName'] = row_values[0]
20+
cars['KnownExtensions'] = row_values[1]
21+
cars['KnownPatterns'] = row_values[2]
22+
cars['RansomNoteFilenames'] = row_values[3]
23+
cars['Comment'] = row_values[4]
24+
cars['EncryptionAlgorithm'] = row_values[5]
25+
cars['AlsoKnownAs'] = row_values[6]
26+
cars['Decryptor'] = row_values[7]
27+
cars['AdditionalInfo1'] = row_values[8]
28+
cars['AdditionalInfo2'] = row_values[9]
29+
cars['Screenshots'] = row_values[10]
30+
31+
c_list.append(cars)
32+
33+
# Serialize the list of dicts to JSON
34+
return formatJson(json.dumps(c_list))

UpdateJsonDataset/pretty_json.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

UpdateJsonDataset/update_json.py

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@
88
See: http://goo.gl/b9R8DE
99
'''
1010

11-
import pandas as pd
12-
import simplejson as json
13-
import xlrd
14-
from collections import OrderedDict
15-
16-
from pretty_json import formatInput as formatJson
11+
from generate_json import excel_to_json
1712
from download_file import download_file
1813

1914
SOURCESHEET = 'https://docs.google.com/spreadsheets/d/1TWS238xacAto-fLKh1n5uTsdijWdCEsGIM0Y0Hvmc5g/pub?output=xlsx'
@@ -24,33 +19,7 @@ def write_json_file(input, filename):
2419
output = open(filename, 'w')
2520
output.writelines(input)
2621

27-
def excel_to_json(filename):
28-
wb = xlrd.open_workbook(OUTPUTSHEET)
29-
sh = wb.sheet_by_index(0)
30-
31-
# List to hold dictionaries
32-
c_list = []
33-
34-
# Iterate through each row in worksheet and fetch values into dict
35-
for rownum in range(1, sh.nrows):
36-
cars = OrderedDict()
37-
row_values = sh.row_values(rownum)
38-
cars['RansomwareName'] = row_values[0]
39-
cars['KnownExtensions'] = row_values[1]
40-
cars['KnownPatterns'] = row_values[2]
41-
cars['RansomNoteFilenames'] = row_values[3]
42-
cars['Comment'] = row_values[4]
43-
cars['EncryptionAlgorithm'] = row_values[5]
44-
cars['AlsoKnownAs'] = row_values[6]
45-
cars['Decryptor'] = row_values[7]
46-
cars['AdditionalInfo1'] = row_values[8]
47-
cars['AdditionalInfo2'] = row_values[9]
48-
cars['Screenshots'] = row_values[10]
49-
50-
c_list.append(cars)
51-
52-
# Serialize the list of dicts to JSON
53-
return formatJson(json.dumps(c_list))
22+
5423

5524
def generate_json(source_file, download_destination, json_file):
5625
download_file(source_file, download_destination)

0 commit comments

Comments
 (0)