-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathseed.py
102 lines (92 loc) · 2.68 KB
/
seed.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
from sqlite3 import connect
DBPATH = "final_project.db"
# password b'$2b$12$GkymxjhVREpNCCaBBlkNtO3QJ8vjDNuddoF0v/fNqDlbIoeMPD776'
# INSERT INTO scans (ip_address, ports, services)VALUES ("127.0.0.1","22", "ssh")
def seed(dbpath=DBPATH):
with connect(dbpath) as connection:
cursor = connection.cursor()
SQL = """INSERT INTO np_accounts (
pk,
company_name,
username,
password_hash
) VALUES (
1,
"non_profit",
"user",
"b'$2b$12$GkymxjhVREpNCCaBBlkNtO3QJ8vjDNuddoF0v/fNqDlbIoeMPD776'"
) ;"""
cursor.execute(SQL,)
SQL = """INSERT INTO shipper_accounts (
pk,
company_name,
username,
password_hash
) VALUES (
1,
"shipper",
"user",
"b'$2b$12$GkymxjhVREpNCCaBBlkNtO3QJ8vjDNuddoF0v/fNqDlbIoeMPD776'"
) ;"""
cursor.execute(SQL,)
SQL = """ INSERT INTO routes (
pk,
shipper_account_id,
departure_location,
departure_date,
arrival_location,
arrival_date,
total_containers,
available_containers
) VALUES (
1,
1,
"NYC",
1578700800,
"Miami",
1580342400,
10,
10
);"""
cursor.execute(SQL,)
SQL = """ INSERT INTO routes (
pk,
shipper_account_id,
departure_location,
departure_date,
arrival_location,
arrival_date,
total_containers,
available_containers
) VALUES (
2,
1,
"Miami",
1578700800,
"NYC",
1580342400,
10,
10
);"""
cursor.execute(SQL,)
SQL = """ INSERT INTO routes (
pk,
shipper_account_id,
departure_location,
departure_date,
arrival_location,
arrival_date,
total_containers,
available_containers
) VALUES (
3,
1,
"NYC",
1578700800,
"Berlin",
1580342400,
10,
10
);"""
cursor.execute(SQL,)
seed()