I am trying to create an app on Django. Struggling on how to proceed on Database schema.
There are the following tables:
1), table customer:
- cust_name
- cust_addr
- cust_phone
- created_date
- ...
2), table customer_assets
- customer (foreign key pointed to table
customer) - asset_type
- asset
- asset_update_time
- asset_creation_time
- ...
The major issue is on asset, asset_type, sample data like below:
asset_type asset
------------------------------------------
domain aaa.bb.example.com
domain *.corp.example.com
ip 10.1.2.3
ip 10.8.0.0/16
url http://aaaa
url http://bbbbb
url http://aaa.bb.example.com/app1/login
email [email protected]
there are some assets like *.corp.example.com, 10.8.0.0/16. The app is supposed to do a discovery and find more assets under them, for example:
- aaa.corp.example.com
- bbb.corp.example.com
- ccc.corp.example.com
- 10.8.2.2
- 10.8.2.3
- ...
The app is then going to scan the open ports on each of them, like:
- aaa.corp.example.com. (22, 80, 1080)
- 10.8.2.2 (21, 139, 3306)
the app may then scan every ports on the assets to find urls, like:
- aaa.corp.example.com 80 /home.html
- aaa.corp.example.com 80 /admin.html
- bbb.corp.example.com 443 /console
Note that:
- data in
customer_assetsis basically provided by customer - data in
customer_assetscontains data of various types, for example,
1), wildcard sub domains (*.corp.example.com) and exact subdomains (aaa.bb.example.com).
2), exact subdomains in wildcard sub domains (*.corp.example.com) will later be discovered
what's the best way to organise the database schema?
1), is the current database schema for customer_assets ok?
2), where the discovered subdomains like aaa.corp.example.com be stored? should it be added to customer_assets as a new item,
or should I create a new table for it?
3), where to store the data of ports, and URLs for each port?
The customer might need to search there data by domain name, by port, by strings in URL, etc.
thanks
I have created table 1), table customer and table customer_assets, and it works fine.
but struggling how to proceed to store the data discovered for domain like *.corp.example.com, and how to store more detailed information discovered like ports for each subdomain (like ports 80, 22 for aaa.corp.example.com), and URLs discovered for each ports (like /admin.html for aaa.corp.example.com on port 80)