clean and ready for django

This commit is contained in:
2024-11-26 06:51:01 +01:00
parent 6ae65e9169
commit 4d27a84907
41 changed files with 0 additions and 17597 deletions

View File

@@ -1,53 +0,0 @@
package controllers
import (
"fmt"
"html"
"html/template"
"log"
"net/http"
"os"
"path/filepath"
)
func Index(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/" {
w.WriteHeader(http.StatusNotFound)
fmt.Fprintf(w, "Error: 404 %s not found.", html.EscapeString(r.URL.Path))
return
}
lp := filepath.Join("application", "layouts", "main.html")
fp := filepath.Join("application", "views", "index.html")
// Return a 404 if the template doesn't exist
info, err := os.Stat(fp)
if err != nil {
if os.IsNotExist(err) {
http.NotFound(w, r)
return
}
}
// Return a 404 if the request is for a directory
if info.IsDir() {
http.NotFound(w, r)
return
}
tmpl, err := template.ParseFiles(lp, fp)
if err != nil {
// Log the detailed error
log.Print(err.Error())
// Return a generic "Internal Server Error" message
http.Error(w, http.StatusText(500), 500)
return
}
err = tmpl.ExecuteTemplate(w, "main.html", nil)
if err != nil {
log.Print(err.Error())
http.Error(w, http.StatusText(500), 500)
}
}

View File

@@ -1,117 +0,0 @@
package controllers
import (
"html/template"
"log"
"net/http"
"net/url"
"os"
"path/filepath"
"risklet/db"
)
func Signup(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
handleGet(w, r)
} else if r.Method == "POST" {
handlePost(w, r)
} else {
http.Error(w, "Method not allowed.", http.StatusMethodNotAllowed)
return
}
}
func handlePost(w http.ResponseWriter, r *http.Request) {
if err := r.ParseForm(); err != nil {
log.Println("Error processing form: ", err)
handleGet(w, r)
}
company := createCompany(r.PostForm)
companyId, err := db.InsertCompany(company)
if err != nil {
log.Println("Error inserting company into database ", err)
handleGet(w, r)
}
basicProfile := createBasicProfile(companyId, r.PostForm)
_, err = db.InsertBasicProfile(basicProfile)
if err != nil {
log.Println("Error inserting into database ", err)
handleGet(w, r)
}
http.Redirect(w, r, "/thankyou", http.StatusSeeOther)
}
func handleGet(w http.ResponseWriter, r *http.Request) {
lp := filepath.Join("application", "layouts", "main.html")
fp := filepath.Join("application", "views", "signup.html")
// add a CSP header to allow only same-origin scripts
w.Header().Set("Content-Security-Policy", "script-src 'unsafe-eval' 'self'")
// Return a 404 if the template doesn't exist
info, err := os.Stat(fp)
if err != nil {
if os.IsNotExist(err) {
http.NotFound(w, r)
return
}
}
// Return a 404 if the request is for a directory
if info.IsDir() {
http.NotFound(w, r)
return
}
tmpl, err := template.ParseFiles(lp, fp)
if err != nil {
// Log the detailed error
log.Print(err.Error())
// Return a generic "Internal Server Error" message
http.Error(w, http.StatusText(500), 500)
return
}
err = tmpl.ExecuteTemplate(w, "main.html", nil)
if err != nil {
log.Print(err.Error())
http.Error(w, http.StatusText(500), 500)
}
}
func createBasicProfile(companyId int, f url.Values) db.BasicProfile {
return db.BasicProfile{
CompanyId: companyId,
Employees: f.Get("Employees"),
Revenue: f.Get("Revenue"),
Applications: f.Get("Applications"),
Compliance: f.Get("Compliance"),
Industry: f.Get("Industry"),
ITDependency: f.Get("ITDependency"),
DataSensitivity: f.Get("DataSensitivity"),
DataVolume: f.Get("DataVolume"),
NetworkSegmentation: f.Get("NetworkSegmentation"),
LegacySystems: f.Get("LegacySystems"),
IoTIntegration: f.Get("IoTIntegration"),
RemoteWork: f.Get("RemoteWork"),
BYOD: f.Get("BYOD"),
VPN: f.Get("VPN"),
API: f.Get("API"),
VendorAccess: f.Get("VendorAccess"),
InternalDev: f.Get("InternalDev"),
}
}
func createCompany(f url.Values) db.Company {
return db.Company{
UUID: db.GenerateRandomString(),
Name: f.Get("Name"),
Email: f.Get("Email"),
TaxId: f.Get("TaxId"),
Password: db.GenerateRandomString(),
}
}

View File

@@ -1,95 +0,0 @@
package controllers
import (
"html/template"
"log"
"net/http"
"net/url"
"os"
"path/filepath"
"risklet/db"
)
func ThankYou(w http.ResponseWriter, r *http.Request) {
if r.Method == "GET" {
handleAdvancedGet(w, r)
} else if r.Method == "POST" {
handleAdvancedPost(w, r)
} else {
http.Error(w, "Method not allowed.", http.StatusMethodNotAllowed)
return
}
}
func handleAdvancedPost(w http.ResponseWriter, r *http.Request) {
if err := r.ParseForm(); err != nil {
log.Println("Error processing form: ", err)
handleAdvancedGet(w, r)
}
company := createCompany(r.PostForm)
companyId, err := db.InsertCompany(company)
if err != nil {
log.Println("Error inserting company into database ", err)
handleAdvancedGet(w, r)
}
advancedProfile := createAdvancedProfile(companyId, r.PostForm)
_, err = db.InsertAdvancedProfile(advancedProfile)
if err != nil {
log.Println("Error inserting into database ", err)
handleAdvancedGet(w, r)
}
}
func handleAdvancedGet(w http.ResponseWriter, r *http.Request) {
lp := filepath.Join("application", "layouts", "main.html")
fp := filepath.Join("application", "views", "thankyou.html")
log.Println("Hitting ThankYou")
// Return a 404 if the template doesn't exist
info, err := os.Stat(fp)
if err != nil {
if os.IsNotExist(err) {
http.NotFound(w, r)
return
}
}
// Return a 404 if the request is for a directory
if info.IsDir() {
http.NotFound(w, r)
return
}
tmpl, err := template.ParseFiles(lp, fp)
if err != nil {
// Log the detailed error
log.Print(err.Error())
// Return a generic "Internal Server Error" message
http.Error(w, http.StatusText(500), 500)
return
}
err = tmpl.ExecuteTemplate(w, "main.html", nil)
if err != nil {
log.Print(err.Error())
http.Error(w, http.StatusText(500), 500)
}
}
func createAdvancedProfile(companyId int, f url.Values) db.AdvancedProfile {
return db.AdvancedProfile{
CompanyId: companyId,
GeographicDistribution: f.Get("GeographicDistribution"),
CustomerConcentration: f.Get("CustomerConcentration"),
ProductServicePortfolio: f.Get("ProductServicePortfolio"),
OrganizationalCulture: f.Get("OrganizationalCulture"),
SupplierDiversity: f.Get("SupplierDiversity"),
TechnologicalInfrastructure: f.Get("TechnologicalInfrastructure"),
IntellectualProperty: f.Get("IntellectualProperty"),
ManagementTeamExperience: f.Get("ManagementTeamExperience"),
}
}

View File

@@ -1,43 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Hello, World!</title>
<link href="/static/css/bootstrap.css" rel="stylesheet">
<link href="/static/css/Jost.css" rel="stylesheet">
<link href="/static/css/main.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-dark bg-dark navbar-expand-lg text-light">
<div class="container-fluid">
<a class="navbar-brand" href="/"> 😱 Risklet</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Features</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Pricing</a>
</li>
<li class="nav-item">
<a class="nav-link btn btn-success text-white" href="/signup/">Sign Up</a>
</li>
</ul>
</div>
</div>
</nav>
<article class="px-3">
{{block "content" .}} {{end}}
<!-- Bootstrap JS and dependencies -->
</article>
<script src="/static/js/bootstrap.js"></script>
{{block "bottom" .}} {{end}}
</body>
</html>

View File

@@ -1,14 +0,0 @@
package application
import (
"net/http"
"risklet/application/controllers"
)
func SetupAppServer() {
fs := http.FileServer(http.Dir("./application/static"))
http.Handle("GET /static/", http.StripPrefix("/static/", fs))
http.HandleFunc("/signup/", controllers.Signup)
http.HandleFunc("/thankyou", controllers.ThankYou)
http.HandleFunc("/", controllers.Index)
}

View File

@@ -1,144 +0,0 @@
/* #### Generated By: http://font.download #### */
@font-face {
font-family: 'Jost* Book';
font-style: normal;
font-weight: normal;
src: local('Jost* Book'), url('Jost400Book.woff') format('woff');
}
@font-face {
font-family: 'Jost* BookItalic';
font-style: normal;
font-weight: normal;
src: local('Jost* BookItalic'), url('Jost400BookItalic.woff') format('woff');
}
@font-face {
font-family: 'Jost* Hairline';
font-style: normal;
font-weight: normal;
src: local('Jost* Hairline'), url('Jost100Hairline.woff') format('woff');
}
@font-face {
font-family: 'Jost* HairlineItalic';
font-style: normal;
font-weight: normal;
src: local('Jost* HairlineItalic'), url('Jost100HairlineItalic.woff') format('woff');
}
@font-face {
font-family: 'Jost* Thin';
font-style: normal;
font-weight: normal;
src: local('Jost* Thin'), url('Jost200Thin.woff') format('woff');
}
@font-face {
font-family: 'Jost* ThinItalic';
font-style: normal;
font-weight: normal;
src: local('Jost* ThinItalic'), url('Jost200ThinItalic.woff') format('woff');
}
@font-face {
font-family: 'Jost* Light';
font-style: normal;
font-weight: normal;
src: local('Jost* Light'), url('Jost300Light.woff') format('woff');
}
@font-face {
font-family: 'Jost* LightItalic';
font-style: normal;
font-weight: normal;
src: local('Jost* LightItalic'), url('Jost300LightItalic.woff') format('woff');
}
@font-face {
font-family: 'Jost* Medium';
font-style: normal;
font-weight: normal;
src: local('Jost* Medium'), url('Jost500Medium.woff') format('woff');
}
@font-face {
font-family: 'Jost* MediumItalic';
font-style: normal;
font-weight: normal;
src: local('Jost* MediumItalic'), url('Jost500MediumItalic.woff') format('woff');
}
@font-face {
font-family: 'Jost* Semi';
font-style: normal;
font-weight: normal;
src: local('Jost* Semi'), url('Jost600Semi.woff') format('woff');
}
@font-face {
font-family: 'Jost* SemiItalic';
font-style: normal;
font-weight: normal;
src: local('Jost* SemiItalic'), url('Jost600SemiItalic.woff') format('woff');
}
@font-face {
font-family: 'Jost* Bold';
font-style: normal;
font-weight: normal;
src: local('Jost* Bold'), url('Jost700Bold.woff') format('woff');
}
@font-face {
font-family: 'Jost* BoldItalic';
font-style: normal;
font-weight: normal;
src: local('Jost* BoldItalic'), url('Jost700BoldItalic.woff') format('woff');
}
@font-face {
font-family: 'Jost* Heavy';
font-style: normal;
font-weight: normal;
src: local('Jost* Heavy'), url('Jost800Heavy.woff') format('woff');
}
@font-face {
font-family: 'Jost* HeavyItalic';
font-style: normal;
font-weight: normal;
src: local('Jost* HeavyItalic'), url('Jost800HeavyItalic.woff') format('woff');
}
@font-face {
font-family: 'Jost* Black';
font-style: normal;
font-weight: normal;
src: local('Jost* Black'), url('Jost900Black.woff') format('woff');
}
@font-face {
font-family: 'Jost* BlackItalic';
font-style: normal;
font-weight: normal;
src: local('Jost* BlackItalic'), url('Jost900BlackItalic.woff') format('woff');
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,33 +0,0 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link rel="stylesheet" type="text/css"
href="style.css"/>
</head>
<body>
<h1>Generated from: http://font.download</h1><br/>
<h1 style="font-family:'Jost* Book';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* BookItalic';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* Hairline';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* HairlineItalic';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* Thin';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* ThinItalic';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* Light';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* LightItalic';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* Medium';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* MediumItalic';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* Semi';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* SemiItalic';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* Bold';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* BoldItalic';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* Heavy';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* HeavyItalic';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* Black';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
<h1 style="font-family:'Jost* BlackItalic';font-weight:normal;font-size:42px">AaBbCcDdEeFfGgHhŞşIıİi Example</h1>
</body>
</html>

View File

@@ -1,9 +0,0 @@
body {
font-family: 'Jost', sans-serif;
font-size: var(--bs-body-font-size);
}
:root {
--bs-body-font-size: 1.5rem;
}

View File

@@ -1,43 +0,0 @@
<svg width="620" height="89" viewBox="0 0 620 89" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M620 44.1094H76.4492V51.7882H620V44.1094Z" fill="#FDC0C1"/>
<path d="M76.5515 21.9563L57.6448 11.124L38.2165 0L29.0872 5.28213L0 22.1298L0.126466 22.2007L0.22922 66.2553L38.3192 88.0697L38.3271 88.2116L38.4457 88.1407L38.5722 88.2116V88.0697L76.5199 66.0976L76.4646 43.7077L76.4171 22.0431" fill="#FFDFDF"/>
<path d="M57.6049 55.5352L38.5006 66.604L38.4453 44.5688L57.5575 33.5L57.5812 44.3402L57.6049 55.5352Z" fill="#E0ECFF"/>
<path d="M33.8855 25.1176L38.4462 22.4766L48.1683 28.0425L57.6295 33.4587L38.5094 44.5275L19.334 33.5454L33.8855 25.1176Z" fill="white"/>
<path d="M19.3965 33.5703L38.5719 44.5524L38.6272 66.6034L19.4518 55.6212L19.3965 33.5703Z" fill="#5498FF"/>
<path d="M76.4481 44.3481L67.1054 38.995L57.5098 33.5L53.0045 36.1095L38.6348 44.4348L38.698 44.4663L38.7533 66.2256L57.5652 77.0027V77.0737L57.6284 77.0342L57.6916 77.0737V77.0027L76.4323 66.1467L76.4086 55.0937L76.377 44.3875" fill="#FDA7A9"/>
<path d="M57.7721 11.3923L48.3108 5.97611L38.5967 0.410156L34.0281 3.05122L19.4766 11.479L19.5398 11.5184L19.5951 33.5536L38.652 44.4647V44.5357L38.7152 44.5041L38.7705 44.5357V44.4647L57.7563 33.4747L57.7326 22.2798L57.7009 11.4396" fill="#FFDFDF"/>
<path d="M38.5415 44.2048L29.0803 38.7886L19.3661 33.2227L14.7975 35.8637L0.253906 44.2915L0.309235 44.3309L0.364564 66.3661L19.4214 77.2772V77.3482L19.4847 77.3088L19.54 77.3482V77.2772L38.5257 66.2872L38.502 55.0844L38.4704 44.2521" fill="#FDB3B5"/>
<path d="M57.6049 55.5352L38.5006 66.604L38.4453 44.5688L57.5575 33.5L57.5812 44.3402L57.6049 55.5352Z" fill="#FDC0C1"/>
<path d="M33.8855 25.1176L38.4462 22.4766L48.1683 28.0425L57.6295 33.4587L38.5094 44.5275L19.334 33.5454L33.8855 25.1176Z" fill="#FFF1F1"/>
<path d="M19.3965 33.5703L38.5719 44.5524L38.6272 66.6034L19.4518 55.6212L19.3965 33.5703Z" fill="#F87E81"/>
<path d="M257.706 21.9563L238.791 11.124L219.363 0L210.242 5.28213L181.146 22.1298L181.273 22.2007L181.384 66.2553L219.474 88.0697V88.2116L219.592 88.1407L219.719 88.2116V88.0697L257.666 66.0976L257.619 43.7077L257.564 22.0431" fill="#FFDFDF"/>
<path d="M238.759 55.5352L219.655 66.604L219.6 44.5688L238.704 33.5L238.728 44.3402L238.759 55.5352Z" fill="#E0ECFF"/>
<path d="M215.032 25.1176L219.601 22.4766L229.315 28.0425L238.776 33.4587L219.656 44.5275L200.48 33.5454L215.032 25.1176Z" fill="white"/>
<path d="M200.543 33.5703L219.718 44.5524L219.774 66.6034L200.598 55.6212L200.543 33.5703Z" fill="#5498FF"/>
<path d="M257.596 44.3481L248.262 38.995L238.666 33.5L234.161 36.1095L219.791 44.4348L219.854 44.4663L219.902 66.2256L238.714 77.0027L238.721 77.0737L238.777 77.0342L238.84 77.0737V77.0027L257.581 66.1467L257.557 55.0937L257.533 44.3875" fill="#FDA7A9"/>
<path d="M238.926 11.3923L229.465 5.97611L219.743 0.410156L215.182 3.05122L200.631 11.479L200.694 11.5184L200.749 33.5536L219.798 44.4647V44.5357L219.862 44.5041L219.925 44.5357V44.4647L238.903 33.4747L238.879 22.2798L238.855 11.4396" fill="#FFDFDF"/>
<path d="M219.696 44.2048L210.235 38.7886L200.513 33.2227L195.952 35.8637L181.4 44.2915L181.464 44.3309L181.519 66.3661L200.568 77.2772V77.3482L200.631 77.3088L200.694 77.3482V77.2772L219.672 66.2872L219.648 55.0844L219.625 44.2521" fill="#FDB3B5"/>
<path d="M238.759 55.5352L219.655 66.604L219.6 44.5688L238.704 33.5L238.728 44.3402L238.759 55.5352Z" fill="#FDC0C1"/>
<path d="M215.032 25.1176L219.601 22.4766L229.315 28.0425L238.776 33.4587L219.656 44.5275L200.48 33.5454L215.032 25.1176Z" fill="#FFF1F1"/>
<path d="M200.543 33.5703L219.718 44.5524L219.774 66.6034L200.598 55.6212L200.543 33.5703Z" fill="#F87E81"/>
<path d="M438.852 22.7454L419.946 11.9131L400.517 0.789062L391.388 6.0712L362.301 22.9188L362.427 22.9898L362.53 67.0444L400.62 88.8588V89.0007L400.746 88.9297L400.873 89.0007L400.865 88.8588L438.821 66.8867L438.765 44.4967L438.71 22.8321" fill="#FFDFDF"/>
<path d="M419.908 56.3203L400.803 67.3892L400.748 45.354L419.852 34.2852L419.884 45.1254L419.908 56.3203Z" fill="#E0ECFF"/>
<path d="M396.186 25.9067L400.747 23.2656L410.469 28.8316L419.922 34.2477L400.81 45.3166L381.635 34.3345L396.186 25.9067Z" fill="white"/>
<path d="M381.699 34.3594L400.875 45.3415L400.93 67.3924L381.747 56.4103L381.699 34.3594Z" fill="#5498FF"/>
<path d="M438.751 45.1332L429.408 39.7801L419.813 34.2852L415.307 36.8947L400.938 45.22L401.001 45.2515L401.056 67.0107L419.868 77.7879V77.8588L419.931 77.8194L419.986 77.8588V77.7879L438.735 66.9319L438.703 55.8788L438.68 45.1727" fill="#FDA7A9"/>
<path d="M420.073 12.1813L410.612 6.76517L400.897 1.19922L396.329 3.84029L381.777 12.268L381.841 12.3075L381.896 34.3426L400.945 45.2538L400.953 45.3247L401.008 45.2932L401.071 45.3247V45.2538L420.057 34.2638L420.025 23.0688L420.002 12.2286" fill="#FFDFDF"/>
<path d="M400.842 44.9938L391.381 39.5777L381.667 34.0117L377.098 36.6528L362.547 45.0805L362.61 45.12L362.665 67.1551L381.722 78.0663V78.1372L381.778 78.0978L381.841 78.1372V78.0663L400.827 67.0763L400.795 55.8734L400.771 45.0411" fill="#FDB3B5"/>
<path d="M419.908 56.3203L400.803 67.3892L400.748 45.354L419.852 34.2852L419.884 45.1254L419.908 56.3203Z" fill="#FDC0C1"/>
<path d="M396.186 25.9067L400.747 23.2656L410.469 28.8316L419.922 34.2477L400.81 45.3166L381.635 34.3345L396.186 25.9067Z" fill="#FFF1F1"/>
<path d="M381.699 34.3594L400.875 45.3415L400.93 67.3924L381.747 56.4103L381.699 34.3594Z" fill="#F87E81"/>
<path d="M620.001 22.7454L601.094 11.9131L581.666 0.789062L572.536 6.0712L543.449 22.9188L543.576 22.9898L543.678 67.0444L581.776 88.8588V89.0007L581.895 88.9297L582.021 89.0007V88.8588L619.969 66.8867L619.914 44.4967L619.866 22.8321" fill="#FFDFDF"/>
<path d="M601.062 56.3203L581.95 67.3892L581.902 45.354L601.007 34.2852L601.03 45.1254L601.062 56.3203Z" fill="#E0ECFF"/>
<path d="M577.333 25.9067L581.893 23.2656L591.616 28.8316L601.077 34.2477L581.957 45.3166L562.781 34.3345L577.333 25.9067Z" fill="white"/>
<path d="M562.846 34.3594L582.021 45.3415L582.076 67.3924L562.901 56.4103L562.846 34.3594Z" fill="#5498FF"/>
<path d="M619.897 45.1332L610.563 39.7801L600.967 34.2852L596.454 36.8947L582.084 45.22L582.147 45.2515L582.203 67.0107L601.014 77.7879V77.8588L601.078 77.8194L601.141 77.8588V77.7879L619.882 66.9319L619.858 55.8788L619.834 45.1727" fill="#FDA7A9"/>
<path d="M601.219 12.1813L591.766 6.76517L582.044 1.19922L577.483 3.84029L562.932 12.268L562.995 12.3075L563.042 34.3426L582.099 45.2538V45.3247L582.162 45.2932L582.226 45.3247L582.218 45.2538L601.203 34.2638L601.18 23.0688L601.148 12.2286" fill="#FFDFDF"/>
<path d="M581.989 44.9938L572.535 39.5777L562.813 34.0117L558.253 36.6528L543.701 45.0805L543.764 45.12L543.812 67.1551L562.869 78.0663V78.1372L562.932 78.0978L562.995 78.1372V78.0663L581.973 67.0763L581.949 55.8734L581.918 45.0411" fill="#FDB3B5"/>
<path d="M601.062 56.3203L581.95 67.3892L581.902 45.354L601.007 34.2852L601.03 45.1254L601.062 56.3203Z" fill="#FDC0C1"/>
<path d="M577.333 25.9067L581.893 23.2656L591.616 28.8316L601.077 34.2477L581.957 45.3166L562.781 34.3345L577.333 25.9067Z" fill="#FFF1F1"/>
<path d="M562.846 34.3594L582.021 45.3415L582.076 67.3924L562.901 56.4103L562.846 34.3594Z" fill="#F87E81"/>
</svg>

Before

Width:  |  Height:  |  Size: 7.0 KiB

File diff suppressed because it is too large Load Diff

View File

@@ -1,164 +0,0 @@
document.addEventListener('DOMContentLoaded', (event) => {
const form = document.querySelector('form');
const formElements = form.elements;
// Load saved form state
/* loadFormState(formElements);
// Save form state on change
form.addEventListener('change', () => {
saveFormState(formElements);
}); */
setUpNavigation()
});
function nextQuestion() {
document.currentQuestion++;
hideNavElementsAndQuestions();
showQuestion(`q${document.currentQuestion}`);
setButtonVisiblity('back', true);
setButtonVisiblity('next', true);
if (document.currentQuestion === document.lastQuestion) {
setButtonVisiblity('next', false);
setButtonVisiblity('submit', true);
}
setNextButtonAvailability();
}
function previousQuestion() {
if (document.currentQuestion > 0) {
document.currentQuestion--;
hideNavElementsAndQuestions();
showQuestion(`q${document.currentQuestion}`);
setButtonVisiblity('next', true);
setButtonVisiblity('submit', false);
document.nextEnabled = true;
}
setButtonVisiblity('back', document.currentQuestion !== 0);
setNextButtonAvailability();
}
function setUpNavigation() {
const questions = document.querySelectorAll('.question');
document.currentQuestion = 0;
document.nextEnabled = false;
document.lastQuestion = questions.length - 1;
hideNavElementsAndQuestions();
showQuestion(`q${document.currentQuestion}`);
setButtonVisiblity('next', true);
const nextButton = document.getElementById('next');
const backButton = document.getElementById('back');
nextButton.addEventListener('click', nextQuestion);
backButton.addEventListener('click', previousQuestion);
setNextButtonAvailability();
// check if next button should be enabled on every input, checkbox and radio button bellow class of .question change
const inputs = document.querySelectorAll('.question input, .question select, .question textarea');
inputs.forEach(input => {
input.addEventListener('change', setNextButtonAvailability);
});
}
function setNextButtonAvailability() {
console.log('Setting next button availability');
// check if current question is answered
// and then enable the next button, disable it otherwise
const currentQuestion = document.getElementById(`q${document.currentQuestion}`);
const nextButton = document.getElementById('next');
const submitButton = document.getElementById('submit');
// check if any input in the current question is checked, or filled in case it is a text input
let nextEnabled = false;
const inputs = currentQuestion.querySelectorAll('input, select, textarea');
for (let input of inputs) {
// if the input is not visible, skip it
if (input.checkVisibility() === false) {
continue;
}
if (input.type === 'checkbox' || input.type === 'radio') {
if (input.checked) {
nextEnabled = true;
break;
}
} else {
if (input.value) {
nextEnabled = true;
break;
}
}
}
nextButton.disabled = !nextEnabled;
submitButton.disabled = !nextEnabled;
}
function saveFormState(elements) {
const formState = {};
for (let element of elements) {
if (element.name) {
if (element.type === 'select-multiple') {
formState[element.name] = Array.from(element.selectedOptions).map(option => option.value);
} else if (element.type === 'checkbox' || element.type === 'radio') {
formState[element.name] = element.checked ? element.value : formState[element.name] || null;
} else {
formState[element.name] = element.value;
}
}
}
localStorage.setItem('formState', JSON.stringify(formState));
}
function loadFormState(elements) {
const formState = JSON.parse(localStorage.getItem('formState'));
if (formState) {
for (let element of elements) {
if (element.name && formState[element.name] !== undefined) {
if (element.type === 'select-multiple') {
Array.from(element.options).forEach(option => {
option.selected = formState[element.name].includes(option.value);
});
} else if (element.type === 'checkbox' || element.type === 'radio') {
element.checked = formState[element.name] === element.value;
} else {
element.value = formState[element.name];
}
}
}
}
}
function hideNavElementsAndQuestions() {
const questions = document.querySelectorAll('.question');
questions.forEach(question => {
// add bootstrap hidden class to the element
question.classList.add('d-none');
});
const nextButton = document.getElementById('next');
const backButton = document.getElementById('back');
const submitButton = document.getElementById('submit');
nextButton.classList.add('d-none');
backButton.classList.add('d-none');
submitButton.classList.add('d-none');
}
function showQuestion(questionId) {
const question = document.getElementById(questionId);
question.classList.remove('d-none');
}
function setButtonVisiblity(buttonId, visible) {
const button = document.getElementById(buttonId);
if (visible) {
button.classList.remove('d-none');
} else {
button.classList.add('d-none');
}
}

View File

@@ -1,25 +0,0 @@
{{define "content"}}
<div class="container">
<ul class="nav nav-tabs">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="#">Active</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Link</a>
</li>
<li class="nav-item">
<a class="nav-link disabled" aria-disabled="true">Disabled</a>
</li>
</ul>
<div class="row">
<div class="col text-center">
<h1 class="mt-5">Risklet</h1>
<p class="lead"><a class="btn btn-primary" role="button" href="/signup/1">Sign up.</a></p>
</div>
</div>
</div>
{{end}}

View File

@@ -1,705 +0,0 @@
{{define "content"}}
<div class="container">
<div class="row">
<div class="col">
<div class="text-center">
<img src="/static/img/steps-line.svg" class="img-fluid mt-3" alt="Steps image">
</div>
<h1 class="pt-4 mb-4">Risk Assessment Questions</h1>
<hr>
<form method="post">
<!-- Organization Name -->
<div class="mb-3 question" id="q0">
<label for="name" class="form-label mt-3">What is the name of your organization?</label>
<hr>
<div class="pb-3">
<input type="text" class="form-control" id="name" name="Name" required>
</div>
<small class="form-text text-muted py-3">Name of the Organization that will appear in the
report.</small>
</div>
<!-- Email -->
<div class="mb-3 question" id="q1">
<label for="email" class="form-label mt-3">What is your email?</label>
<hr>
<div class="pb-3">
<input type="email" class="form-control" id="email" name="Email" required>
</div>
<small class="form-text text-muted py-3">Email of the person responsible for using Risklet.
Report
and
magic link for login will be sent to this email.</small>
</div>
<!-- Employee Headcount -->
<div class="mb-3 question" id="q2">
<label class="form-label mt-3">What is your organization's current employee headcount?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="Employees" id="employees-1-10"
value="1-10" required>
<label class="form-check-label" for="employees-1-10">1-10</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="Employees" id="employees-11-100"
value="11-100">
<label class="form-check-label" for="employees-11-100">11-100</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="Employees" id="employees-101-10000"
value="101-10000">
<label class="form-check-label" for="employees-101-10000">101-10,000</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="Employees" id="employees-10001"
value="10001-">
<label class="form-check-label" for="employees-10001">10,001+</label>
</div>
</div>
<small class="form-text text-muted py-3">Helps determine the scale of IT infrastructure and security
needs based on user volume.</small>
</div>
<!-- Annual Revenue -->
<div class="mb-3 question" id="q3">
<label class="form-label mt-3">What is your organization's annual revenue range?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="Revenue" id="revenue-under-1m"
value="under-1m" required>
<label class="form-check-label" for="revenue-under-1m">$ under 1M</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="Revenue" id="revenue-1m-100m"
value="1m-100m">
<label class="form-check-label" for="revenue-1m-100m">$ 1M-100M</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="Revenue" id="revenue-100m-1b"
value="100m-1b">
<label class="form-check-label" for="revenue-100m-1b">$ 100M-1B</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="Revenue" id="revenue-above-1b"
value="above-1b">
<label class="form-check-label" for="revenue-above-1b">$ Above 1B</label>
</div>
</div>
<small class="form-text text-muted py-3">Indicates available resources for cybersecurity investments
and
helps assess risk appetite.</small>
</div>
<!-- Critical Business Applications -->
<div class="mb-3 question" id="q4">
<label class="form-label mt-3">How many critical business applications do your employees use
daily?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="Applications" id="apps-1-5" value="1-5"
required>
<label class="form-check-label" for="apps-1-5">1-5</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="Applications" id="apps-5-20"
value="5-20">
<label class="form-check-label" for="apps-5-20">5-20</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="Applications" id="apps-more-than-20"
value="more-than-20">
<label class="form-check-label" for="apps-more-than-20">More than 20</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="Applications" id="apps-unknown"
value="unknown">
<label class="form-check-label" for="apps-unknown">I don't know</label>
</div>
</div>
<small class="form-text text-muted py-3">Reveals the complexity of your technology landscape and
potential attack surface.</small>
</div>
<!-- Regulatory Frameworks -->
<div class="mb-3 question" id="q5">
<label class="form-label mt-3">Which regulatory frameworks is your organization required to comply
with?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="Compliance" id="compliance-gdpr"
value="gdpr">
<label class="form-check-label" for="compliance-gdpr">GDPR</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="Compliance" id="compliance-hipaa"
value="hipaa">
<label class="form-check-label" for="compliance-hipaa">HIPAA</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="Compliance" id="compliance-pci-dss"
value="pci-dss">
<label class="form-check-label" for="compliance-pci-dss">PCI DSS</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="Compliance" id="compliance-sox"
value="sox">
<label class="form-check-label" for="compliance-sox">SOX</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="Compliance" id="compliance-iso-27001"
value="iso-27001">
<label class="form-check-label" for="compliance-iso-27001">ISO 27001</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="Compliance" id="compliance-ccpa"
value="ccpa">
<label class="form-check-label" for="compliance-ccpa">CCPA</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="Compliance" id="compliance-nist"
value="nist">
<label class="form-check-label" for="compliance-nist">NIST</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="Compliance" id="compliance-other"
value="other">
<label class="form-check-label" for="compliance-other">Other</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="Compliance" id="compliance-unknown"
value="unknown">
<label class="form-check-label" for="compliance-unknown">I don't know</label>
</div>
</div>
<small class="form-text text-muted py-3">Identifies mandatory security controls and compliance
requirements that must be implemented.</small>
</div>
<!-- Industry Sector -->
<div class="mb-3 question" id="q6">
<label for="industry" class="form-label mt-3">What is your primary industry sector?</label>
<hr>
<select class="form-select" id="industry" name="Industry" required>
<option value="agriculture">Agriculture, food and forestry</option>
<option value="energy">Energy and mining</option>
<option value="metal">Basic Metal Production</option>
<option value="chemical">Chemical industries</option>
<option value="engineering">Mechanical and electrical engineering</option>
<option value="transport-equipment">Transport equipment manufacturing</option>
<option value="textiles">Textiles; clothing; leather; footwear</option>
<option value="private-services">Private services sectors</option>
<option value="commerce">Commerce</option>
<option value="financial">Financial services</option>
<option value="professional">Professional services</option>
<option value="hotels">Hotels; tourism; catering</option>
<option value="media">Media; culture; graphical</option>
<option value="postal">Postal and telecommunications services</option>
<option value="infrastructure">Infrastructure</option>
<option value="construction">Construction</option>
<option value="education">Education and research</option>
<option value="health">Health services</option>
<option value="public-service">Public service</option>
<option value="utilities">Utilities (water; gas; electricity)</option>
<option value="shipping">Shipping; ports; fisheries; inland waterways</option>
<option value="transport">Transport (including civil aviation; railways; road transport)
</option>
<option value="unknown">I don't know</option>
</select>
<small class="form-text text-muted py-3">Determines industry-specific threats, regulations, and
security
best practices applicable to your business.</small>
</div>
<!-- IT Dependency -->
<div class="mb-3 question" id="q7">
<label for="it-dependency" class="form-label mt-3">On a scale from 1-10, how dependent is your
business
operations on technology?</label>
<hr>
<input type="range" class="form-range" id="it-dependency" name="ITDependency" min="1" max="10"
required>
<div class="d-flex justify-content-between">
<span class="text-muted">Not dependent at all</span>
<span class="text-muted text-end">Heavily dependent</span>
</div>
<small class="form-text text-muted py-3">Measures the potential business impact of IT disruptions
and
helps prioritize security investments.</small>
</div>
<!-- Sensitive Data Level -->
<div class="mb-3 question" id="q8">
<label class="form-label mt-3">What level of sensitive data does your organization process?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="DataSensitivity" id="data-public"
value="public" required>
<label class="form-check-label" for="data-public">Public</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="DataSensitivity" id="data-internal"
value="internal">
<label class="form-check-label" for="data-internal">Internal</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="DataSensitivity" id="data-sensitive"
value="sensitive">
<label class="form-check-label" for="data-sensitive">Sensitive</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="DataSensitivity" id="data-confidential"
value="confidential">
<label class="form-check-label" for="data-confidential">Confidential</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="DataSensitivity" id="data-unknown"
value="unknown">
<label class="form-check-label" for="data-unknown">I don't know</label>
</div>
</div>
<small class="form-text text-muted py-3">Assesses the potential impact of data breaches and
determines
required security controls.</small>
</div>
<!-- Network Infrastructure Model -->
<div class="mb-3 question" id="q9">
<label class="form-label mt-3">What best describes your organization's network infrastructure
model?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="NetworkSegmentation" id="network-flat"
value="flat" required>
<label class="form-check-label" for="network-flat">Flat network</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="NetworkSegmentation" id="network-some"
value="some-segmentation">
<label class="form-check-label" for="network-some">Some segmentation</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="NetworkSegmentation"
id="network-segmented" value="segmented">
<label class="form-check-label" for="network-segmented">Segmented network</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="NetworkSegmentation" id="network-unknown"
value="unknown">
<label class="form-check-label" for="network-unknown">I don't know</label>
</div>
</div>
<small class="form-text text-muted py-3">Helps understand the complexity and vulnerability points in
your
technical environment.</small>
</div>
<!-- Remote Workforce Percentage -->
<div class="mb-3 question" id="q10">
<label class="form-label mt-3">What percentage of your workforce operates remotely?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="RemoteWork" id="remote-none" value="none"
required>
<label class="form-check-label" for="remote-none">None</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="RemoteWork" id="remote-1-10"
value="1-10">
<label class="form-check-label" for="remote-1-10">1-10%</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="RemoteWork" id="remote-above-10"
value="above-10">
<label class="form-check-label" for="remote-above-10">Above 10%</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="RemoteWork" id="remote-unknown"
value="unknown">
<label class="form-check-label" for="remote-unknown">I don't know</label>
</div>
</div>
<small class="form-text text-muted py-3">Evaluates remote access security requirements and potential
exposure to external threats.</small>
</div>
<!-- Third-Party Vendor Access -->
<div class="mb-3 question" id="q11">
<label class="form-label mt-3">How many third-party vendors have access to your systems?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="VendorAccess" id="vendor-none"
value="none" required>
<label class="form-check-label" for="vendor-none">None</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="VendorAccess" id="vendor-1-5"
value="1-5">
<label class="form-check-label" for="vendor-1-5">1-5</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="VendorAccess" id="vendor-more-than-5"
value="more-than-5">
<label class="form-check-label" for="vendor-more-than-5">More than 5</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="VendorAccess" id="vendor-unknown"
value="unknown">
<label class="form-check-label" for="vendor-unknown">I don't know</label>
</div>
</div>
<small class="form-text text-muted py-3">Assesses supply chain risk and the need for vendor security
management.</small>
</div>
<!-- Internal Software Development -->
<div class="mb-3 question" id="q12">
<label class="form-label mt-3">What is the extent of your internal software development
activities?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="InternalDev" id="dev-none" value="none"
required>
<label class="form-check-label" for="dev-none">None</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="InternalDev" id="dev-some" value="some">
<label class="form-check-label" for="dev-some">Some internal software development</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="InternalDev" id="dev-significant"
value="significant">
<label class="form-check-label" for="dev-significant">Significant internal software
development</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="InternalDev" id="dev-unknown"
value="unknown">
<label class="form-check-label" for="dev-unknown">I don't know</label>
</div>
</div>
<small class="form-text text-muted py-3">Determines the need for secure development practices and
application security measures.</small>
</div>
<div class="mb-3 question" id="q13">
<label class="form-label mt-3">We have enough information for a basic report. Would you like to
provide more
details ?</label>
<hr>
<div class="text-center">
<div class="text-center pb-3">
<input class="btn btn-warning btn-lg" type="submit" name="HalfSubmit" id="halfsubmit"
value="Generate report with basic data. ">
</div>
</div>
<small class="form-text text-muted py-3">Click Next if you want to provide more details. Each
question is
optional.</small>
</div>
<!-- skip rest if needed -->
<!-- Geographic Operational Scope -->
<div class="mb-3 question" id="q14">
<label class="form-label mt-3">What is your organization's geographic operational scope?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="GeoScope" id="geo-single-country"
value="single-country">
<label class="form-check-label" for="geo-single-country">Single country</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="GeoScope" id="geo-single-region"
value="single-region">
<label class="form-check-label" for="geo-single-region">Multiple countries - Single
region</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="GeoScope" id="geo-multiple-regions"
value="multiple-regions">
<label class="form-check-label" for="geo-multiple-regions">Multiple countries - Multiple
regions</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="GeoScope" id="geo-global" value="global">
<label class="form-check-label" for="geo-global">Global operations</label>
</div>
</div>
<small class="form-text text-muted py-3">Determines exposure to different cybersecurity
regulations.</small>
</div>
<div class="mb-3 question" id="q15">
<label class="form-label mt-3">How would you characterize your customer base distribution?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="CustomerBase" id="customer-few-key"
value="few-key">
<label class="form-check-label" for="customer-few-key">Few key clients (1-5)</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="CustomerBase" id="customer-moderate"
value="moderate">
<label class="form-check-label" for="customer-moderate">Moderate concentration
(6-20)</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="CustomerBase" id="customer-diverse"
value="diverse">
<label class="form-check-label" for="customer-diverse">Diverse customer base (20+)</label>
</div>
</div>
<small class="form-text text-muted py-3">Assesses potential impact of data breaches.</small>
</div>
<!-- Primary Customer Type -->
<div class="mb-3 question" id="q16">
<label class="form-label mt-3">What is your primary customer type?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="CustomerType" id="customer-b2b"
value="b2b">
<label class="form-check-label" for="customer-b2b">Primarily B2B</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="CustomerType" id="customer-b2c"
value="b2c">
<label class="form-check-label" for="customer-b2c">Primarily B2C</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="CustomerType" id="customer-mixed"
value="mixed">
<label class="form-check-label" for="customer-mixed">Mixed B2B/B2C</label>
</div>
</div>
<small class="form-text text-muted py-3">Defines data protection requirements.</small>
</div>
<!-- Product/Service Portfolio -->
<div class="mb-3 question" id="q17">
<label class="form-label mt-3">How diversified is your product/service portfolio?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="ProductPortfolio" id="portfolio-single"
value="single">
<label class="form-check-label" for="portfolio-single">Single product/service</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="ProductPortfolio" id="portfolio-2-5"
value="2-5">
<label class="form-check-label" for="portfolio-2-5">2-5 products/services</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="ProductPortfolio"
id="portfolio-more-than-5" value="more-than-5">
<label class="form-check-label" for="portfolio-more-than-5">More than 5
products/services</label>
</div>
</div>
<small class="form-text text-muted py-3">Indicates the variety of systems requiring
protection.</small>
</div>
<!-- Supplier Base Structure -->
<div class="mb-3 question" id="q18">
<label class="form-label mt-3">What is your supplier base structure?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="SupplierBase"
id="supplier-single-critical" value="single-critical">
<label class="form-check-label" for="supplier-single-critical">Single/few critical
suppliers</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="SupplierBase" id="supplier-moderate"
value="moderate">
<label class="form-check-label" for="supplier-moderate">Moderate supplier base</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="SupplierBase"
id="supplier-highly-diverse" value="highly-diverse">
<label class="form-check-label" for="supplier-highly-diverse">Highly diverse supplier
base</label>
</div>
</div>
<small class="form-text text-muted py-3">Assesses third-party cybersecurity risks.</small>
</div>
<!-- IT Infrastructure Model -->
<div class="mb-3 question" id="q19">
<label class="form-label mt-3">What is your primary IT infrastructure model?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="ITInfrastructure" id="it-on-prem"
value="on-premises">
<label class="form-check-label" for="it-on-prem">On-premises systems</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="ITInfrastructure" id="it-cloud"
value="cloud-based">
<label class="form-check-label" for="it-cloud">Cloud-based systems</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="ITInfrastructure" id="it-hybrid"
value="hybrid">
<label class="form-check-label" for="it-hybrid">Hybrid infrastructure</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="ITInfrastructure" id="it-legacy"
value="legacy">
<label class="form-check-label" for="it-legacy">Legacy systems</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="ITInfrastructure" id="it-modern"
value="modern">
<label class="form-check-label" for="it-modern">Modern architecture</label>
</div>
</div>
<small class="form-text text-muted py-3">Determines specific cybersecurity controls.</small>
</div>
<!-- Intellectual Property Protection -->
<div class="mb-3 question" id="q20">
<label class="form-label mt-3">How does your organization protect and manage intellectual
property?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="IPProtection" id="ip-patents"
value="patents">
<label class="form-check-label" for="ip-patents">Patents owned</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="IPProtection" id="ip-licensed"
value="licensed-ip">
<label class="form-check-label" for="ip-licensed">Licensed IP from others</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="IPProtection" id="ip-trade-secrets"
value="trade-secrets">
<label class="form-check-label" for="ip-trade-secrets">Trade secrets</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="IPProtection" id="ip-joint"
value="joint-ip">
<label class="form-check-label" for="ip-joint">Joint IP ownership</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="IPProtection" id="ip-none"
value="no-ip">
<label class="form-check-label" for="ip-none">No significant IP</label>
</div>
</div>
<small class="form-text text-muted py-3">Evaluates cybersecurity needs based on IP
ownership.</small>
</div>
<!-- Sensitive Data -->
<div class="mb-3 question" id="q21">
<label class="form-label mt-3">What type of sensitive data does your organization handle?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="checkbox" name="SensitiveData" id="data-personal"
value="personal">
<label class="form-check-label" for="data-personal">Personal customer data</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="SensitiveData" id="data-financial"
value="financial">
<label class="form-check-label" for="data-financial">Financial records</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="SensitiveData" id="data-healthcare"
value="healthcare">
<label class="form-check-label" for="data-healthcare">Healthcare information</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="SensitiveData" id="data-ip"
value="ip">
<label class="form-check-label" for="data-ip">Intellectual property</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="SensitiveData" id="data-gov"
value="government">
<label class="form-check-label" for="data-gov">Government data</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" name="SensitiveData" id="data-payment"
value="payment">
<label class="form-check-label" for="data-payment">Payment card data</label>
</div>
</div>
<small class="form-text text-muted py-3">Identifies compliance frameworks.</small>
</div>
<!-- Critical Business Systems -->
<div class="mb-3 question" id="q22">
<label class="form-label mt-3">How integrated are your critical business systems?</label>
<hr>
<div class="pb-3">
<div class="form-check">
<input class="form-check-input" type="radio" name="IntegrationLevel"
id="integration-fully-integrated" value="fully-integrated">
<label class="form-check-label" for="integration-fully-integrated">Fully integrated</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="IntegrationLevel"
id="integration-partially-integrated" value="partially-integrated">
<label class="form-check-label" for="integration-partially-integrated">Partially
integrated</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="IntegrationLevel"
id="integration-mostly-separate" value="mostly-separate">
<label class="form-check-label" for="integration-mostly-separate">Mostly separate</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="IntegrationLevel"
id="integration-completely-isolated" value="completely-isolated">
<label class="form-check-label" for="integration-completely-isolated">Completely
isolated</label>
</div>
</div>
<small class="form-text text-muted py-3">Evaluates potential for cascade failures.</small>
</div>
<div class="d-flex justify-content-end mt-4">
<button type="button" class="btn btn-lg btn-outline-secondary me-3" id="back">Back</button>
<button type="submit" class="btn btn-primary btn-lg" id="submit">Next</button>
<button type="button" class="btn btn-primary btn-lg" id="next">Next</button>
</div>
</form>
</div>
</div>
</div>
{{end}}
{{define "bottom"}}
<script src="/static/js/formHandling.js"></script>
{{end}}

View File

@@ -1,13 +0,0 @@
{{define "content"}}
<div class="container">
<div class="row">
<div class="col">
<h1 class="pt-4 mt-5 mb-4">Thank you</h1>
</div>
</div>
</div>
{{end}}
{{define "bottom"}}
<script src="/static/js/formHandling.js"></script>
{{end}}

View File

@@ -1,43 +0,0 @@
package db
type AdvancedProfile struct {
CompanyId int
GeographicDistribution string
CustomerConcentration string
ProductServicePortfolio string
OrganizationalCulture string
SupplierDiversity string
TechnologicalInfrastructure string
IntellectualProperty string
ManagementTeamExperience string
}
// InsertAdvancedProfile inserts a new record into the AdvancedProfile table
func InsertAdvancedProfile(profile AdvancedProfile) (int, error) {
query := `
INSERT INTO AdvancedProfile (
CompanyId, GeographicDistribution, CustomerConcentration, ProductServicePortfolio, OrganizationalCulture,
SupplierDiversity, TechnologicalInfrastructure, IntellectualProperty, ManagementTeamExperience
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id
`
stmt, err := db.Prepare(query)
if err != nil {
return -2, err
}
defer stmt.Close()
id := 0
err = stmt.QueryRow(
profile.CompanyId, profile.GeographicDistribution, profile.CustomerConcentration, profile.ProductServicePortfolio,
profile.OrganizationalCulture, profile.SupplierDiversity, profile.TechnologicalInfrastructure, profile.IntellectualProperty,
profile.ManagementTeamExperience,
).Scan(&id)
if err != nil {
return -1, err
}
return id, nil
}

View File

@@ -1,64 +0,0 @@
package db
type BasicProfile struct {
CompanyId int // Company ID (foreign key reference)
Employees string // Current employee headcount
Revenue string // Annual revenue range
Applications string // Critical business applications
Compliance string // Regulatory frameworks
Industry string // Primary industry sector
ITDependency string // Technology dependency
DataSensitivity string // Sensitive data level
DataVolume string // Data volume (if applicable)
NetworkSegmentation string // Network infrastructure model
LegacySystems string // Legacy systems (if applicable)
IoTIntegration string // IoT integration (if applicable)
RemoteWork string // Remote work details
BYOD string // Bring Your Own Device policy
VPN string // VPN usage policy
API string // API integration (if applicable)
VendorAccess string // Third-party vendor access
InternalDev string // Internal software development activities
// New fields from the advanced form
GeoScope string // Geographic operational scope
CustomerBase string // Customer base distribution
CustomerType string // Primary customer type
ProductPortfolio string // Product/service portfolio
SupplierBase string // Supplier base structure
ITInfrastructure string // IT infrastructure model (comma-separated values)
IPProtection string // Intellectual property protection (comma-separated values)
SensitiveData string // Sensitive data types (comma-separated values)
IntegrationLevel string // Integration level of business systems
RemotePolicy string // Remote work policy
}
// InsertBasicProfile inserts a new record into the BasicProfile table
func InsertBasicProfile(profile BasicProfile) (int, error) {
query := `
INSERT INTO BasicProfile (
CompanyId, Employees, Revenue, Applications, Compliance, Industry, ITDependency, DataSensitivity, DataVolume,
NetworkSegmentation, LegacySystems, IoTIntegration, RemoteWork, BYOD, VPN, API, VendorAccess, InternalDev
) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
RETURNING id
`
stmt, err := db.Prepare(query)
if err != nil {
return -2, err
}
defer stmt.Close()
id := 0
err = stmt.QueryRow(
profile.CompanyId, profile.Employees, profile.Revenue, profile.Applications, profile.Compliance, profile.Industry,
profile.ITDependency, profile.DataSensitivity, profile.DataVolume, profile.NetworkSegmentation, profile.LegacySystems,
profile.IoTIntegration, profile.RemoteWork, profile.BYOD, profile.VPN, profile.API, profile.VendorAccess, profile.InternalDev,
).Scan(&id)
if err != nil {
return -1, err
}
return id, nil
}

View File

@@ -1,36 +0,0 @@
package db
type Company struct {
ID int
UUID string
Name string
Email string
TaxId string
Password string
}
// InsertCompany inserts a new record into the Company table
func InsertCompany(company Company) (int, error) {
query := `
INSERT INTO Company (UUID, Name, Email, TaxId, Password)
VALUES (?, ?, ?, ?, ?)
RETURNING id
`
stmt, err := db.Prepare(query)
if err != nil {
return -2, err
}
defer stmt.Close()
id := 0
err = stmt.QueryRow(
company.UUID, company.Name, company.Email, company.TaxId, company.Password,
).Scan(&id)
if err != nil {
return -1, err
}
return id, nil
}

View File

@@ -1,93 +0,0 @@
package db
import (
"database/sql"
"log"
"sync"
_ "github.com/mattn/go-sqlite3"
)
var (
db *sql.DB
once sync.Once
)
func InitDB() {
once.Do(func() {
var err error
db, err = sql.Open("sqlite3", "./risklet.db")
if err != nil {
log.Fatal(err)
}
createTables()
})
}
func createTables() {
tables := []string{
`
CREATE TABLE IF NOT EXISTS Company (
id INTEGER PRIMARY KEY AUTOINCREMENT,
UUID TEXT NOT NULL,
Name TEXT NOT NULL,
TaxId TEXT NOT NULL,
Email TEXT NOT NULL,
Password TEXT NOT NULL
);`,
`
CREATE TABLE IF NOT EXISTS BasicProfile (
id INTEGER PRIMARY KEY AUTOINCREMENT,
CompanyId INTEGER,
Employees TEXT,
Revenue TEXT,
Applications TEXT,
Compliance TEXT,
Industry TEXT,
ITDependency TEXT,
DataSensitivity TEXT,
DataVolume TEXT,
NetworkSegmentation TEXT,
LegacySystems TEXT,
IoTIntegration TEXT,
RemoteWork TEXT,
BYOD TEXT,
VPN TEXT,
API TEXT,
VendorAccess TEXT,
InternalDev TEXT,
GeoScope TEXT, -- Geographic operational scope
CustomerBase TEXT, -- Customer base distribution
CustomerType TEXT, -- Primary customer type
ProductPortfolio TEXT, -- Product/service portfolio
SupplierBase TEXT, -- Supplier base structure
ITInfrastructure TEXT, -- IT infrastructure model (comma-separated values)
IPProtection TEXT, -- Intellectual property protection (comma-separated values)
SensitiveData TEXT, -- Sensitive data types (comma-separated values)
IntegrationLevel TEXT, -- Integration level of business systems
RemotePolicy TEXT, -- Remote work policy
FOREIGN KEY (CompanyId) REFERENCES Company(id)
);`,
`CREATE TABLE IF NOT EXISTS Session (
id INTEGER PRIMARY KEY AUTOINCREMENT,
key TEXT NOT NULL,
value TEXT NOT NULL
);`,
`CREATE INDEX IF NOT EXISTS idx_session_key ON Session(key);`,
}
for _, table := range tables {
_, err := db.Exec(table)
if err != nil {
log.Fatalf("Error creating table: %v", err)
}
}
}
func GetDB() *sql.DB {
return db
}

View File

@@ -1,23 +0,0 @@
package db
import (
"crypto/rand"
"log"
"math/big"
)
var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890")
func GenerateRandomString() string {
const n = 38
b := make([]rune, n)
for i := range b {
num, err := rand.Int(rand.Reader, big.NewInt(int64(len(letters))))
if err != nil {
log.Println("Error generating random string: ", err)
continue
}
b[i] = letters[num.Int64()]
}
return string(b)
}

6
go.mod
View File

@@ -1,6 +0,0 @@
module risklet
go 1.23.2
require github.com/mattn/go-sqlite3 v1.14.24
require github.com/gin-gonic/gin v1.10.0

3
go.sum
View File

@@ -1,3 +0,0 @@
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM=
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=

18
main.go
View File

@@ -1,18 +0,0 @@
package main
import (
"log"
"net/http"
"risklet/application"
"risklet/db"
)
func main() {
db.InitDB()
application.SetupAppServer()
log.Print("Listening on :3000....")
err := http.ListenAndServe(":3000", nil)
if err != nil {
log.Fatal(err)
}
}